A method and device for deleting blockchain data
By anchoring the value of the system resources of node devices with virtual resources in the blockchain network, receiving data deletion transactions and deducting the corresponding virtual resources, the problems of resource management and billing in the alliance chain are solved, and effective management and rational utilization of resources are achieved.
Patent Information
- Application Number
- CN202110827171.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-10-20
- Publication Date
- 2025-09-30
- Estimated Expiration
- 2040-10-20
AI Technical Summary
In blockchain networks, especially in consortium chain environments, there is still a lack of effective resource management and billing methods for how to effectively manage and bill the blockchain resources provided by node devices, especially storage, computing, and network resources.
By anchoring the value of the system resources of the blockchain node device with the virtual resources, receiving data deletion transactions, calculating the amount of virtual resources consumed by the system resources, and deducting the corresponding virtual resources from the user account, the data deletion transaction is executed to optimize the storage space of the smart contract account.
It realizes the effective management and billing of node device resources in the blockchain network, optimizes the storage space of smart contract accounts, and ensures fair allocation and rational use of resources.
Smart Images

Figure CN113570459B_ABST
Abstract
Description
Technical Field
[0001] One or more embodiments of this specification relate to the field of blockchain technology, and in particular, to a method and device for deleting blockchain data. Background Art
[0002] Blockchain technology, also known as distributed ledger technology, is an emerging technology that enables multiple computing devices to jointly maintain a complete distributed database. Due to its decentralized, transparent nature, the ability of each computing device to participate in database records, and the rapid synchronization of data between computing devices, blockchain technology has been widely applied in numerous fields. Summary of the Invention
[0003] In view of this, one or more embodiments of this specification provide a method, apparatus, and computer device for deleting blockchain data.
[0004] To achieve the above objectives, one or more embodiments of this specification provide the following technical solutions:
[0005] According to a first aspect of one or more embodiments of this specification, a method for deleting blockchain data is proposed, which is applied to a node device of a blockchain, wherein the system resources carried by the node device are value-anchored with the virtual resources published on the blockchain, comprising:
[0006] Receiving a data deletion transaction sent by a blockchain client, wherein the data deletion transaction includes identification information of the target data to be deleted and an account identification of the user;
[0007] Calculating a first amount of system resources of the node device consumed in processing the data deletion transaction, and determining a second amount of the virtual resources anchored to a value of the first amount of system resources;
[0008] The second amount of virtual resources is deducted from the virtual resources held by the user account corresponding to the account identifier; and after the deduction, the data deletion transaction is executed to delete the target data corresponding to the identification information from the target smart contract account managed by the user.
[0009] According to a second aspect of one or more embodiments of this specification, a method for deleting blockchain data is proposed, which is applied to a node device of a blockchain, wherein the system resources carried by the node device are value-anchored with the virtual resources published on the blockchain, comprising:
[0010] Receiving a data deletion transaction sent by a blockchain client, wherein the data deletion transaction includes identification information of the target data to be deleted and an account identification of the user;
[0011] Executing the data deletion transaction to delete the target data corresponding to the identification information from the target smart contract account managed by the user;
[0012] After executing the data deletion transaction, the first quantity of system resources of the node device consumed in processing the data deletion transaction is calculated, and the second quantity of the virtual resources anchored to the value of the first quantity of system resources is determined; and the second quantity of virtual resources is deducted from the virtual resources held by the user account corresponding to the account identifier.
[0013] According to a third aspect of one or more embodiments of this specification, a device for deleting blockchain data is provided, which is applied to a node device of a blockchain, wherein the system resources carried by the node device are value-anchored with the virtual resources published on the blockchain, including:
[0014] A receiving unit, configured to receive a data deletion transaction sent by a blockchain client, wherein the data deletion transaction includes identification information of target data to be deleted and an account identification of a user;
[0015] a calculation unit, configured to calculate a first amount of system resources of the node device consumed in processing the data deletion transaction, and determine a second amount of the virtual resources anchored to a value of the first amount of system resources;
[0016] a deduction unit, configured to deduct the second amount of virtual resources from the virtual resources held by the user account corresponding to the account identifier;
[0017] An execution unit executes the data deletion transaction after the deduction, and deletes the target data corresponding to the identification information from the target smart contract account managed by the user.
[0018] According to a fourth aspect of one or more embodiments of this specification, a device for deleting blockchain data is provided, which is applied to a node device of a blockchain, wherein the system resources carried by the node device are value-anchored with the virtual resources published on the blockchain, including:
[0019] A receiving unit, configured to receive a data deletion transaction sent by a blockchain client, wherein the data deletion transaction includes identification information of target data to be deleted and an account identification of a user;
[0020] An execution unit, configured to execute the data deletion transaction to delete the target data corresponding to the identification information from the target smart contract account managed by the user;
[0021] a calculation unit, after executing the data deletion transaction, calculating a first amount of system resources of the node device consumed in processing the data deletion transaction, and determining a second amount of the virtual resource anchored to the value of the first amount of system resources;
[0022] The deduction unit deducts the second amount of virtual resources from the virtual resources held by the user account corresponding to the account identifier.
[0023] According to a fifth aspect of one or more embodiments of this specification, a computer device is proposed, comprising: a memory and a processor; a computer program executable by the processor is stored on the memory; when the processor executes the computer program, the method for deleting blockchain data executed by the node device described in the implementation method provided in the first aspect above is executed.
[0024] According to a sixth aspect of one or more embodiments of this specification, a computer device is proposed, comprising: a memory and a processor; a computer program executable by the processor is stored on the memory; when the processor executes the computer program, the method for deleting blockchain data executed by the node device as described in the implementation method provided in the second aspect above is executed.
[0025] Based on the blockchain data deletion method, apparatus, computer device, and computer-readable storage medium described in one or more of the above-mentioned embodiments, the system resources carried by the node devices of the blockchain can be anchored in value with the virtual resources, so that a second amount of virtual resources can be anchored based on a first amount of system resources of the node devices of the blockchain consumed in processing data deletion transactions by the node devices, and the second amount of virtual resources can be collected by the node devices of the blockchain, so that users can optimize the management of the account storage space of smart contracts. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 is a schematic diagram of creating a smart contract provided by an exemplary embodiment;
[0027] Figure 2 This is a schematic diagram of calling a smart contract provided by an exemplary embodiment;
[0028] Figure 3 This is a schematic diagram of creating and calling a smart contract provided by an exemplary embodiment;
[0029] Figure 4 This is a flowchart of a method for deleting blockchain data provided by an exemplary embodiment;
[0030] Figure 5 This is a schematic diagram of a device for deleting blockchain data applied to a node device of a blockchain, provided by an exemplary embodiment;
[0031] Figure 6 2 is a schematic diagram of a device for deleting blockchain data applied to a node device of a blockchain, provided by another exemplary embodiment;
[0032] Figure 7 This is a hardware structure diagram of an embodiment of a device for deleting blockchain data provided in this specification. DETAILED DESCRIPTION
[0033] Exemplary embodiments are described in detail herein, with examples illustrated in the accompanying drawings. When the following description refers to the drawings, identical numerals in different drawings represent identical or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments are not intended to represent all embodiments consistent with one or more embodiments of this specification.
[0034] It should be noted that in other embodiments, the steps of the corresponding method are not necessarily performed in the order shown and described in this specification. In some other embodiments, the method may include more or fewer steps than those described in this specification. In addition, a single step described in this specification may be broken down into multiple steps for description in other embodiments, and multiple steps described in this specification may be combined into a single step for description in other embodiments.
[0035] The blockchain or blockchain network described in one or more embodiments of this specification may specifically refer to a P2P network system with a distributed data storage structure in which each node device reaches consensus through a consensus mechanism. The ledger data in the blockchain is distributed in "blocks" that are connected in time. The subsequent block may contain a data summary of the previous block, and depending on the specific consensus mechanism (such as POW, POS, DPOS or PBFT, etc.), full data backup of all or some nodes is achieved.
[0036] Blockchains are generally divided into three types: public blockchain, private blockchain, and consortium blockchain. Furthermore, there can be combinations of these types, such as private blockchain + consortium blockchain, or consortium blockchain + public blockchain.
[0037] Public blockchains are the most decentralized. Participants in a public blockchain (also known as nodes in the blockchain) can access data records, participate in transactions, and compete for the right to record new blocks. Furthermore, each node can freely join or leave the network and perform related operations.
[0038] In contrast, a private blockchain has write permissions controlled by a specific organization or institution, while data read permissions are regulated by that organization. Simply put, a private blockchain can be a weakly centralized system with strict node restrictions and a small number of nodes. This type of blockchain is more suitable for internal use within a specific organization.
[0039] Consortium blockchains are a cross between public and private blockchains, enabling partial decentralization. Each node in a consortium chain typically has a corresponding entity or organization; nodes are authorized to join the network and form a stakeholder alliance to jointly maintain the blockchain's operations.
[0040] Computing devices can construct data into a standard transaction format supported by the blockchain, and then publish it to the blockchain. The node devices in the blockchain will perform consensus processing on the received transactions. After reaching consensus, the node devices serving as accounting nodes in the blockchain will package the transaction into a block and store it persistently in the blockchain.
[0041] Regardless of the blockchain's consensus algorithm, the accounting node can package received transactions to generate a new block and send this block to other nodes for consensus verification. If other nodes verify the new block, they can append it to the end of the existing blockchain, completing the blockchain's accounting process. While other nodes are verifying the new block sent by the accounting node, they can also execute the transactions contained in that block.
[0042] It's important to note that every time a blockchain generates a new block, the corresponding states of those transactions in that block are executed. For example, in an account-based blockchain, the state of external accounts or smart contract accounts typically changes as transactions are executed.
[0043] For example, when a "transfer transaction" in a block is executed, the balances of the transferor account and the transferee account related to the "transfer transaction" (that is, the field values of the Balance fields of these accounts) will usually change accordingly.
[0044] For example, the "smart contract call transaction" in the block is used to call the smart contract deployed on the blockchain, call the above smart contract in the EVM corresponding to the node device to execute the above "smart contract call transaction", and update the account status of the smart contract account after executing the above smart contract call transaction in the account of the smart contract.
[0045] In practical applications, whether public, private, or consortium blockchains, they all offer smart contract functionality. Smart contracts on the blockchain are contracts that can be triggered and executed by transactions on the blockchain. Smart contracts can be defined in code.
[0046] Taking Ethereum as an example, users can create and invoke complex logic within the Ethereum network. As a programmable blockchain, Ethereum's core is the Ethereum Virtual Machine (EVM), which runs on every Ethereum node. The EVM is a Turing-complete virtual machine that enables the implementation of complex logic. When users publish and invoke smart contracts within Ethereum, they execute them on the EVM. In reality, the EVM directly runs virtual machine code (virtual machine bytecode, hereinafter referred to as "bytecode"), so smart contracts deployed on the blockchain can be bytecode.
[0047] like Figure 1 As shown in the figure, after Bob sends a transaction containing information about creating a smart contract to the Ethereum network, each node can execute this transaction in the EVM. The From field of the transaction in the figure records the address of the account that initiated the smart contract creation. The value of the Data field of the transaction stores the contract code, which can be bytecode. The value of the To field of the transaction is a null account. Once the nodes reach consensus through the consensus mechanism, the smart contract is successfully created and can be subsequently invoked by users.
[0048] After a smart contract is created, a contract account corresponding to the smart contract appears on the blockchain and has a specific address; for example, Figure 1 The "0x68e12cf284..." in each node represents the address of the created contract account; the contract code and account storage are stored in the contract account's account storage. The smart contract's behavior is controlled by the contract code, while the smart contract's account storage stores the contract's state. In other words, smart contracts create virtual accounts on the blockchain that contain the contract code and account storage.
[0049] As mentioned above, the Data field of a transaction that creates a smart contract may contain the bytecode for that smart contract. Bytecode consists of a series of bytes, each of which identifies an operation. For reasons of development efficiency and readability, developers can choose to write smart contract code in a high-level language rather than directly writing bytecode. Examples of high-level languages include Solidity, Serpent, and LLL. Smart contract code written in a high-level language can be compiled using a compiler to generate bytecode that can be deployed on the blockchain.
[0050] Taking the Solidity language as an example, contract code written in it is very similar to classes in object-oriented programming languages. A contract can declare a variety of members, including state variables, functions, function modifiers, events, etc. State variables are values permanently stored in the smart contract's account storage field to preserve the contract's state.
[0051] like Figure 2 As shown in the figure, still using Ethereum as an example, after Bob sends a transaction containing information to call a smart contract to the Ethereum network, each node can execute this transaction in the EVM. The From field of the transaction in the figure records the address of the account initiating the smart contract call, the To field records the address of the called smart contract, and the Data field records the method and parameters used to call the smart contract. After calling a smart contract, the account status of the contract account may change. Subsequently, a client can view the account status of the contract account through a connected blockchain node. For example, this account status can be stored in the smart contract's Storage tree as key-value pairs. The execution result of the transaction that called the smart contract can be stored in the MPT receipt tree as a transaction receipt.
[0052] Smart contracts can be executed independently on each node in the blockchain network in a prescribed manner, and all execution records and data are stored on the blockchain. Therefore, when such a transaction is executed, the blockchain will store transaction credentials that cannot be tampered with or lost.
[0053] The schematic diagram of creating and calling smart contracts is as follows Figure 3 As shown in Figure 2. Creating a smart contract in Ethereum requires writing the smart contract, converting it into bytecode, and deploying it to the blockchain. Calling a smart contract in Ethereum involves initiating a transaction directed to the smart contract address. The EVMs of each node can execute this transaction separately, distributing the smart contract code across the virtual machines of every node in the Ethereum network.
[0054] For accounts in the blockchain, a structure is usually used to maintain the account status. When a transaction in a block is executed, the status of the account related to the transaction in the blockchain will usually change.
[0055] Taking Ethereum as an example, the account structure usually includes fields such as Balance, Nonce, Code, and Storage. Among them:
[0056] The Balance field is used to maintain the current account balance of the account;
[0057] The Nonce field is used to maintain the number of transactions for the account. It is a counter used to ensure that each transaction can and can only be processed once, effectively preventing replay attacks.
[0058] The Code field is used to maintain the contract code of the account. In actual applications, the Code field usually only maintains the hash value of the contract code. Therefore, the Code field is often also called the Codehash field.
[0059] The Storage field is used to maintain the account's storage content (the default field value is empty). For contract accounts, a separate storage space is typically allocated to store the contract account's storage content; this separate storage space is often referred to as the contract account's account storage. The contract account's storage content is typically constructed as an MPT (Merkle Patricia Trie) tree data structure and stored in this separate storage space. The MPT tree constructed based on the contract account's storage content is often referred to as the Storage tree. The Storage field typically only maintains the root node of the Storage tree; therefore, the Storage field is often referred to as the StorageRoot field.
[0060] For external accounts, the values of the Code field and the Storage field shown above are both empty.
[0061] Most blockchain models use Merkle trees, or data structures based on Merkle trees, to store and maintain data. For example, Ethereum uses the MPT tree (a Merkle tree variant) as a data organization format to organize and manage important data such as account status and transaction information.
[0062] Ethereum has designed three MPT trees to store and maintain data on the blockchain: the MPT state tree, the MPT transaction tree, and the MPT receipt tree. In addition to these three MPT trees, there is also a Storage tree built based on the storage content of contract accounts.
[0063] The MPT state trie is an MPT tree organized from the state data of all accounts in the blockchain. The MPT transaction trie is an MPT tree organized from the transaction data in the blockchain. The MPT receipt trie is an MPT tree composed of the receipts generated for each transaction in the block after the transaction is executed. The hash values of the root nodes of the MPT state trie, MPT transaction trie, and MPT receipt trie shown above are ultimately added to the block header of the corresponding block.
[0064] The MPT transaction tree and MPT receipt tree are both associated with blocks, meaning each block has its own MPT transaction tree and MPT receipt tree. The organized MPT transaction tree, MPT receipt tree, and MPT status tree are ultimately stored in a key-value database (e.g., LevelDB) using a multi-level data storage structure.
[0065] In the public blockchain sector, miner nodes are often incentivized to produce blocks through gas and tokens. Miner nodes prioritize transactions with higher gas or token fees for inclusion in blocks to increase their own profits. Non-miner nodes, while contributing storage and consensus resources, do not receive corresponding benefits. In token-free blockchain models, such as consortium chains, and especially in open consortium chains, there is a pressing challenge in accounting for the blockchain resources provided by node devices and covering the corresponding node costs to maintain the smooth operation of the consortium chain network. Currently, there is a lack of resource management and billing methods for blockchain users based on resource usage or occupancy.
[0066] In view of the above issues, one or more embodiments of this specification provide various resource charging methods in blockchain systems. It is expected that the embodiments provided in this specification can be implemented in appropriate types of blockchain networks, such as public chains, consortium chains, and private chains.
[0067] The client described in one or more embodiments provided in this specification can be an independent device that is communicatively connected to any node device of the blockchain, or it can be a functional module set inside any node device, which is not limited here.
[0068] In the blockchain system charging model provided in this specification, the system resources carried by the node devices of the blockchain are value-anchored with the virtual resources published on the blockchain.
[0069] The virtual resources released on the blockchain may include blockchain assets that have a value-anchored relationship with real assets outside the chain held by users. This can be achieved by freezing real assets in the real world (including currency, real estate, stocks, loan contracts, bills, accounts receivable, etc.) and then issuing virtual resources on the chain that are anchored to the frozen real assets and can circulate on the chain.
[0070] During implementation, the user client can execute the asset freezing and exchange process with the node device of the blockchain network. The user client sends the freezing certificate of a certain amount of real assets to the node device corresponding to the institution with the virtual resource exchange authority; after receiving the freezing certificate, the node device can broadcast the above freezing certificate to the blockchain network, so that the node devices in the blockchain can add virtual resources corresponding to the value of the above frozen real assets to the user's blockchain account balance based on the freezing certificate.
[0071] The above-mentioned addition of virtual resources corresponding to the value of the frozen real assets to the user's blockchain account balance based on the freezing certificate can be further achieved through interaction between the user and the smart contract: the node device corresponding to the above-mentioned user client or the institution with virtual resource exchange authority sends a virtual resource exchange transaction to the blockchain network, and the virtual resource exchange transaction includes the above-mentioned asset freezing certificate; in response to the above-mentioned virtual resource exchange transaction, the node device of the blockchain calls the virtual resource exchange contract deployed on the blockchain, executes the resource exchange logic declared in the smart contract, and adds virtual resources corresponding to the value of the real assets frozen by the above-mentioned asset freezing certificate to the user's blockchain account balance.
[0072] Based on the above method, users can obtain virtual resources that can be anchored to the value of real assets in the blockchain network based on the real assets they hold. The above virtual resources can be expressed as the user's on-chain account balance.
[0073] In the blockchain network system, the system resources provided by blockchain node devices for blockchain services can be value-anchored with virtual resources published on the blockchain. For example, the storage resources provided by node devices for blockchain data can be value-anchored with virtual resources published on the blockchain, with each unit of blockchain data stored receiving a corresponding virtual resource. Another example is the CPU computing resources provided by node devices for the execution of any transaction on the blockchain, which can be value-anchored with virtual resources published on the blockchain. Each unit of CPU instruction set executed can receive a corresponding virtual resource. Another example is the network resources provided by node devices for the broadcast and consensus of any transaction on the blockchain, which can be value-anchored with virtual resources published on the blockchain. Based on the network traffic consumed during the broadcast or consensus process of the on-chain transaction, corresponding virtual resources can be obtained.
[0074] Blockchain developers can quantify these system resources, such as storage resources, computing resources, and network resources, and set a price for the virtual resource quantity corresponding to each unit of storage resources, computing resources, network resources, or other forms of system resources in the blockchain network. For consortium chains, whose membership is relatively fixed, the system resource pricing derived from this anchoring can remain fixed over the long term. For public blockchain systems, where nodes frequently enter and exit the blockchain network, blockchain developers can set unit prices for these various forms of system resources and then charge users in real time based on the blockchain scale at the time of use, or on a periodic basis over shorter periods. Those skilled in the art can also charge users for blockchain services provided by blockchain node devices based on any form of system resources that have a value-anchored relationship with virtual resources published on the blockchain, based on actual cost needs. This specification does not limit this.
[0075] like Figure 4 As shown, a method for deleting blockchain data provided in an exemplary embodiment of this specification includes:
[0076] In step 402, the node device of the blockchain receives a data deletion transaction sent by the blockchain client, where the data deletion transaction includes identification information of the target data to be deleted and the account identification of the user.
[0077] The target data to be deleted is the target data stored in the account storage space of the target smart contract maintained by the user. The account storage space may include all storage spaces corresponding to the target smart contract account, such as the target smart contract's storage tree. The data in the smart contract's account storage space may be stored in a key-value format. The identification information of the target data may include the target data's key value, such as the target data's hash value. Based on the target data's hash value, the target data can be uniquely retrieved from the blockchain database.
[0078] Optionally, the data deletion transaction may also include the account address of the target smart contract where the target data to be deleted resides. In this case, the identification information of the target data may also include other identifiers, such as the serial number of the data stored in the target smart contract, etc.
[0079] The user account corresponding to the above-mentioned user identifier is a blockchain user account from which virtual resources anchored to the value of the above-mentioned blockchain system resources are deducted based on the blockchain system resources consumed in processing the above-mentioned data deletion transaction; the user account corresponding to the above-mentioned user identifier may include the user account of the above-mentioned data deletion transaction issuer, and may also include other user accounts designated by the above-mentioned data deletion transaction issuer (such as the above-mentioned target smart contract account); the account type of the above-mentioned user account may include an external account or a smart contract account, which is not limited in this embodiment.
[0080] Step 404: Calculate a first quantity of system resources of the node device consumed in processing the data deletion transaction, and determine a second quantity of the virtual resources anchored to the value of the first quantity of system resources.
[0081] The process of a blockchain node device processing the data deletion transaction may include one or more of the following: receiving and forwarding (broadcasting) the data deletion transaction, performing consensus verification on the data deletion transaction, executing the data deletion transaction based on the identification information of the target data, storing the execution result of the data deletion transaction in the blockchain's state database, and including the data deletion transaction in a newly created block. Because the system resources carried by the node device are value-anchored with the virtual resources published on the blockchain, the blockchain node device provides its own system resources throughout the entire process of processing the data deletion transaction. Therefore, the blockchain node device can calculate and determine a second amount of virtual resources whose value is anchored to the first amount of system resources based on the first amount of system resources consumed or provided by the node device during the data deletion transaction processing.
[0082] Specifically, the system resources of the node device consumed in processing the data deletion transaction may include one or more combinations of the following:
[0083] The computing resources of the node device consumed in processing the data deletion transaction may include the number of instructions in a CPU instruction set consumed by the node device in executing the data deletion transaction based on the identification information of the target data. For example, the blockchain system may price the computing resources provided by the node device as m (virtual resource unit) / instruction. The node device may first calculate the number N of instructions in the CPU instruction set consumed in executing the data deletion transaction, and then calculate the amount of virtual resources corresponding to the N instructions, which is anchored to the value of the node device's computing resources consumed in processing the data deletion transaction: m*N (virtual resource units).
[0084] The network resources of the node device consumed by processing the data deletion transaction may include the blockchain network traffic consumed during broadcasting, consensus, and other processes to transmit the data deletion transaction. This network resource is positively correlated with the number of blockchain nodes. For example, the blockchain system may price the network resources provided by the node device as m (virtual resource units) / megabyte of traffic. The node device may first calculate the total network traffic N megabytes consumed by executing the data deletion transaction, and then calculate the amount of virtual resources corresponding to the N megabytes of traffic, which is anchored to the value of the node device's network resources consumed by processing the data deletion transaction: m*N (virtual resource units).
[0085] The storage resources of the node device consumed by processing the data deletion transaction may include storage resources consumed by the node device for executing the data deletion transaction.
[0086] If the blockchain executes the data deletion transaction by directly deleting the target data from the account storage space of the target smart contract without making any other backup storage, then when calculating the system resources of the node device consumed by processing the data deletion transaction, the storage resources of the node device consumed by processing the data deletion transaction may be ignored; if the blockchain executes the data deletion transaction by moving the target data from the account storage space of the target smart contract to the backup database of the blockchain for storage, then when calculating the system resources of the node device consumed by processing the data deletion transaction, the virtual resources anchored to the value of the storage resources consumed by the target data in the backup database maintained by the blockchain may be considered.
[0087] The blockchain system can price the storage resources in the above-mentioned backup database provided by the node device: m (virtual resource unit) / Gb. When the capacity of the target data is NGb, the node device can calculate the second quantity of virtual resources anchored by the value of the storage resources of the node device consumed in processing the data deletion transaction, including: m*N (virtual resource unit).
[0088] In order to customize the specific duration of backup storage services for target data based on user needs, the node device can be customized. In another illustrated embodiment, the data deletion transaction also includes: the effective duration of the target data stored in the backup database requested by the user; the effective duration of the storage resources of the backup database carried by the node device is also value-anchored with the virtual resources published on the blockchain; accordingly, the above calculation of the number of virtual resources anchored by the value of the account storage resources includes: calculating the storage resources of the blockchain backup data consumed by the target data and the number of virtual resources anchored by the effective duration value.
[0089] For example, the blockchain system can price the storage resources and storage validity period in the above-mentioned backup database provided by the node device: m (virtual resource unit) / Gb / day. The user requests a one-year validity period for the target data in the data deletion transaction. When the capacity of the target data is NGb, the node device can calculate the second quantity of virtual resources anchored to the value of the storage resources of the node device consumed in processing the smart contract creation transaction, including: m*N*365 (virtual resource unit).
[0090] It is worth noting that the field included in the above-mentioned data deletion transaction, which corresponds to the effective period for which the user requests to store the target data in the backup database, can be left empty, so that the node device can perform calculation of the second quantity of virtual resources based on the default effective period of the blockchain system.
[0091] The pricing of system resources provided by the above-mentioned blockchain system to node devices may be related to the number of nodes in the blockchain system. It can be expected that the more node devices a blockchain has, the more total system resources are actually consumed in executing the data deletion transaction. Therefore, the blockchain system may adjust the pricing per unit of system resources charged to users based on the number of node devices.
[0092] This embodiment does not specifically limit the form of the above-mentioned system resources. In addition to the above-mentioned storage resources, storage validity period, computing resources or network resources, blockchain system developers can also anchor the value of other forms of system resources of blockchain node devices consumed in the process of deleting target data stored in smart contracts with the virtual resources published on the blockchain, thereby transferring a corresponding amount of virtual resources from the above-mentioned user accounts based on the consumption of this form of system resources.
[0093] In one illustrated embodiment, the underlying protocol of the above-mentioned blockchain may be deployed with a computing model to calculate the amount of virtual resources anchored to the value of the system resources of the node device consumed in processing the data deletion transaction. When the node device receives the data deletion transaction sent by the blockchain client, it may obtain the second amount of virtual resources calculated by the above-mentioned computing model deployed by the underlying protocol of the blockchain, which corresponds to the system resources required to process the data deletion transaction.
[0094] Alternatively, a smart contract for calculating virtual resource consumption for data deletion transactions (hereinafter referred to as a resource calculation contract) may be deployed on the blockchain. The execution logic corresponding to the contract code of the resource calculation contract includes resource calculation logic for calculating the amount of virtual resources anchored by the value of the system resources of the node device consumed in processing the data deletion transaction.
[0095] Accordingly, the above-mentioned calculation and processing of the first amount of system resources of the node device consumed by the data deletion transaction, and determining the second amount of the virtual resources anchored to the value of the first amount of system resources, includes:
[0096] The resource calculation contract is called, the resource calculation logic is executed, a first quantity of system resources of the node device consumed in executing the data deletion transaction is calculated, and a second quantity of the virtual resources anchored to the value of the first quantity of system resources is determined.
[0097] It is worth noting that when a node device calls the resource computing smart contract, it can construct a local transaction (or local call) in response to the acquired smart contract creation transaction, and locally call the resource computing smart contract deployed on the blockchain to determine the first quantity of the virtual resource anchored by the system resource value of the node device consumed by executing the smart contract creation transaction. At this time, the node device can obtain the call execution result of the resource computing contract locally without having to consensus the call execution result of the resource computing contract on the blockchain.
[0098] Step 406: deduct the second amount of virtual resources from the virtual resources held by the user account corresponding to the account identifier.
[0099] After the deduction is completed, the second amount of virtual resources can be allocated to the blockchain account corresponding to the node device of the blockchain for holding. The second amount of virtual resources deducted above can be directly allocated by the node device to the blockchain account corresponding to each node device in the blockchain that processes the smart contract creation transaction, thereby directly completing the allocation of virtual resources.
[0100] Alternatively, the node device may first allocate the deducted second amount of virtual resources to a set blockchain account on the blockchain, such as the blockchain account corresponding to each accounting node of the blockchain, or a preset blockchain account with the authority to collect the above-mentioned virtual resources, thereby collecting the second amount of virtual resources on behalf of each node device in the blockchain based on the system resources of the blockchain consumed in processing the smart contract to create the transaction.
[0101] Afterwards, the above-mentioned blockchain may also set corresponding virtual resource allocation rules, and the above-mentioned blockchain account may allocate the virtual resources obtained based on the creation of the smart contract to other blockchain user accounts based on a preset period (including real-time or periodic); or, in response to the redemption request of other blockchain users, the virtual resources to be allocated to other blockchain users may be exchanged for physical assets outside the chain, and the virtual resources on the chain that have been exchanged may be cancelled.
[0102] This specification does not specifically limit the rules for allocating the second amount of virtual resources to the blockchain accounts corresponding to the various node devices in the blockchain. For example, the node devices may evenly distribute the second amount of virtual resources deducted above to the blockchain accounts corresponding to the various node devices in the blockchain for respective holding.
[0103] Alternatively, based on the storage medium performance attributes of the account storage resources allocated by each node device of the blockchain to the smart contract, the second amount of virtual resources deducted from the virtual resources held by the user account corresponding to the account identifier are allocated to the blockchain accounts corresponding to each node device of the blockchain for respective holding. For example, due to the different storage medium configurations of each node device, the blockchain system may rate the storage medium of each node device based on the obtained storage medium performance attributes of each node device (such as hard disk performance attributes such as HDD, SSD, or NVM), thereby allocating a higher proportion of virtual resources to node devices that provide high-grade storage media, and a lower proportion of virtual resources to node devices that provide low-grade storage media.
[0104] Step 408: Execute the data deletion transaction to delete the target data corresponding to the identification information from the target smart contract account managed by the user.
[0105] The user corresponding to the blockchain client that sends the data deletion transaction may have the authority to maintain and manage the account storage space of the target smart contract. For example, it may include the user who created the target smart contract, or a user with data deletion permission declared in the target smart contract. The node device of the blockchain executes the data deletion transaction based on the identification information of the above-mentioned target data within the virtual machine, and stores the execution result of the above-mentioned data deletion transaction in the blockchain. For example, the node device may delete the target data from the account storage space of the target smart contract in the blockchain state database and include a transaction receipt containing the execution result of the above-mentioned data deletion transaction in the MPT receipt tree of the above-mentioned blockchain.
[0106] In an illustrated embodiment, the above-mentioned deletion of the target data corresponding to the identification information from the target smart contract account managed by the user may include permanently deleting the target data from the account storage space of the target smart contract. However, in the subsequent blockchain block formation process, this operation may cause certain calling transactions of the target smart contract to be unable to be executed; therefore, in this embodiment, if certain calling transactions of the target smart contract are subsequently unable to be executed, the user may initiate a data recovery request, for example, based on the replay execution (or block rollback) of the transactions included in the existing blocks of the blockchain, re-execute the transaction that generated the above-mentioned target data, thereby storing the above-mentioned target data in the account space of the target smart contract.
[0107] Hot data in the blockchain can include data required for smart contract calls (also called real-time data), such as data included in smart contract accounts and data within the most recent blocks required for smart contract calls. Hot data in the blockchain is usually stored by node devices in high-performance storage hardware, such as SSD hard drives, so that node devices can execute smart contract call transactions efficiently and quickly; cold data in the blockchain includes non-real-time data set by the blockchain system that cannot be directly called by smart contracts, such as transactions in historical blocks, historical status data corresponding to historical blocks, etc.; in order to save storage costs, the above cold data can be stored in storage hardware with lower performance configuration.
[0108] Therefore, in another illustrated embodiment, the above-mentioned deletion of the target data corresponding to the identification information from the target smart contract account managed by the user may include removing the target data from the account storage space of the target smart contract and storing the target data in a backup database maintained by the blockchain. For example, the account storage space can store "hot data" required for smart contract calls. In order to save the storage space of the target smart contract managed by the user, based on the data deletion transaction sent by the user, the target data as the above-mentioned hot data can be moved by the node device to the database of "cold data" collected on the blockchain. If the above-mentioned data deletion transaction subsequently causes certain call transactions to the target smart contract to be unable to be executed, the user can initiate a data recovery request, for example, to migrate the target data included in the cold data database back to the account storage space of the target smart contract to further execute the call transaction to the target smart contract.
[0109] Based on the blockchain data deletion method described in steps 402 to 408, a data deletion type transaction can be configured in the blockchain system (for example, the system developer expands the transaction types executable on the blockchain in the underlying protocol, and expands the development of data deletion type transactions in addition to transfer transactions, smart contract creation transactions, and smart contract call transactions). The user who maintains and manages the target smart contract initiates the deletion of the target data in the account storage space of the target smart contract, so that the user can optimize the data storage of the account storage space of the target smart contract; since the data storage resources allocated by the blockchain node device to the smart contract account are generally high-quality storage resources, such as SSD hot storage resources, so as to quickly and efficiently call and execute the smart contract, the blockchain data deletion method described in this embodiment reduces the occupation of high-quality storage resources of each node device, and further optimizes the storage configuration of the node devices in the blockchain.
[0110] In another illustrated embodiment, the execution logic corresponding to the contract code of the target smart contract includes data deletion logic; the data deletion transaction is a call transaction of the smart contract. In this case, executing the data deletion transaction to delete the target data corresponding to the identification information from the target smart contract account managed by the user includes:
[0111] The target smart contract is called, the data deletion logic is executed, and the target data corresponding to the identification information is deleted from the target smart contract account managed by the user.
[0112] By calling the data deletion logic of the target smart contract, the target data stored in the target smart contract is deleted, avoiding the need to expand the transaction type of the blockchain system protocol layer and reducing the difficulty of blockchain system development.
[0113] To facilitate users in managing the storage resources allocated by the node device to the target smart contract account, the blockchain can maintain the remaining storage capacity of the storage resources allocated by the node device to the target smart contract account.
[0114] For example, a node device may maintain the remaining storage capacity of the account storage resources allocated by the node device to the target smart contract in the target smart contract account. In a specific implementation, the content fields supported by the target smart contract account (in addition to Balance, Nonce, Code, and Storage) may be expanded to add a parameter that identifies the remaining storage capacity of the account storage resources allocated by the node device of the blockchain to the target smart contract.
[0115] Alternatively, the above-mentioned blockchain can also maintain and manage the remaining storage capacity of the account storage resources corresponding to the target smart contract account in the underlying protocol of the system. When each node device checks the properties of the above-mentioned target smart contract account, it can obtain the remaining storage capacity status of the account storage resources corresponding to the above-mentioned target smart contract account.
[0116] For example, the above-mentioned blockchain can also deploy a special management contract to manage and maintain the remaining storage capacity of the account storage resources allocated by the node device to the target smart contract in the management contract account, etc.
[0117] Therefore, after executing the data deletion transaction described in one or more of the above embodiments, the method may also include updating the remaining storage capacity of the account storage resources allocated by the node device maintained by the blockchain to the target smart contract after the target data is deleted: for example, based on the deletion of the target data, the value of the remaining storage capacity of the account storage resources maintained in the target smart contract account is increased. During the creation or existence of the target smart contract, based on the deduction of virtual resources from the user account, the node device may allocate storage resources of the set storage capacity requested by the user to the target smart contract. Through the data deletion method described in one or more of the above embodiments, the user can optimize the management of the target smart contract's account storage and promptly clean up erroneous or redundant data.
[0118] In one or more of the above embodiments, it is not limited to Figure 4 The order of steps 404, 406, and 408. In one illustrated embodiment, the node device may first execute steps 404 and 406, calculate and process the first amount of system resources of the node device consumed by the data deletion transaction based on the data deletion transaction, and determine the second amount of virtual resources anchored to the value of the first amount of system resources; after successfully deducting the second amount of virtual resources from the virtual resources held by the user account corresponding to the account identifier, the node device then executes step 408 to execute the data deletion transaction and delete the target data corresponding to the identification information from the target smart contract account managed by the user.
[0119] Afterwards, the node device can return a prompt of the completion of the execution of the above-mentioned data deletion transaction to the above-mentioned blockchain client based on the execution result of the above-mentioned data deletion transaction (the transaction receipt corresponding to the above-mentioned data deletion transaction included in the MPT receipt tree of the blockchain).
[0120] In step 406, if the number of virtual resources held by the user account corresponding to the account identifier is less than the second number, the node device cannot complete the deduction of the second number of virtual resources. At this time, the node device may not execute the data deletion transaction and return a prompt to the blockchain client that the data deletion transaction execution failed.
[0121] It is worth noting that since the system resources consumed by the above-mentioned node devices when executing the data deletion transaction include various forms such as computing resources, network resources, and storage resources, some forms of resources can be calculated based on the code of the smart contract before the data deletion transaction is executed, while some forms of resources can only be accurately known after the data deletion transaction is executed. Therefore, when the second amount of virtual resources deducted in step 406 of this embodiment is based on the estimation of the system resources that may be consumed to execute the data deletion transaction; the above-mentioned blockchain can also set up a subsequent system resource consumption verification link to verify whether the system resources consumed after the target data is deleted are obviously inconsistent with the estimated system resources, so as to perform corresponding virtual resource replenishment or refund operations, and this manual does not limit this.
[0122] In another illustrated embodiment, the node device may first execute step 408 to execute the data deletion transaction, and temporarily store the account status of the target smart contract after deleting the target data, and the transaction receipt generated based on the execution result of the above data deletion transaction in the memory; then execute steps 404 and 406 to calculate the second quantity of the virtual resources anchored by the system resource value of the node device actually consumed by the node device in processing the data deletion transaction based on the above data deletion transaction; thereby deducting the second quantity of virtual resources from the virtual resources held by the user account corresponding to the account identifier.
[0123] If the first amount of virtual resources is successfully deducted from the virtual resources held by the user account, the node device may update the account status of the target smart contract in the blockchain and save the transaction receipt generated after executing the data deletion transaction in the MPT receipt tree of the blockchain. The transaction receipt may include the execution results such as the target data being deleted from the account storage space of the target smart contract and the target data being moved to the backup database of the blockchain (if any). At this time, the node device may return a prompt to the blockchain client indicating that the execution of the data deletion transaction is completed;
[0124] If the amount of virtual resources held by the user account corresponding to the account identifier is less than the second amount, the node device cannot complete the deduction of the second amount of virtual resources. At this time, the transaction receipt generated after executing the data deletion transaction and the account status of the target smart contract after deleting the target data can be deleted from the memory, and a prompt indicating that the above-mentioned data recovery transaction execution failed can be returned to the blockchain client.
[0125] Alternatively, when the amount of virtual resources held by the user account corresponding to the account identifier is less than the second amount, and the node device is unable to complete the deduction of the second amount of virtual resources, the node device may temporarily store the above-mentioned transaction receipt and the account status of the target smart contract after deleting the target data, and send a balance replenishment reminder to the blockchain client. After the user completes the balance replenishment of the user account corresponding to the account identifier, the above-mentioned second amount of virtual resource deduction operation is executed again. After the deduction is successful, the account status of the target smart contract is updated in the blockchain, the above-mentioned transaction receipt is saved in the MPT receipt tree of the blockchain, and a prompt indicating that the data deletion transaction is completed is returned to the blockchain client.
[0126] In another embodiment, the broadcast, consensus verification, and execution process of the data deletion transaction in the blockchain may specifically include:
[0127] After receiving the data deletion transaction sent by the blockchain client, the node device may broadcast the data deletion transaction in the blockchain network;
[0128] After receiving the above data deletion transaction, the consensus node in the blockchain can perform consensus verification on the data deletion transaction;
[0129] If the consensus verification of the data deletion transaction is passed, the node device of the blockchain can add the above data deletion transaction to the ledger database of the blockchain and execute the data deletion transaction, as described in steps 404 to 408, calculate and process the second quantity of virtual resources anchored by the value of the data deletion transaction, deduct the second quantity of virtual resources from the virtual resources held by the user account, and execute the data deletion transaction based on the call parameters, and store the execution result of the data deletion transaction in the blockchain.
[0130] In this embodiment, in order to reduce the failure of the data deletion transaction due to the virtual resource balance in the above-mentioned user account being insufficient to pay the second amount of virtual resources required to be deducted for processing the data deletion transaction, thereby wasting system resources of the node device, the consensus verification process performed by the consensus node of the above-mentioned blockchain may include: verifying whether the amount of virtual resources held by the user account included in the data deletion transaction is not less than a preset threshold.
[0131] The above-mentioned preset threshold can be a fixed virtual resource threshold set by the blockchain developer for data deletion type transactions. For example, it can be set based on the minimum system resource consumption for executing data deletion type transactions, or the number of virtual resources anchored by the average system resource consumption; under this condition, in order for the target data to be successfully deleted, the user account must hold a number of virtual resources that meets the above-mentioned preset threshold, so that when the number of virtual resources in the user account is less than the above-mentioned preset threshold, a prompt indicating that the consensus verification has failed is directly returned, thereby avoiding the node device from further consuming system resources due to processing the data deletion transaction after the consensus verification stage.
[0132] In some embodiments, although the process of the above-mentioned node device processing the data deletion transaction has passed the consensus verification that the user account balance is not less than the above-mentioned fixed preset threshold, it is still possible that the second number of virtual resources determined by the above-mentioned calculation is greater than the balance of the user account due to the excessive system resources consumed by the above-mentioned data deletion transaction (for example, the target data consumes too many storage resources in the backup database), resulting in the failure of the transaction execution.
[0133] Optionally, the process of calculating the first amount of system resources consumed by the node device for processing the data deletion transaction and determining the second amount of virtual resources anchored to the value of the first amount of system resources described in step 404 may be included in the consensus verification process of the blockchain. For example, when the underlying protocol of the blockchain deploys a calculation model for calculating the amount of virtual resources anchored to the value of the system resources consumed by the node device for processing the data deletion transaction, when the consensus node obtains the data deletion transaction, it can obtain the second amount of virtual resources anchored to the system resources consumed by the node device for processing the data deletion transaction, as calculated and determined by the underlying protocol of the blockchain. In this case, the preset threshold may be the second amount of virtual resources determined by the calculation process, so that the consensus node of the blockchain can directly perform consensus verification on whether the payment is sufficient based on the second amount of virtual resources required to process the data deletion transaction during the consensus verification, thereby providing more accurate consensus verification. Subsequently, whether the virtual resource deduction process described in step 406 or the target data deletion process described in step 408 is performed first, the success rate of data deletion transactions that pass consensus verification can be improved.
[0134] Based on the blockchain data deletion method described in one or more of the above-mentioned embodiments, the system resources carried by the blockchain's node devices can be value-anchored with the virtual resources published on the blockchain. Thus, based on the first amount of system resources consumed by the node device to process the data deletion transaction, a second amount of virtual resources can be anchored, thereby deducting the second amount of virtual resources from the virtual resources held by the user account. Because users arbitrarily deleting hot data resources contained in a smart contract in a free-of-charge model can easily cause system failures in subsequent calls and executions of the smart contract, this method not only improves the probability of successful transaction execution on the blockchain based on the prerequisite that the deletion operation requires the transfer of the second amount of virtual resources, but also optimizes blockchain resource allocation by deleting redundant or erroneous hot data resources.
[0135] Corresponding to the above process implementation, the embodiments of this specification also provide blockchain data deletion devices 50 and 60. Devices 50 and 60 can be implemented by software, hardware, or a combination of software and hardware. Taking software implementation as an example, as a device in the logical sense, it is formed by the CPU (Central Process Unit) of the device reading the corresponding computer program instructions into the memory and running them. From the hardware level, in addition to Figure 7 In addition to the CPU, memory and storage shown, the device where the above-mentioned device is located generally also includes other hardware such as a chip for transmitting and receiving wireless signals, and / or other hardware such as a board for realizing network communication functions.
[0136] like Figure 5 As shown, this specification also provides a blockchain data deletion device, which is applied to a node device of a blockchain, wherein the system resources carried by the node device are value-anchored with the virtual resources published on the blockchain, including:
[0137] A receiving unit 502 receives a data deletion transaction sent by a blockchain client, wherein the data deletion transaction includes identification information of target data to be deleted and an account identification of a user;
[0138] The calculation unit 504 calculates a first amount of system resources of the node device consumed in processing the data deletion transaction, and determines a second amount of the virtual resources anchored to a value of the first amount of system resources;
[0139] a deduction unit 506, deducting the second amount of virtual resources from the virtual resources held by the user account corresponding to the account identifier;
[0140] The execution unit 508 executes the data deletion transaction after the deduction, and deletes the target data corresponding to the identification information from the target smart contract account managed by the user.
[0141] In another illustrated embodiment, the data deletion transaction is a smart contract call transaction, and the execution logic corresponding to the contract code of the target smart contract includes data deletion logic;
[0142] The execution unit 508 is further configured to:
[0143] The target smart contract is called, the data deletion logic is executed, and the target data corresponding to the identification information is deleted from the target smart contract account managed by the user.
[0144] In another illustrated embodiment, the execution unit 508 is further configured to:
[0145] The target data is removed from the account storage space of the target smart contract storing the target data, and the target data is stored in a backup database maintained by the blockchain.
[0146] In another illustrated embodiment, the device 50 further includes a returning unit 510, which returns a prompt indicating that the data deletion transaction has failed to be executed to the blockchain client if the number of virtual resources held by the user account is less than the second number.
[0147] In another illustrated embodiment, the system resources of the node device consumed in processing the data deletion transaction include one or more combinations of the following:
[0148] Processing the storage resources of the node device consumed by the smart contract creation transaction, wherein the storage resources include the storage resources consumed by the target data in the backup database maintained by the blockchain;
[0149] Processing the computing resources of the node devices consumed by the smart contract creation transaction;
[0150] The network resources of the node device consumed in processing the smart contract creation transaction.
[0151] In yet another illustrated embodiment, the blockchain deploys a resource computing contract, and the execution logic corresponding to the contract code of the resource computing contract includes resource computing logic;
[0152] The calculation unit 504 is further configured to:
[0153] The resource calculation contract is called, the resource calculation logic is executed, a first quantity of the system resources of the node device consumed to process the data deletion transaction is calculated, and a second quantity of the virtual resources anchored to the value of the second quantity of system resources is determined.
[0154] In yet another illustrated embodiment, the apparatus 50 further comprises:
[0155] The allocation unit 512 allocates the first amount of virtual resources deducted from the virtual resources held by the user account corresponding to the account identifier to the blockchain account corresponding to the node device of the blockchain for holding, and further executes the smart contract creation transaction after the allocation is completed.
[0156] In yet another illustrated embodiment, the allocating unit 512 is further configured to:
[0157] The first amount of virtual resources deducted from the virtual resources held by the user account corresponding to the account identifier are evenly distributed to the blockchain accounts corresponding to the node devices of the blockchain for respective holding;
[0158] Alternatively, based on the storage medium performance attributes of the account storage resources allocated by each node device of the blockchain to the smart contract, the first amount of virtual resources deducted from the virtual resources held by the user account corresponding to the account identifier will be allocated to the blockchain accounts corresponding to each node device of the blockchain for separate holding.
[0159] In yet another illustrated embodiment, the blockchain maintains the remaining storage capacity of the account storage resources allocated by the node device to the target smart contract;
[0160] The device 50 also includes an updating unit 514, which updates the remaining storage capacity of the account storage resources allocated by the node device maintained by the blockchain to the target smart contract.
[0161] In another illustrated embodiment, the apparatus 50 further includes a broadcast unit 516 that, before executing the data deletion transaction, broadcasts the data deletion transaction to a blockchain network to perform consensus verification on the data deletion transaction; wherein the consensus verification includes: verifying whether the amount of virtual resources held by the user account is not less than a preset threshold;
[0162] If the consensus verification of the data deletion transaction passes, the execution unit executes the data deletion transaction.
[0163] The user's account identification processing, the processing of the node device consumed by the smart contract creation transaction, and the implementation process of the functions and effects of each unit in the above-mentioned device 50 of the node device consumed by the smart contract creation transaction are specifically detailed in the above-mentioned embodiment, and the implementation process of the corresponding steps in the method for deleting blockchain data executed by the node device. For relevant matters, please refer to the partial description of the method embodiment, which will not be repeated here.
[0164] like Figure 6 As shown, this specification also provides a blockchain data deletion device 60, which is applied to a node device of a blockchain, wherein the system resources carried by the node device are value-anchored with the virtual resources published on the blockchain, including:
[0165] A receiving unit 602 receives a data deletion transaction sent by a blockchain client, wherein the data deletion transaction includes identification information of target data to be deleted and an account identification of a user;
[0166] An execution unit 604 executes the data deletion transaction to delete the target data corresponding to the identification information from the target smart contract account managed by the user;
[0167] A calculation unit 606 calculates a first amount of system resources of the node device consumed in processing the data deletion transaction after executing the data deletion transaction, and determines a second amount of the virtual resource anchored to the value of the first amount of system resources;
[0168] The deduction unit 608 deducts the second amount of virtual resources from the virtual resources held by the user account corresponding to the account identifier.
[0169] In another illustrated embodiment, the data deletion transaction is a smart contract call transaction, and the execution logic corresponding to the contract code of the target smart contract includes data deletion logic;
[0170] The execution unit 604 is further configured to:
[0171] The target smart contract is called, the data deletion logic is executed, and the target data corresponding to the identification information is deleted from the target smart contract account managed by the user.
[0172] In yet another illustrated embodiment, the execution unit 604 is further configured to:
[0173] The target data is removed from the account storage space of the target smart contract storing the target data, and the target data is stored in a backup database maintained by the blockchain.
[0174] In yet another illustrated embodiment, a return unit 610 is further included.
[0175] If the second amount of virtual resources is successfully deducted from the virtual resources held by the user account corresponding to the account identifier, a transaction receipt corresponding to the generated data deletion transaction is stored in the blockchain, and a prompt indicating that the target data has been successfully deleted is returned to the blockchain client;
[0176] If the number of virtual resources held by the user account is less than the second number, the transaction receipt corresponding to the generated data deletion transaction is deleted, and a prompt indicating that the target data deletion failed is returned to the blockchain client.
[0177] In another illustrated embodiment, the system resources of the node device consumed in processing the data deletion transaction include one or more combinations of the following:
[0178] Processing the storage resources of the node device consumed by the smart contract creation transaction, wherein the storage resources include the storage resources consumed by the target data in the backup database maintained by the blockchain;
[0179] Processing the computing resources of the node devices consumed by the smart contract creation transaction;
[0180] The network resources of the node device consumed in processing the smart contract creation transaction.
[0181] In yet another illustrated embodiment, the blockchain deploys a resource computing contract, and the execution logic corresponding to the contract code of the resource computing contract includes resource computing logic;
[0182] The calculation unit 606 is further configured to:
[0183] The resource calculation contract is called, the resource calculation logic is executed, a first quantity of the system resources of the node device consumed to process the data deletion transaction is calculated, and a second quantity of the virtual resources anchored to the value of the second quantity of system resources is determined.
[0184] In yet another illustrated embodiment, the apparatus 50 further comprises:
[0185] The allocation unit 612 allocates the first amount of virtual resources deducted from the virtual resources held by the user account corresponding to the account identifier to the blockchain account corresponding to the node device of the blockchain for holding, and further executes the smart contract creation transaction after the allocation is completed.
[0186] In yet another illustrated embodiment, the allocating unit 612 is further configured to:
[0187] The first amount of virtual resources deducted from the virtual resources held by the user account corresponding to the account identifier are evenly distributed to the blockchain accounts corresponding to the node devices of the blockchain for respective holding;
[0188] Alternatively, based on the storage medium performance attributes of the account storage resources allocated by each node device of the blockchain to the smart contract, the first amount of virtual resources deducted from the virtual resources held by the user account corresponding to the account identifier will be allocated to the blockchain accounts corresponding to each node device of the blockchain for separate holding.
[0189] In yet another illustrated embodiment, the blockchain maintains the remaining storage capacity of the account storage resources allocated by the node device to the target smart contract;
[0190] The device 60 further includes an updating unit 614 that updates the remaining storage capacity maintained by the blockchain after the target data is deleted.
[0191] In another illustrated embodiment, the apparatus 60 further includes a broadcast unit 616 that, before executing the data deletion transaction, broadcasts the data deletion transaction to a blockchain network to perform consensus verification on the data deletion transaction; wherein the consensus verification includes: verifying whether the amount of virtual resources held by the user account is not less than a preset threshold;
[0192] If the consensus verification of the data deletion transaction passes, the execution unit 604 executes the smart contract creation transaction.
[0193] The implementation process of the functions and effects of each unit in the above-mentioned device 60 for user account identification is specifically detailed in the implementation process of the corresponding steps in the method for deleting blockchain data executed by the node device in the above-mentioned embodiment. For relevant matters, please refer to the partial description of the method embodiment, which will not be repeated here.
[0194] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical modules, that is, they may be located in one place or distributed across multiple network modules. Some or all of the units or modules may be selected according to actual needs to achieve the purpose of the scheme of this specification. Those of ordinary skill in the art can understand and implement the present invention without inventive effort.
[0195] The devices, units, and modules described in the above embodiments may be implemented by computer chips or entities, or by products having certain functions. A typical implementation device is a computer, which may be in the form of a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email transceiver, game console, tablet computer, wearable device, or any combination of these devices.
[0196] Corresponding to the above method embodiment, the embodiment of this specification also provides a computer device, such as Figure 7 As shown, the computer device includes a memory and a processor. The memory stores a computer program executable by the processor. When the processor executes the stored computer program, it executes the steps of the blockchain data deletion method performed by the node device described in this specification for executing the data deletion transaction after deducting the second amount of virtual resources. A detailed description of the steps of the blockchain data deletion method performed by the node device is provided above and will not be repeated here.
[0197] Corresponding to the above method embodiment, the embodiment of this specification also provides a computer device, such as Figure 7 As shown, the computer device includes a memory and a processor. The memory stores a computer program executable by the processor. When the processor executes the stored computer program, it executes the steps of the blockchain data deletion method performed by the node device described in this specification, which involves deducting the second amount of virtual resources after executing the data deletion transaction. A detailed description of the steps of the blockchain data deletion method performed by the node device is provided above and will not be repeated here.
[0198] The above description is only a preferred embodiment of this specification and is not intended to limit this specification. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of this specification should be included in the scope of protection of this specification.
[0199] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0200] Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
[0201] Computer-readable media include permanent and non-permanent, removable and non-removable media that can store information using any method or technology. The information can be computer-readable instructions, data structures, program modules or other data.
[0202] Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory media such as modulated data signals and carrier waves.
[0203] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed, or includes elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity, or apparatus that includes the element.
[0204] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems, or computer program products. Thus, the embodiments of this specification may take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware. Furthermore, the embodiments of this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
Claims
1. A method for deleting blockchain data, applied to a node device of a blockchain, wherein the system resources on the node device are value-anchored with virtual resources published on the blockchain; the method comprising: Receiving a data deletion transaction corresponding to target data stored in a target smart contract, sent by a blockchain client, wherein the data deletion transaction includes an account identifier of a user; Calculating a first amount of the system resource consumed in processing the data deletion transaction, and determining a second amount of the virtual resource anchored to a value of the first amount of the system resource; deducting the second amount of virtual resources from the virtual resources held by the user account corresponding to the account identifier, and allocating the second amount of virtual resources deducted from the virtual resources held by the user account corresponding to the account identifier to the blockchain account corresponding to the node device of the blockchain for holding; After deducting the second amount of virtual resources from the virtual resources held by the user account, executing the data deletion transaction to delete the target data from the target smart contract.
2. The method according to claim 1, wherein the data deletion transaction is a smart contract call transaction, and the execution logic corresponding to the contract code of the target smart contract includes data deletion logic; The executing the data deletion transaction to delete the target data from the target smart contract includes: The target smart contract is called, the data deletion logic is executed, and the target data is deleted from the target smart contract.
3. The method according to claim 1, if the number of virtual resources held by the user account is less than the second number, a prompt indicating that the data deletion transaction execution failed is returned to the blockchain client.
4. The method according to claim 1, wherein processing the system resources consumed by the data deletion transaction comprises one or more combinations of the following: Processing the storage resources on the node device consumed by the smart contract creation transaction, wherein the storage resources include the storage resources consumed by the target data in the backup database maintained by the blockchain; Processing the computing resources on the node device consumed by the smart contract creation transaction; The network resources on the node device consumed in processing the smart contract creation transaction.
5. The method according to claim 1, allocating the second amount of virtual resources deducted from the virtual resources held by the user account corresponding to the account identifier to the blockchain account corresponding to the node device of the blockchain for holding, comprising: The second amount of virtual resources deducted from the virtual resources held by the user account corresponding to the account identifier are evenly distributed to the blockchain accounts corresponding to the node devices of the blockchain for respective holding; Alternatively, based on the storage medium performance attributes of the account storage resources allocated by each node device of the blockchain to the smart contract, the second amount of virtual resources deducted from the virtual resources held by the user account corresponding to the account identifier will be allocated to the blockchain accounts corresponding to each node device of the blockchain for holding respectively.
6. The method according to claim 1, wherein the blockchain maintains the remaining storage capacity of the account storage resources allocated by the node device to the target smart contract; After executing the data deletion transaction, the method further includes: Update the remaining storage capacity of the account storage resources allocated by the node device maintained by the blockchain to the target smart contract.
7. The method according to claim 1, before executing the data deletion transaction, the method further comprises: Broadcasting the data deletion transaction to the blockchain network to perform consensus verification on the data deletion transaction; wherein the consensus verification includes: verifying whether the number of virtual resources held by the user account is not less than a preset threshold; If the consensus verification of the data deletion transaction passes, the data deletion transaction is executed.
8. A method for deleting blockchain data, applied to a node device of a blockchain, wherein the system resources on the node device are value-anchored with the virtual resources published on the blockchain; the method comprising: Receiving a data deletion transaction corresponding to target data stored in a target smart contract, sent by a blockchain client, wherein the data deletion transaction includes an account identifier of a user; Executing the data deletion transaction to delete the target data from the target smart contract; After deleting the target data from the target smart contract, calculating a first amount of the system resources consumed by processing the data deletion transaction, determining a second amount of the virtual resources anchored to the value of the first amount of system resources, and deducting the second amount of virtual resources from the virtual resources held by the user account corresponding to the account identifier; The second amount of virtual resources deducted from the virtual resources held by the user account corresponding to the account identifier are allocated to the blockchain account corresponding to the node device of the blockchain for holding.
9. The method according to claim 8, wherein the data deletion transaction is a smart contract call transaction, and the execution logic corresponding to the contract code of the target smart contract includes data deletion logic; The executing the data deletion transaction to delete the target data from the target smart contract includes: The target smart contract is called, the data deletion logic is executed, and the target data is deleted from the target smart contract.
10. The method according to claim 8, if the second amount of virtual resources is successfully deducted from the virtual resources held by the user account corresponding to the account identifier, storing the generated transaction receipt corresponding to the data deletion transaction in the blockchain, and returning a prompt indicating that the target data has been successfully deleted to the blockchain client; If the number of virtual resources held by the user account is less than the second number, the transaction receipt corresponding to the generated data deletion transaction is deleted, and a prompt indicating that the target data deletion failed is returned to the blockchain client.
11. The method according to claim 9, wherein processing the system resources consumed by the data deletion transaction comprises one or more combinations of the following: Processing the storage resources on the node device consumed by the smart contract creation transaction, wherein the storage resources include the storage resources consumed by the target data in the backup database maintained by the blockchain; Processing the computing resources on the node device consumed by the smart contract creation transaction; The network resources on the node device consumed in processing the smart contract creation transaction.
12. The method according to claim 8, allocating the second amount of virtual resources deducted from the virtual resources held by the user account corresponding to the account identifier to the blockchain account corresponding to the node device of the blockchain for holding, comprising: The second amount of virtual resources deducted from the virtual resources held by the user account corresponding to the account identifier are evenly distributed to the blockchain accounts corresponding to the node devices of the blockchain for respective holding; Alternatively, based on the storage medium performance attributes of the account storage resources allocated by each node device of the blockchain to the smart contract, the second amount of virtual resources deducted from the virtual resources held by the user account corresponding to the account identifier will be allocated to the blockchain accounts corresponding to each node device of the blockchain for holding respectively.
13. The method according to claim 8, wherein the blockchain maintains the remaining storage capacity of the account storage resources allocated by the node device to the target smart contract; The executing of the data deletion transaction further includes: After the target data is deleted, the remaining storage capacity maintained by the blockchain is updated.
14. The method according to claim 8, before executing the data deletion transaction, the method further comprises: Broadcasting the data deletion transaction to the blockchain network to perform consensus verification on the data deletion transaction; wherein the consensus verification includes: verifying whether the number of virtual resources held by the user account is not less than a preset threshold; If the consensus verification of the data deletion transaction passes, the smart contract creation transaction is executed.
15. A device for deleting blockchain data, applied to a node device of a blockchain, wherein the system resources on the node device are value-anchored with the virtual resources published on the blockchain; the device comprises: A receiving unit, receiving a data deletion transaction corresponding to target data stored in a target smart contract, sent by a blockchain client, wherein the data deletion transaction includes an account identifier of a user; a calculation unit, configured to calculate a first amount of the system resources consumed in processing the data deletion transaction, and determine a second amount of the virtual resources anchored to a value of the first amount of the system resources; a deduction unit, deducting the second amount of virtual resources from the virtual resources held by the user account corresponding to the account identifier, and allocating the second amount of virtual resources deducted from the virtual resources held by the user account corresponding to the account identifier to a blockchain account corresponding to a node device of the blockchain for holding; An execution unit, after deducting the second amount of virtual resources from the virtual resources held by the user account, executes the data deletion transaction to delete the target data from the target smart contract.
16. A device for deleting blockchain data, applied to a node device of a blockchain, wherein the system resources on the node device are value-anchored with virtual resources published on the blockchain; the device comprises: A receiving unit, receiving a data deletion transaction corresponding to target data stored in a target smart contract, sent by a blockchain client, wherein the data deletion transaction includes an account identifier of a user; An execution unit, configured to execute the data deletion transaction and delete the target data from the target smart contract; a computing unit, after deleting the target data from the target smart contract, calculating a first amount of the system resources consumed by processing the data deletion transaction, and determining a second amount of the virtual resources anchored to the value of the first amount of the system resources; The deduction unit deducts the second amount of virtual resources from the virtual resources held by the user account corresponding to the account identifier, and allocates the second amount of virtual resources deducted from the virtual resources held by the user account corresponding to the account identifier to the blockchain account corresponding to the node device of the blockchain for holding.
17. A computer device comprising: memory and processor; The memory stores a computer program executable by the processor; When the processor runs the computer program, the processor performs the method according to any one of claims 1 to 14.