Method and apparatus for storage space management of smart contract accounts
By installing a storage space management platform on blockchain node devices and using virtual resources for value anchoring, the problem of smart contract account storage space management is solved, and efficient management and optimized configuration of storage resources are achieved.
Patent Information
- Application Number
- CN202110797449.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-10-20
- Publication Date
- 2025-05-30
- Estimated Expiration
- 2040-10-20
AI Technical Summary
Existing blockchain technology is difficult to effectively manage the storage space of smart contract accounts, resulting in unoptimized resource allocation and difficult to meet the storage needs of smart contracts.
By installing a storage space management platform on the node devices of the blockchain, virtual resources are used to anchor value with storage space capacity and effective time, the storage space management of smart contract accounts is realized, including expanding or reducing storage space capacity and effective time.
Improve the manageability and configuration optimization of smart contract storage space, ensuring that smart contracts can effectively use and manage their storage resources.
Smart Images

Figure CN113468271B_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 apparatus for managing the storage space of smart contract accounts. Background Art
[0002] Blockchain technology, also known as distributed ledger technology, is a new technology in which several computing devices jointly participate in "recording accounts" and jointly maintain a complete distributed database. Due to the characteristics of blockchain technology such as decentralization, openness and transparency, each computing device can participate in database records, and data synchronization can be quickly carried out between computing devices, blockchain technology has been widely applied in many fields. Summary of the Invention
[0003] In view of this, one or more embodiments of this specification provide a method for managing the storage space of a smart contract account, which is applied to a management platform that manages node devices of a blockchain. The management platform maintains the remaining storage capacity and / or remaining valid duration of the storage space allocated by the node device for the target smart contract account; the storage space capacity carried by the node device of the blockchain and / or the valid duration of the storage space carried by the node device of the blockchain are value-anchored to virtual resources;
[0004] The method includes:
[0005] Receiving a storage space management request sent by a blockchain client, where the storage space management request includes the capacity for expanding the storage space capacity allocated by the node device for the target smart contract account and / or the valid duration for expanding the valid duration of the storage space allocated by the node device for the target smart contract account;
[0006] Calculating a first quantity of the virtual resources value-anchored to the expanded capacity and / or the expanded valid duration;
[0007] After the first quantity of virtual resources is deducted from the user's virtual resource account, based on the expanded capacity and / or the expanded valid duration, performing a change process on the remaining storage capacity and / or remaining valid duration of the storage space allocated by the node device for the target smart contract account maintained by the management platform.
[0008] In another illustrated embodiment, the method further includes:
[0009] Allocating the first quantity of virtual resources to the virtual resource account corresponding to the node device of the blockchain for holding.
[0010] In another illustrated embodiment, allocating the first quantity of virtual resources to the virtual resource accounts corresponding to the node devices of the blockchain for holding includes:
[0011] Allocating the first quantity of virtual resources evenly to the virtual resource accounts corresponding to the node devices of the blockchain for holding;
[0012] Alternatively, based on the storage medium performance attributes of the account storage resources allocated by each node device of the blockchain for the smart contract, allocating the first quantity of virtual resources to the virtual resource accounts corresponding to the node devices of the blockchain for holding.
[0013] In another illustrated embodiment, the method further includes:
[0014] Receiving a storage space management request sent by a blockchain client, where the storage space management request includes a capacity for reducing the storage space capacity allocated by a node device for a target smart contract account, and / or a valid duration for reducing the valid duration of the storage space allocated by the node device for the target smart contract account;
[0015] Calculating a second quantity of the virtual resources value-anchored to the reduced capacity and / or the reduced valid duration value, so that the virtual resource account of the user is increased by the second quantity of virtual resources;
[0016] Based on the reduced capacity and / or the reduced valid duration, performing a change process on the remaining storage capacity and / or the remaining valid duration of the storage space allocated by the node device for the target smart contract account maintained by the blockchain.
[0017] In another illustrated embodiment, the method further includes:
[0018] If the first quantity of virtual resources has not been successfully deducted from the virtual resource account of the user within a preset time limit, returning a prompt indicating that the execution of the storage capacity management transaction has failed to the blockchain client.
[0019] In another illustrated embodiment, the virtual resources are blockchain assets issued on the blockchain with off-chain assets held by the user as the value anchor.
[0020] Accordingly, this specification also provides a storage space management device for an intelligent contract account, which is applied to a management platform that manages node devices of a blockchain. The management platform maintains the remaining storage capacity and / or remaining valid duration of the storage space allocated by the node device for a target intelligent contract account; the storage space capacity carried by the node device of the blockchain and / or the valid duration of the storage space carried by the node device of the blockchain are value-anchored to virtual resources;
[0021] The device includes:
[0022] A receiving unit that receives a storage space management request sent by a blockchain client. The storage space management request includes the capacity for expanding the storage space capacity allocated by the node device for a target intelligent contract account and / or the valid duration for expanding the valid duration of the storage space allocated by the node device for a target intelligent contract account;
[0023] A calculation unit that calculates a first quantity of the virtual resources value-anchored to the expanded capacity and / or the expanded valid duration;
[0024] A change unit that, after the first quantity of virtual resources is deducted from the user's virtual resource account, performs a change process on the remaining storage capacity and / or remaining valid duration of the storage space allocated by the node device for the target intelligent contract account maintained by the management platform based on the expanded capacity and / or the expanded valid duration.
[0025] In another illustrated embodiment, the device further includes:
[0026] An allocation unit that allocates the first quantity of virtual resources to the virtual resource account corresponding to the node device of the blockchain for holding.
[0027] In another illustrated embodiment, the allocation unit further includes:
[0028] Allocating the first quantity of virtual resources evenly to the virtual resource account corresponding to the node device of the blockchain for holding;
[0029] Or, based on the storage medium performance attributes of the account storage resources allocated by each node device of the blockchain for the intelligent contract, allocating the first quantity of virtual resources to the virtual resource account corresponding to the node device of the blockchain for holding.
[0030] In yet another illustrated embodiment, the receiving unit is further configured to receive a storage space management request sent by a blockchain client, where the storage space management request includes a capacity for reducing the storage space capacity allocated by a node device for a target smart contract account, and / or a valid duration for reducing the valid duration of the storage space allocated by the node device for the target smart contract account;
[0031] The calculating unit is further configured to calculate a second quantity of the virtual resources value-anchored to the reduced capacity and / or the reduced valid duration value, so that the virtual resource account of the user is increased by the second quantity of virtual resources;
[0032] The changing unit is further configured to perform a change process on the remaining storage capacity and / or the remaining valid duration of the storage space allocated by the node device for the target smart contract account maintained by the blockchain, based on the reduced capacity and / or the reduced valid duration.
[0033] In yet another illustrated embodiment, the device further includes:
[0034] A returning unit, if the first quantity of virtual resources cannot be successfully deducted from the virtual resource account of the user within a preset time limit, returns a prompt indicating that the storage capacity management transaction execution has failed to the blockchain client.
[0035] In yet another illustrated embodiment, the virtual resources are blockchain assets issued on the blockchain with the off-chain assets held by the user as the value anchor.
[0036] Correspondingly, the present specification further provides a computer device, including: a memory and a processor; a computer program executable by the processor is stored on the memory; when the processor runs the computer program, it executes the method for managing the storage space of a smart contract account performed by the management platform as described in the above embodiments.
[0037] Based on the method, device, and computer device for managing the storage space of a smart contract account according to one or more of the above embodiments, the storage resources carried by the node device of the blockchain can be value-anchored to virtual resources, so that management operations such as expanding the storage capacity and the valid duration of the storage space of the target smart contract account can be performed based on the client, improving the manageability of the smart contract storage space and optimizing the configuration of the smart contract storage space. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 is a schematic diagram of creating a smart contract provided by an exemplary embodiment;
[0039] Figure 2It is a schematic diagram of invoking a smart contract provided by an exemplary embodiment;
[0040] Figure 3 It is a schematic diagram of creating and invoking a smart contract provided by an exemplary embodiment;
[0041] Figure 4 It is a schematic flowchart of a method for managing the storage space of a smart contract account provided by an exemplary embodiment;
[0042] Figure 5 It is a schematic diagram of a device for managing the storage space of a smart contract account applied to the management platform side provided by an exemplary embodiment;
[0043] Figure 6 It is a hardware structure diagram for running the embodiment of the device for managing the storage space of the smart contract account provided in this specification. Detailed implementation manners
[0044] Here, the exemplary embodiments will be described in detail, and the examples are shown in the drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementation manners described in the following exemplary embodiments do not represent all the implementation manners consistent with one or more embodiments of this specification. On the contrary, they are merely examples of devices and methods that are consistent with some aspects of one or more embodiments of this specification.
[0045] It should be noted that: In other embodiments, the steps of the corresponding methods are not necessarily executed in the order shown and described in this specification. In some other embodiments, the steps included in the method may be more or less than those described in this specification. In addition, a single step described in this specification may be decomposed into multiple steps for description in other embodiments; and multiple steps described in this specification may also be combined into a single step for description in other embodiments.
[0046] Here, the exemplary embodiments will be described in detail, and the examples are shown in the drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementation manners described in the following exemplary embodiments do not represent all the implementation manners consistent with one or more embodiments of this specification.
[0047] It should be noted that: In other embodiments, the steps of the corresponding methods are not necessarily executed in the order shown and described in this specification. In some other embodiments, the steps included in the method may be more or less than those described in this specification. In addition, a single step described in this specification may be decomposed into multiple steps for description in other embodiments; and multiple steps described in this specification may also be combined into a single step for description in other embodiments.
[0048] 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 reached by each node device through a consensus mechanism. The ledger data in this blockchain is distributed within "blocks" that are connected in time. The subsequent block may contain the data digest of the previous block, and according to different specific consensus mechanisms (such as POW, POS, DPOS, or PBFT, etc.), full data backups of all or part of the nodes are achieved.
[0049] Blockchains are generally divided into three types: public blockchains, private blockchains, and consortium blockchains. In addition, there can also be combinations of the above multiple types, such as private blockchain + consortium blockchain, consortium blockchain + public blockchain, etc.
[0050] Among them, the public blockchain has the highest degree of decentralization. Participants who join the public blockchain (also known as nodes in the blockchain) can read the data records on the chain, participate in transactions, and compete for the right to record new blocks, etc. Moreover, each node can freely join or exit the network and perform related operations.
[0051] On the contrary, for private blockchains, the write permission of the network is controlled by a certain organization or institution, and the data read permission is subject to organizational regulations. Simply put, a private blockchain can be a weakly decentralized system, which has strict restrictions on nodes and a small number of nodes. This type of blockchain is more suitable for internal use within a specific institution.
[0052] Consortium blockchains are blockchains that lie between public blockchains and private blockchains and can achieve "partial decentralization". Each node in a consortium blockchain usually has a corresponding entity organization or institution; nodes join the network through authorization and form an interest-related consortium to jointly maintain the operation of the blockchain.
[0053] It can be expected that the implementation methods provided in this specification can be implemented in any suitable type of blockchain network.
[0054] The computing device can construct the data into a standard transaction format supported by the blockchain, and then publish it to the blockchain. The node devices in the blockchain perform consensus processing on the received transactions. After reaching a consensus, the node device acting as the accounting node in the blockchain packages this transaction into a block and persists the evidence in the blockchain.
[0055] Regardless of which consensus algorithm the blockchain adopts, the accounting node can package the received transactions to generate the latest block and send the generated latest block to other node devices for consensus verification. If there are no problems after verification when other node devices receive the latest block, they can append the latest block to the end of the original blockchain, thus completing the accounting process of the blockchain. During the process of other nodes verifying the new block sent by the accounting node, they can also execute the transactions included in the block.
[0056] It should be noted that for each newly generated block in the blockchain, after the transactions in the latest block are executed, the corresponding states of these executed transactions in the blockchain will change accordingly. For example, in a blockchain structured with an account model, the account states of external accounts or smart contract accounts usually also change accordingly with the execution of transactions.
[0057] For example, after a "transfer transaction" in a block is executed, the balances of the transferor account and the transferee account related to this "transfer transaction" (i.e., the field values of the Balance fields of these accounts) usually also change accordingly.
[0058] Another example is that the "smart contract call transaction" in a 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 state of the smart contract account after executing the above smart contract call transaction in the account of this smart contract.
[0059] In practical applications, whether it is a public blockchain, a private blockchain, or a consortium blockchain, they may all provide the function of smart contracts. Smart contracts on the blockchain are contracts that can be triggered and executed by transactions on the blockchain. Smart contracts can be defined in the form of code.
[0060] Taking Ethereum as an example, it supports users to create and call some complex logics in the Ethereum network. As a programmable blockchain, the core of Ethereum is the Ethereum Virtual Machine (EVM), and each Ethereum node can run the EVM. The EVM is a Turing-complete virtual machine through which various complex logics can be implemented. When users publish and call smart contracts in Ethereum, they are running on the EVM. In fact, what the EVM directly runs is virtual machine code (virtual machine bytecode, hereinafter referred to as "bytecode"), so the smart contracts deployed on the blockchain can be bytecode.
[0061] As Figure 1 shown, 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. Among them, the From field of the transaction in the figure is used to record the address of the account that initiates the creation of the smart contract, the field value of the Data field of the transaction stores the contract code which can be bytecode, and the field value of the To field of the transaction is a null (empty) account. When the nodes reach an agreement through the consensus mechanism, this smart contract is successfully created, and subsequent users can call this smart contract.
[0062] After the smart contract is created, a contract account corresponding to this smart contract appears on the blockchain and has a specific address; for example, Figure 1 "0x68e12cf284..." in each node in represents the address of this created contract account; the contract code (Code) and account storage (Storage) will be saved in the account storage of this contract account. The behavior of the smart contract is controlled by the contract code, and the account storage of the smart contract stores the state of the contract. In other words, the smart contract makes a virtual account containing contract code and account storage appear on the blockchain.
[0063] As mentioned above, the Data field of the transaction containing the creation of the smart contract can store the bytecode of this smart contract. The bytecode consists of a series of bytes, and each byte can identify an operation. Considering various aspects such as development efficiency and readability, developers can choose to write smart contract code in a high-level language instead of directly writing bytecode. For example, high-level languages can be such as Solidity, Serpent, LLL language, etc. For the smart contract code written in a high-level language, it can be compiled by a compiler to generate bytecode that can be deployed to the blockchain.
[0064] Taking Solidity as an example, the contract code written in it is very similar to the class in object-oriented programming languages. Multiple members can be declared in a contract, including state variables, functions, function modifiers, events, etc. State variables are values permanently stored in the account storage field of the smart contract and are used to save the state of the contract.
[0065] As Figure 2 shown, still taking Ethereum as an example, after Bob sends a transaction containing information about calling a smart contract to the Ethereum network, each node can execute this transaction in the EVM. Among them, the From field of the transaction in the figure is used to record the address of the account that initiates the call to the smart contract, the To field is used to record the address of the smart contract being called, and the Data field of the transaction is used to record the method and parameters for calling the smart contract. After calling the smart contract, the account state of the contract account may change. Subsequently, a certain client can view the account state of the contract account through the connected blockchain node. For example, the above account state can be stored in the Storage tree of the smart contract in the form of key-value pairs. The execution result of the transaction calling the smart contract can be stored in the MPT receipt tree in the form of a transaction receipt.
[0066] Smart contracts can be independently executed at each node in the blockchain network in a prescribed manner, and all execution records and data are saved on the blockchain. Therefore, after such a transaction is executed, an immutable and non-lost transaction voucher is saved on the blockchain.
[0067] The schematic diagrams for creating and calling smart contracts are as Figure 3 shown. In Ethereum, to create a smart contract, processes such as writing the smart contract, converting it into bytecode, and deploying it to the blockchain are required. In Ethereum, calling a smart contract is to initiate a transaction pointing to the smart contract address, and the EVMs of each node can execute this transaction separately, running the smart contract code distributively in the virtual machines of each node in the Ethereum network.
[0068] For accounts in the blockchain, usually a struct is used to maintain the account state of the account. When the transactions in a block are executed, the state of the accounts in the blockchain related to this transaction usually also changes.
[0069] Taking Ethereum as an example, the struct of an account usually includes fields such as Balance, Nonce, Code, and Storage. Among them:
[0070] The Balance field is used to maintain the current account balance of the account;
[0071] Nonce field, used to maintain the transaction count of the account; it is a counter used to ensure that each transaction can and can only be processed once, effectively avoiding replay attacks;
[0072] Code field, used to maintain the contract code of the account; in practical applications, only the hash value of the contract code is usually maintained in the Code field; thus, the Code field is usually also referred to as the Codehash field.
[0073] Storage field, used to maintain the storage content of the account (the default field value is empty); for contract accounts, an independent storage space is usually allocated to store the storage content of the contract account; this independent storage space is usually referred to as the account storage of the contract account. The storage content of the contract account is usually constructed into a Merkle Patricia Trie (MPT) tree data structure and stored in the above-mentioned independent storage space; among them, the MPT tree constructed based on the storage content of the contract account is usually also referred to as the Storage tree. And the Storage field usually only maintains the root node of this Storage tree; therefore, the Storage field is usually also referred to as the StorageRoot field.
[0074] Among them, for external accounts, the field values of the above-mentioned Code field and Storage field are both null values.
[0075] For most blockchain models, Merkle trees are usually used; or, based on the data structure of Merkle trees, data is stored and maintained. Taking Ethereum as an example, Ethereum uses an MPT tree (a variant of Merkle tree) as the data organization form to organize and manage important data such as account states and transaction information.
[0076] Ethereum designed three MPT trees for the data that needs to be stored and maintained in the blockchain, namely the MPT state tree, the MPT transaction tree, and the MPT receipt tree. Among them, in addition to the above three MPT trees, there is actually also a Storage tree constructed based on the storage content of the contract account.
[0077] The MPT state tree is an MPT tree organized by the account state data of all accounts in the blockchain; the MPT transaction tree is an MPT tree organized by the transaction data in the blockchain; the MPT receipt tree is an MPT tree organized by the transaction receipts corresponding to each transaction generated after the transactions in the block are executed. The hash values of the root nodes of the above-mentioned MPT state tree, MPT transaction tree, and MPT receipt tree will ultimately be added to the block header of the corresponding block.
[0078] Among them, both the MPT transaction tree and the MPT receipt tree correspond to the block, that is, each block has its own MPT transaction tree and MPT receipt tree. For the organized MPT transaction tree, MPT receipt tree, and MPT status tree, they will ultimately be stored in a key-value database (such as LevelDB) that adopts a multi-level data storage structure.
[0079] In the field of public blockchains, miners' nodes are often incentivized to generate blocks in the blockchain through methods such as gas and tokens. Miners' nodes will choose to preferentially package transactions with higher fees such as gas or tokens into the block to increase their own income; for non-miner nodes, although they contribute storage and consensus resources, they do not receive corresponding income. In the blockchain model, how to count the blockchain resources provided by node devices and cover the corresponding node costs to maintain the good operation of the consortium blockchain network is also an urgent problem to be solved. Currently, there is still a lack of a method for resource management and billing of blockchain users based on the usage or occupancy of blockchain resources.
[0080] In view of the above problems, one or more embodiments of this specification provide various resource charging methods in the blockchain system. It can be expected that the embodiments provided in this specification can be implemented in suitable types of blockchain networks such as public blockchains, consortium blockchains, and private blockchains.
[0081] The management platform described in one or more embodiments provided in this specification may include a platform disposed in each node device of the blockchain or connected to each node device of the blockchain to manage each node device of the blockchain. Optionally, the above management platform includes a cloud computing management platform. Correspondingly, the node devices of the above blockchain include virtual machines created on physical hosts managed by the cloud computing management platform.
[0082] The blockchain client described in one or more embodiments provided in this specification can be connected to the node devices of the blockchain through the above management platform, so as to send transactions to the blockchain network or obtain the transaction execution results in the blockchain network based on communication with the management platform.
[0083] In the blockchain provided in this specification, the management platform anchors the value of the system resources and virtual resources carried by the node devices of the blockchain.
[0084] The above virtual resources may include the digital forms of real assets circulating under the blockchain, such as assets in the forms of currency, real estate, stocks, bonds, loan contracts, bills, accounts receivable, etc.; they may also include virtual resources circulating on the blockchain. In another illustrated embodiment, the virtual resources published on the blockchain may include blockchain assets having a value anchoring relationship with off-chain real assets held by users. After freezing real assets in the real world (including assets in the forms of currency, real estate, stocks, loan contracts, bills, accounts receivable, etc.), virtual resources that are anchored to the frozen real assets and can circulate on the chain can be issued on the chain.
[0085] When implemented, the user client can perform an asset freezing and exchange process with the above management platform. The user client freezes a certain amount of real assets and sends the freezing certificate to the management platform; after receiving the freezing certificate, the management platform can, based on the freezing certificate, instruct the node device to increase virtual resources corresponding to the amount value of the frozen real assets in the user's blockchain account balance on the blockchain.
[0086] Increasing virtual resources corresponding to the amount value of the frozen real assets in the user's blockchain account balance based on the above freezing certificate can be further realized by the user interacting with a smart contract: the above management platform triggers a virtual resource exchange transaction sent to the blockchain network, and the virtual resource exchange transaction includes the above asset freezing certificate; in response to the above 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 increases virtual resources corresponding to the amount value of the real assets frozen by the above asset freezing certificate in the user's blockchain account balance.
[0087] Based on the above method, users can obtain virtual resources that can be value-anchored to real assets in the blockchain network. The above virtual resources can be manifested as the user's on-chain account balance.
[0088] In the blockchain network system, the node device of the blockchain provides system resources for the blockchain service and can be value-anchored to the above virtual resources. For example, the storage resources provided by the node device for the data on the blockchain can be value-anchored to the above virtual resources, and a corresponding virtual resource can be obtained for each storage unit capacity of blockchain data; again, for example, the CPU computing resources provided by the node device for the execution of any transaction on the blockchain can be value-anchored to the above virtual resources, and a corresponding virtual resource can be obtained for each execution unit quantity of the CPU instruction set; furthermore, for example, the network resources provided by the node device for the broadcast and consensus of any transaction on the blockchain can be value-anchored to the above virtual resources, and corresponding virtual resources can be obtained based on the network traffic consumed in the broadcast or consensus process of the on-chain transaction.
[0089] Blockchain developers or management platforms can quantify the system resources in the forms of the above storage resources, computing resources, network resources, etc., and price 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 blockchains, their consortium members are relatively fixed, and the pricing of the system resources obtained by the above anchoring can be kept fixed for a relatively long time; for public blockchain systems, nodes enter or exit the blockchain network relatively frequently. After blockchain developers price each unit of the above multiple forms of system resources, they perform real-time virtual resource transfer based on the scale of the blockchain when users use the blockchain, or perform periodic virtual resource transfer according to a relatively short cycle. Those skilled in the art can also start from the actual cost requirements and deduct virtual resources from users for the blockchain services provided by blockchain node devices based on any form of system resources that have a value anchoring relationship with the above virtual resources. This specification does not make any limitations in this regard.
[0090] After a smart contract is created and deployed on the blockchain, the management platform can maintain the attribute content of the storage space allocated by the node device of the blockchain for this smart contract account, which can specifically include the storage space capacity allocated by the node device for this smart contract account, the remaining storage space capacity, and / or the effective duration (or expiration date) of the storage space capacity allocated by the node device for this smart contract account.
[0091] For example, a user can apply for a specified storage space capacity for the smart contract account when creating the smart contract, and the above management platform can maintain and record the above-specified storage space capacity, and can also maintain and record the remaining available storage space capacity after the smart contract is deployed or called; during the process of the smart contract being called and executed, if the initially specified storage space capacity by the user cannot enable the successful execution of the smart contract call transaction (when the storage space occupied by the smart contract account after the smart contract call transaction is completed is greater than the above-specified storage space capacity), the user can apply to the management platform to expand the storage space capacity of the above smart contract account. Or, when the user believes that the initially specified storage space is too large, the user can apply to the blockchain system to reduce the storage space capacity of the above smart contract account.
[0092] Again, for example, a user can apply for a specified effective duration of the storage space for the smart contract account when creating the smart contract. When the effective duration expires, the blockchain system may stop providing services for the above smart contract (such as real-time smart contract call services). To extend the duration of the blockchain system providing services for the above smart contract, the user can apply to the management platform to expand the effective duration of the storage space of the above smart contract account. Or, when the user believes that the initially specified effective duration of the storage space is too long, the user can apply to the management platform to reduce the effective duration of the storage space of the above smart contract account.
[0093] It should be noted that the storage space capacity allocated by the node device maintained in the management platform for the target smart contract account may not be the actual storage space capacity currently allocated by the node device for the target smart contract account, but the maximum storage space capacity that the node device can allocate for the target smart contract account.
[0094] The storage space capacity carried by the node device of the blockchain, and / or the effective duration of the storage space carried by the node device of the blockchain, can be value-anchored to the virtual resources published on the blockchain. For example, the blockchain system can price the storage resources provided by the node device for the smart contract account: m (virtual resource unit) / Gb, or m (virtual resource unit) / Gb / day.
[0095] It should be noted that the pricing of the storage resources provided by the above blockchain system for the node device can be related to the number of nodes in the blockchain system. It can be expected that the more node devices there are in the blockchain, the more storage resources actually occupied by the smart contract account. Therefore, the blockchain system can adjust the pricing per unit of storage resources charged to users based on the number of node devices.
[0096] The management user of the smart contract can manage the storage space of the smart contract account by sending a storage space management request to the management platform, so as to expand or shrink the storage space of the smart contract account, extend or shorten the effective duration of the storage space of the smart contract account, and perform corresponding virtual resource transfer or reception based on the quantity of the virtual resources anchored to the above storage resources.
[0097] As Figure 4 shown, the method for managing the storage space of a smart contract account provided by an exemplary embodiment of this specification includes:
[0098] Step 402, the management platform receives a storage space management request sent by the blockchain client, and the storage space management request includes the capacity for expanding the storage space capacity allocated by the node device for the target smart contract account, and / or the effective duration for expanding the effective duration of the storage space allocated by the node device for the target smart contract account.
[0099] Optionally, the above storage space management request may further include the identification information of the target smart contract account, so as to facilitate the management platform to retrieve the status such as the storage space capacity and effective duration allocated by the node device maintained in the platform for the target smart contract account based on the identification information of the target smart contract account.
[0100] Step 404, calculate the first quantity of the virtual resources anchored to the expanded capacity and / or the expanded effective duration value, so that the user's virtual resource account is deducted by the first quantity of virtual resources.
[0101] For example, the above management platform can price the storage resources provided for the node device: m (virtual resource unit) / Gb. The user requests an expanded capacity of NGb for the account of the target smart contract in the storage space management request. The above management platform can calculate the first quantity of the virtual resources anchored to the expanded capacity value, which may include: m * N (virtual resource units).
[0102] Another example, the above management platform can price the storage resources provided for the node device: m (virtual resource unit) / Gb / day. The storage space capacity already allocated for the target smart contract account by the node device is NGB; the user requests an expanded effective duration of h days for the account of the target smart contract in the storage space management request. The above management platform can calculate the first quantity of the virtual resources anchored to the expanded effective duration value, which may include: m * N * h (virtual resource units).
[0103] Another example, the above management platform can price the storage resources provided for the node device: m (virtual resource unit) / Gb / day. The storage space capacity already allocated for the target smart contract account by the node device is NGB; the user requests an expanded effective duration of h days and an expanded capacity of PGB for the account of the target smart contract in the storage space management transaction. The above management platform can calculate the first quantity of the virtual resources anchored to the expanded capacity and the expanded effective duration value, which may include: m * (N + P) * h (virtual resource units).
[0104] The above user's virtual resource account is an account storing resources of the same type as the above virtual resources; when the above virtual resources are off-chain real assets, the above virtual resource account may include a currency account (such as a bank account), or a virtual points account established by the user on the management platform and using currency exchange; when the above virtual resources are virtual resources published on the blockchain, the above virtual resource account may include the user's blockchain account.
[0105] When the virtual resource account of the above user is a currency account, the entity that executes the deduction of the first quantity of virtual resources from the virtual resource account of the user can be a financial institution such as a bank, and the deducted first quantity of virtual resources can be transferred to the corresponding currency account of the management platform; when the virtual resource account of the above user is a virtual currency or virtual points account established on the management platform, the entity that executes the deduction of the first quantity of virtual resources from the virtual resource account of the user can be the above management platform; when the virtual resource account of the above user is a blockchain account, the entity that executes the deduction of the first quantity of virtual resources from the virtual resource account of the user can be a node device of the blockchain, and the deducted first quantity of virtual resources can be transferred to the corresponding blockchain account of the management platform.
[0106] This embodiment does not limit the execution subject, deduction timing, and specific method of deducting the first quantity of virtual resources from the virtual resource account of the user.
[0107] After calculating the first quantity of virtual resources anchored to the expanded capacity and / or the value of the expanded effective duration, the above management platform can send a payment instruction for the first quantity of virtual resources to the user client.
[0108] For example, the user client can push a cash currency payment page on the user interface of the client. In response to the payment verification information (such as a digital password or biometric identification information) input by the user on the client, the financial institution corresponding to the user's cash currency account can complete the deduction of the above first quantity of virtual resources from the user's cash currency account.
[0109] Another example is that the user client can push a virtual points payment page circulating on the management platform on the user interface of the client. The virtual points are obtained by the user exchanging currency cash on the management platform and deposited into the virtual points account opened by the user on the management platform. Thus, in response to the payment verification information (such as a digital password or biometric identification information) input by the user on the client, the management platform can complete the deduction of the above first quantity of virtual resources from the virtual points account of the user on the management platform.
[0110] When the above virtual resources are virtual resources published on the blockchain, the payment instruction for the first quantity of virtual resources sent by the above management platform to the client can be to construct a page for a transfer transaction on the blockchain pushed on the user interface of the client, so that the above blockchain client can further send a transfer transaction to the blockchain through the management platform, so that after the transfer transaction is verified and passed by the blockchain consensus, the node device of the blockchain deducts the first quantity of virtual resources from the user's blockchain account, or deducts the first quantity of virtual resources from the user's blockchain account and transfers it to the blockchain account corresponding to the management platform. After that, the management platform can learn from the node device whether the above transfer transaction has been successfully executed.
[0111] If the quantity of virtual resources held in the user's virtual resource account is less than the first quantity, resulting in the failure of the above deduction process, or the management platform fails to obtain the message that the first quantity of virtual resources has been deducted from the virtual resource account of the client user within the preset time limit, the management platform can return a prompt indicating the failure of the execution of the storage space management request to the blockchain client.
[0112] In one or more of the above embodiments, after the management platform learns that the first quantity of virtual resources has been successfully deducted from the user's virtual resource account, the management platform can allocate the first quantity of virtual resources to the virtual resource accounts of the users or institutional entities corresponding to the node devices of the blockchain based on a preset period (including in real time or periodically) for holding, so as to complete the allocation of virtual resources to the users or institutional entities that provide system resources in the blockchain system.
[0113] This embodiment does not specifically limit the specific manner in which the above virtual resources are allocated. For example, the management platform can allocate the received currency cash or the currency cash corresponding to the deducted virtual points to the currency cash accounts of the users or institutional entities corresponding to the node devices of the blockchain, or the management platform can allocate the virtual resources published on the chain received in the blockchain account to the blockchain accounts of the users or institutional entities corresponding to the node devices of the blockchain. After that, in response to the cashing request of the above user or institution, the virtual resources allocated to its blockchain account are exchanged for off-chain physical assets, and the virtual resources on the chain that have been exchanged are written off.
[0114] This specification does not specifically limit the rules for allocating the first quantity of virtual resources to the blockchain accounts corresponding to each node device in the blockchain. For example, the node device can evenly allocate the above deducted first quantity of virtual resources to the virtual resource accounts of the users or institutional entities corresponding to each node device of the blockchain for holding respectively.
[0115] Alternatively, based on the storage medium performance attributes of the account storage resources allocated by each node device of the blockchain for the smart contract, the virtual resources from the first quantity are respectively held in the virtual resource accounts assigned to the users or institutional entities corresponding to each node device of the blockchain. For example, since the storage medium configurations of each node device are different, the blockchain system can rate the storage medium of each node device based on the storage medium performance attributes (such as HDD, SSD, or NVM and other hard disk performance attributes) obtained by monitoring each node device, so as to allocate a higher proportion of virtual resources to the node devices with high-grade storage media and a lower proportion of virtual resources to the node devices with low-grade storage media.
[0116] Step 406: Based on the expanded capacity and / or the expanded effective duration, perform change processing on the remaining storage capacity and / or the remaining effective duration of the storage space allocated by the node device maintained by the management platform for the target smart contract account.
[0117] The above change processing may specifically include: increasing the remaining storage capacity of the storage space allocated by the node device maintained by the management platform for the target smart contract account based on the expanded capacity; and / or increasing the remaining effective duration of the storage space allocated by the node device maintained by the management platform for the target smart contract account based on the expanded effective duration.
[0118] During the existence period of the smart contract, the user can expand or reduce the storage space capacity allocated by the node device for the above target smart contract account according to actual needs, and / or expand or reduce the effective duration of the storage space allocated by the node device for the above target smart contract account, so as to change the remaining storage capacity state and / or the remaining effective duration state of the storage space allocated by the node device maintained in the management platform for the target smart contract account.
[0119] For example, in another illustrated embodiment, the method for managing the storage space of the smart contract account further includes: receiving a storage space management request sent by a blockchain client, where the storage space management request includes the capacity for reducing the storage space capacity allocated by the node device for the target smart contract account and / or the effective duration for reducing the effective duration of the storage space allocated by the node device for the target smart contract account;
[0120] Calculating a second quantity of the virtual resources value-anchored to the reduced capacity and / or the reduced effective duration, so that the virtual resource account of the user is increased by the second quantity of virtual resources;
[0121] Based on the reduced capacity and / or the reduced effective duration, perform change processing on the remaining storage capacity and / or the remaining effective duration of the storage space allocated by the node device maintained by the blockchain for the target smart contract account.
[0122] In another illustrated embodiment, the above management platform may also forward the user's storage space management request for the target smart contract account to the node device in the blockchain in the form of a blockchain transaction or in the form of a high-authority system administrator instruction, so as to perform change processing on the remaining storage capacity and / or the remaining effective duration of the storage space allocated by the node device maintained by the blockchain for the target smart contract account.
[0123] In specific implementation, the node device may expand the content fields supported by the above target smart contract account (except for Balance, Nonce, Code, and Storage) to add storage resource variable parameters provided by the node device of the blockchain for the target smart contract (such as the total capacity of the account storage space, the remaining capacity of the account storage space, the effective duration of the account storage space, etc.).
[0124] Corresponding to the implementation of the above process, the embodiments of this specification also provide a storage space management device 50 for a smart contract account. The device 50 can be implemented by software, or by hardware or a combination of software and hardware. Taking software implementation as an example, as a logically meaningful device, it is formed by reading the corresponding computer program instructions into the memory and running them through the CPU (Central Process Unit) of the device where it is located. From the hardware level, in addition to Figure 6 the shown CPU, memory, and storage, the device where the above device is located usually also includes other hardware such as chips for wireless signal transceiver and / or other hardware such as boards for implementing network communication functions.
[0125] As Figure 5 shown, this specification provides a storage space management device 50 for a smart contract account, which is applied to a management platform that manages the node devices of the blockchain. The management platform maintains the remaining storage capacity and / or the remaining effective duration of the storage space allocated by the node device for the target smart contract account; the storage space capacity carried by the node device of the blockchain and / or the effective duration of the storage space carried by the node device of the blockchain are value-anchored to virtual resources;
[0126] The device 50 includes:
[0127] A receiving unit 502 receives a storage space management request sent by a blockchain client. The storage space management request includes a capacity for expanding the storage space capacity allocated by a node device to a target smart contract account, and / or a valid duration for expanding the valid duration of the storage space allocated by the node device to the target smart contract account;
[0128] A calculation unit 504 calculates a first quantity of the virtual resources value-anchored to the expanded capacity and / or the expanded valid duration value;
[0129] A change unit 506, after the virtual resource account of a user is deducted by the first quantity of virtual resources, performs a change process on the remaining storage capacity and / or the remaining valid duration of the storage space allocated by the node device maintained by the management platform to the target smart contract account based on the expanded capacity and / or the expanded valid duration.
[0130] In another illustrated embodiment, the apparatus 50 further includes:
[0131] An allocation unit 508 allocates the first quantity of virtual resources to the virtual resource account corresponding to the node device of the blockchain for holding.
[0132] In another illustrated embodiment, the allocation unit 508 further includes:
[0133] The first quantity of virtual resources is evenly allocated to the virtual resource account corresponding to the node device of the blockchain for holding;
[0134] 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 quantity of virtual resources is allocated to the virtual resource account corresponding to the node device of the blockchain for holding.
[0135] In another illustrated embodiment, the receiving unit 502 is further configured to receive a storage space management request sent by a blockchain client. The storage space management request includes a capacity for reducing the storage space capacity allocated by a node device to a target smart contract account, and / or a valid duration for reducing the valid duration of the storage space allocated by the node device to the target smart contract account;
[0136] The calculation unit 504 is further configured to calculate a second quantity of the virtual resources value-anchored to the reduced capacity and / or the reduced valid duration value, so that the virtual resource account of the user is increased by the second quantity of virtual resources;
[0137] The change unit 506 is further configured to change the remaining storage capacity and / or the remaining valid duration of the storage space allocated by the blockchain for the target smart contract account of the node device based on the reduced capacity and / or the reduced valid duration.
[0138] In another illustrated embodiment, the apparatus 50 further includes:
[0139] A return unit 510, if the first quantity of virtual resources has not been successfully deducted from the user's virtual resource account within a preset time limit, returns a prompt indicating that the storage capacity management transaction execution has failed to the blockchain client.
[0140] In another illustrated embodiment, the virtual resource is a blockchain asset issued on the blockchain by anchoring the off-chain assets held by the user as a value.
[0141] For the specific implementation process of the functions and roles of each unit in the above apparatus 50, refer to the implementation process of the corresponding steps in the storage space management method of the smart contract account executed by the above management platform. For the relevant parts, refer to the partial description of the method embodiment, and details are not described herein again.
[0142] The apparatus embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical modules, that is, they may be located in one place, or may be distributed to multiple network modules. Some or all of the units or modules can be selected according to actual needs to achieve the purpose of the solution in this specification. Those of ordinary skill in the art can understand and implement it without creative efforts.
[0143] The apparatus, unit, and module illustrated in the above embodiments can be specifically implemented by a computer chip or an entity, or by a product with a certain function. A typical implementation device is a computer, and the specific form of the computer can be a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email transceiver device, a game console, a tablet computer, a wearable device, or a combination of any several of these devices.
[0144] Corresponding to the above method embodiment, an embodiment of this specification also provides a computer device, such as Figure 6As shown, the computer device includes a memory and a processor. Among them, a computer program that can be run by the processor is stored on the memory; when the processor runs the stored computer program, it executes each step of the storage space management method of the smart contract account performed by the package management platform of this specification. For a detailed description of each step of the storage space management method of the smart contract account performed by the above management platform, please refer to the previous content and will not be repeated.
[0145] The above are only the preferred embodiments of this specification and are not intended to limit this specification. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of this specification shall be included within the scope of protection of this specification.
[0146] In a typical configuration, a computing device includes one or more processors (CPUs), an input / output interface, a network interface, and memory.
[0147] Memory may include non-permanent memory in computer-readable media, random access memory (RAM), and / or non-volatile memory in the form of, for example, read-only memory (ROM) or flash memory (flash RAM). Memory is an example of computer-readable media.
[0148] Computer-readable media includes permanent and non-permanent, removable and non-removable media and can implement information storage by any method or technology. The information can be computer-readable instructions, data structures, program modules, or other data.
[0149] 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 technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette tapes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission media that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transitory computer-readable media, such as modulated data signals and carrier waves.
[0150] It should also be noted that the term "including", "comprising" or any other variant thereof is intended to cover non-exclusive inclusion, such that a process, method, article or apparatus that includes a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article or apparatus. Without further limitation, an element defined by the phrase "including an..." does not exclude the presence of additional identical elements in the process, method, article or apparatus that includes the element.
[0151] Those skilled in the art should understand that the embodiments of this specification can be provided as a method, system or computer program product. Therefore, the embodiments of this specification can take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware aspects. Moreover, the embodiments of this specification can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
Claims
1. A method for managing the storage space of a smart contract account, which is applied to a management platform for managing each node device of a blockchain; the management platform maintains a remaining storage capacity corresponding to the storage capacity of the storage space of the target smart contract account, and / or a remaining effective duration corresponding to the effective duration of the storage space of the target smart contract account ; The storage capacity, and / or the effective duration, are value-anchored to virtual resources; The method includes: Receiving a storage space management request sent by a blockchain client, where the storage space management request includes an expansion capacity corresponding to the storage capacity of the storage space of the target smart contract account, and / or an expansion duration corresponding to the effective duration of the target smart contract account; Calculating a first quantity of the virtual resources value-anchored to the expansion capacity, and / or the expansion duration, so that the virtual resources held in the virtual resource account of the user corresponding to the blockchain client are deducted by the first quantity of virtual resources; After determining that the first quantity of virtual resources has been deducted from the virtual resources held in the virtual resource account of the user, expanding the storage capacity of the storage space of the target smart contract account maintained by the management platform, and / or the effective duration of the storage space of the target smart contract account, based on the expansion capacity, and / or the expansion duration.
2. The method according to claim 1, the method further includes: Allocating the first quantity of virtual resources to the virtual resource accounts corresponding to the node devices of the blockchain for holding.
3. The method according to claim 2, for allocating the first quantity of virtual resources to the virtual resource accounts corresponding to the node devices of the blockchain for holding, includes: Allocating the first quantity of virtual resources evenly to the virtual resource accounts corresponding to the node devices of the blockchain for holding; Or, based on the storage medium performance attributes of the account storage resources allocated by each node device of the blockchain for the smart contract, allocating the first quantity of virtual resources to the virtual resource accounts corresponding to the node devices of the blockchain for holding.
4. The method according to claim 1, the method further includes: Receiving a storage space management request sent by a blockchain client, where the storage space management request includes a reduction capacity corresponding to the storage capacity of the storage space of the target smart contract account, and / or a reduction duration corresponding to the effective duration of the storage space of the target smart contract account; Calculating a second quantity of the virtual resources value-anchored to the reduction capacity, and / or the reduction duration, so that the virtual resources held in the virtual resource account of the user corresponding to the blockchain client are increased by the second quantity of virtual resources; After determining that the second quantity of virtual resources has been added to the virtual resources held in the user's virtual resource account, based on the reduced capacity and / or the reduced duration, reduce the storage capacity of the storage space of the target smart contract account maintained by the management platform and / or the effective duration of the storage space of the target smart contract account.
5. The method according to claim 1, the method further includes: If the first quantity of virtual resources has not been successfully deducted from the user's virtual resource account within a preset time limit, return a prompt indicating that the storage capacity management transaction execution has failed to the blockchain client.
6. The method according to claim 1, wherein the virtual resources are blockchain assets issued on the blockchain by anchoring off-chain assets held by the user as a value.
7. A storage space management device for a smart contract account, applied to a management platform that manages each node device of a blockchain; the management platform maintains a remaining storage capacity corresponding to the storage capacity of the storage space of the target smart contract account and / or a remaining effective duration corresponding to the effective duration of the storage space of the target smart contract account ; The storage capacity and / or the effective duration are value-anchored to virtual resources; The device includes: A receiving unit that receives a storage space management request sent by a blockchain client, the storage space management request including an expansion capacity corresponding to the storage capacity of the storage space of the target smart contract account and / or an expansion duration corresponding to the effective duration of the target smart contract account; A calculation unit that calculates a first quantity of the virtual resources value-anchored to the expansion capacity and / or the expansion duration, so that the first quantity of virtual resources is deducted from the virtual resources held in the virtual resource account of the user corresponding to the blockchain client; A change unit that, after determining that the first quantity of virtual resources has been deducted from the virtual resources held in the user's virtual resource account, expands the storage capacity of the storage space of the target smart contract account maintained by the management platform and / or the effective duration of the storage space of the target smart contract account based on the expansion capacity and / or the expansion duration.
8. The device according to claim 7, the device further includes: An allocation unit that allocates the first quantity of virtual resources to the virtual resource accounts corresponding to the node devices of the blockchain for holding.
9. The allocation unit of the device according to claim 8, further includes: Allocating the first quantity of virtual resources evenly to the virtual resource accounts corresponding to the node devices of the blockchain for holding; Or, based on the storage medium performance attributes of the account storage resources allocated by each node device of the blockchain for the smart contract, allocate the first quantity of virtual resources to the virtual resource accounts corresponding to the node devices of the blockchain for holding.
10. The device according to claim 7, The receiving unit is further configured to receive a storage space management request sent by a blockchain client, where the storage space management request includes a reduced capacity corresponding to the storage capacity of the storage space of the target smart contract account, and / or a reduced duration corresponding to the effective duration of the storage space of the target smart contract account; The calculating unit is further configured to calculate a second quantity of the virtual resources value-anchored to the reduced capacity and / or the reduced duration, so that the virtual resources held in the virtual resource account of the user corresponding to the blockchain client are increased by the second quantity of the virtual resources; The changing unit is further configured to, after determining that the second quantity of the virtual resources is increased in the virtual resources held in the virtual resource account of the user, reduce the storage capacity of the storage space of the target smart contract account and / or the effective duration of the storage space of the target smart contract account maintained by the management platform based on the reduced capacity and / or the reduced duration.
11. The apparatus according to claim 7, the apparatus further comprises: A returning unit, if the first quantity of the virtual resources cannot be successfully deducted from the virtual resource account of the user within a preset time limit, returns a prompt indicating that the execution of the storage capacity management transaction fails to the blockchain client.
12. The apparatus according to claim 7, where the virtual resources are blockchain assets issued on the blockchain by value-anchoring off-chain assets held by a user.
13. A computer device, comprises: A memory and a processor; A computer program that can be run by the processor is stored on the memory; When the processor runs the computer program, it executes the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
A resource convergence network and method
CN109615352A
Virtual resource allocation method and device based on blockchain, and electronic equipment
CN110458702A
Method and system for customized network information storage service
CN1716207A