CN115456772A - Intelligent contract creating method and device - Google Patents
Intelligent contract creating method and device Download PDFInfo
- Publication number
- CN115456772A CN115456772A CN202210657495.XA CN202210657495A CN115456772A CN 115456772 A CN115456772 A CN 115456772A CN 202210657495 A CN202210657495 A CN 202210657495A CN 115456772 A CN115456772 A CN 115456772A
- Authority
- CN
- China
- Prior art keywords
- intelligent contract
- blockchain
- account
- transaction
- resources
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 108
- 230000008569 process Effects 0.000 claims abstract description 45
- 238000004873 anchoring Methods 0.000 claims abstract description 20
- 230000001960 triggered effect Effects 0.000 claims abstract description 16
- 238000012545 processing Methods 0.000 claims description 53
- 238000012795 verification Methods 0.000 claims description 24
- 238000012546 transfer Methods 0.000 claims description 20
- 238000004364 calculation method Methods 0.000 claims description 16
- 238000004590 computer program Methods 0.000 claims description 13
- 230000004044 response Effects 0.000 claims description 9
- 238000007726 management method Methods 0.000 description 133
- 230000000875 corresponding effect Effects 0.000 description 109
- 238000010586 diagram Methods 0.000 description 8
- 238000005516 engineering process Methods 0.000 description 7
- 230000006870 function Effects 0.000 description 7
- 230000007246 mechanism Effects 0.000 description 6
- 230000008520 organization Effects 0.000 description 6
- 230000008014 freezing Effects 0.000 description 5
- 238000007710 freezing Methods 0.000 description 5
- 230000005540 biological transmission Effects 0.000 description 3
- 230000008859 change Effects 0.000 description 3
- 239000013589 supplement Substances 0.000 description 3
- 239000002699 waste material Substances 0.000 description 3
- RTZKZFJDLAIYFH-UHFFFAOYSA-N Diethyl ether Chemical compound CCOCC RTZKZFJDLAIYFH-UHFFFAOYSA-N 0.000 description 2
- 230000008901 benefit Effects 0.000 description 2
- 238000004422 calculation algorithm Methods 0.000 description 2
- 238000004891 communication Methods 0.000 description 2
- 230000002596 correlated effect Effects 0.000 description 2
- 238000013500 data storage Methods 0.000 description 2
- 230000000977 initiatory effect Effects 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 241000270295 Serpentes Species 0.000 description 1
- 230000009471 action Effects 0.000 description 1
- 238000013459 approach Methods 0.000 description 1
- 230000006399 behavior Effects 0.000 description 1
- 230000001413 cellular effect Effects 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 239000003607 modifier Substances 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 230000000737 periodic effect Effects 0.000 description 1
- 230000002085 persistent effect Effects 0.000 description 1
- 239000000047 product Substances 0.000 description 1
- 238000013468 resource allocation Methods 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q40/00—Finance; Insurance; Tax strategies; Processing of corporate or income taxes
- G06Q40/04—Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
Landscapes
- Business, Economics & Management (AREA)
- Accounting & Taxation (AREA)
- Finance (AREA)
- Engineering & Computer Science (AREA)
- Development Economics (AREA)
- Economics (AREA)
- Marketing (AREA)
- Strategic Management (AREA)
- Technology Law (AREA)
- Physics & Mathematics (AREA)
- General Business, Economics & Management (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
The present specification provides a method and an apparatus for creating an intelligent contract, which are applied to a management platform for performing management on node devices of a block chain, wherein a system resource and a virtual resource carried by the node devices of the block chain are subjected to value anchoring; the method comprises the following steps: acquiring an intelligent contract creation transaction triggered by a blockchain client, wherein the intelligent contract creation transaction comprises an intelligent contract code and an account storage capacity corresponding to an intelligent contract requested by a user; calculating a first amount of the virtual resource anchored to a system resource value of a node device of the blockchain consumed to process the smart contract creation transaction; after the virtual resource account of the user is deducted by the first amount of virtual resources, sending the intelligent contract creation transaction to the blockchain to cause a node device of the blockchain to execute the intelligent contract creation transaction, creating an intelligent contract account corresponding to the intelligent contract code in the blockchain.
Description
Technical Field
One or more embodiments of the present disclosure relate to the field of blockchain technologies, and in particular, to a method and an apparatus for creating an intelligent contract.
Background
The block chain technology, also called distributed ledger technology, is an emerging technology in which several computing devices participate in "accounting" together, and a complete distributed database is maintained together. The blockchain technology has been widely used in many fields due to its characteristics of decentralization, transparency, participation of each computing device in database records, and rapid data synchronization between computing devices.
Disclosure of Invention
In view of this, one or more embodiments of the present specification provide a method, an apparatus, and a computer device for creating an intelligent contract.
To achieve the above object, one or more embodiments of the present disclosure provide the following technical solutions:
according to a first aspect of one or more embodiments of the present specification, a method for creating an intelligent contract is provided, which is applied to a management platform that performs management on a node device of a block chain, where a system resource and a virtual resource carried by the node device of the block chain are subjected to value anchoring; the method comprises the following steps:
acquiring an intelligent contract establishing transaction triggered by a blockchain client, wherein the intelligent contract establishing transaction comprises an intelligent contract code and an account storage capacity corresponding to an intelligent contract requested by a user;
calculating a first amount of the virtual resource anchored to a system resource value of a node device of the blockchain consumed to process the smart contract creation transaction; wherein the processing of system resources of node devices of the blockchain consumed by the smart contract creation transaction includes allocating account storage resources in a node device for the smart contract based on the account storage capacity requested by a user;
after the virtual resource account of the user is deducted by the first amount of virtual resources, sending the intelligent contract creation transaction to the blockchain to cause a node device of the blockchain to execute the intelligent contract creation transaction, creating an intelligent contract account corresponding to the intelligent contract code in the blockchain.
According to a second aspect of one or more embodiments of the present specification, a method for creating an intelligent contract is provided, where the method is applied to a management platform that manages node devices of a block chain, and a system resource and a virtual resource carried by the node devices of the block chain are subjected to value anchoring; the method comprises the following steps:
acquiring an intelligent contract establishing transaction triggered by a blockchain client, wherein the intelligent contract establishing transaction comprises an intelligent contract code and an account storage capacity corresponding to an intelligent contract requested by a user;
sending the intelligent contract creation transaction to the blockchain to cause a node device of the blockchain to execute the intelligent contract creation transaction, creating an intelligent contract account corresponding to the intelligent contract code in the blockchain;
calculating a first amount of the virtual resource anchored to a system resource value of a node device of the blockchain consumed to process the smart contract creation transaction such that the user's virtual resource account is deducted by the first amount of virtual resource; wherein the system resources of the node devices of the blockchain consumed by the processing of the smart contract creation transaction include account storage resources allocated by the node devices for the smart contract based on the account storage capacity requested by the user.
According to a third aspect of one or more embodiments of the present specification, an apparatus for creating an intelligent contract is provided, where the apparatus is applied to a management platform that performs management on node devices of a blockchain, and a system resource and a virtual resource carried by a node device of a blockchain are value-anchored; the device comprises:
the intelligent contract creating method comprises the steps that an obtaining unit obtains an intelligent contract creating transaction triggered by a blockchain client, wherein the intelligent contract creating transaction comprises an intelligent contract code and an account storage capacity corresponding to an intelligent contract requested by a user;
a calculation unit to calculate a first amount of the virtual resource anchored to a system resource value of a node device of the blockchain consumed to process the smart contract creation transaction such that the virtual resource account of the user is deducted by the first amount of virtual resource; wherein the processing of system resources of node devices of the blockchain consumed by the intelligent contract creation transaction includes allocating account storage resources in a node device for the intelligent contract based on the account storage capacity requested by a user;
and a sending unit, configured to send the intelligent contract creation transaction to the blockchain after the virtual resource account of the user is deducted by the first amount of virtual resources, so that a node device of the blockchain executes the intelligent contract creation transaction, and creates an intelligent contract account corresponding to the intelligent contract code in the blockchain.
According to a fourth aspect of one or more embodiments of the present specification, an apparatus for creating an intelligent contract is provided, where the apparatus is applied to a management platform that performs management on node devices of a blockchain, and a system resource and a virtual resource carried by a node device of a blockchain are subjected to value anchoring; the device comprises:
the system comprises an acquisition unit, a block chain client and a block chain management unit, wherein the acquisition unit is used for acquiring an intelligent contract creation transaction triggered by the block chain client, and the intelligent contract creation transaction comprises an intelligent contract code and an account storage capacity which is requested by a user and corresponds to the intelligent contract;
a sending unit, configured to send the intelligent contract creation transaction to the blockchain, so that a node device of the blockchain executes the intelligent contract creation transaction, and an intelligent contract account corresponding to the intelligent contract code is created in the blockchain;
a calculating unit, configured to calculate a first amount of the virtual resource anchored with a system resource value of a node device of the blockchain consumed for processing the intelligent contract creation transaction after the node device of the blockchain executes the intelligent contract creation transaction, so that the virtual resource account of the user is deducted by the first amount of the virtual resource; wherein the processing system resources of the node devices of the blockchain consumed by the smart contract creation transaction includes account storage resources allocated in the node devices for the smart contract based on the account storage capacity requested by the user.
According to a fifth aspect of one or more embodiments of the present specification, there is provided a computer apparatus comprising: a memory and a processor; the memory having stored thereon a computer program executable by the processor; the processor executes the computer program to execute the method for creating the intelligent contract executed by the management platform according to the embodiment of the first aspect.
According to a sixth aspect of one or more embodiments of the present specification, there is provided a computer apparatus comprising: a memory and a processor; the memory having stored thereon a computer program executable by the processor; when the computer program is executed by the processor, the method for creating the intelligent contract executed by the management platform according to the embodiment of the second aspect is executed.
Based on the method, the apparatus, and the computer device for creating an intelligent contract described in one or more embodiments above, the system resources hosted by the node devices of the block chain may be value-anchored with the virtual resources, so that the system resources of the node devices of the block chain consumed by the intelligent contract creation transaction (including the account storage resources allocated for the intelligent contract based on the account storage capacity requested by the user) may be processed based on the node devices, the first number of virtual resources may be anchored, and the management platform performing management on the node devices of the block chain may charge the first number of virtual resources, thereby achieving the effects of quantifying the block chain system resources consumed by the intelligent contract creation transaction, and charging the corresponding virtual resource fees to the user based on the quantified block chain system resources.
Drawings
FIG. 1 is a schematic diagram of creating an intelligent contract provided by an exemplary embodiment;
FIG. 2 is a schematic diagram of invoking an intelligent contract, provided by an exemplary embodiment;
FIG. 3 is a schematic diagram of creating an intelligent contract and invoking an intelligent contract provided by an exemplary embodiment;
FIG. 4 is a flowchart diagram of a method for creating an intelligent contract, provided by an exemplary embodiment;
FIG. 5 is a schematic diagram of an apparatus for creating an intelligent contract for application to a node device side of a blockchain according to an exemplary embodiment;
fig. 6 is a schematic diagram of an apparatus for creating an intelligent contract applied to a node device side of a blockchain according to yet another exemplary embodiment;
fig. 7 is a hardware block diagram of an embodiment of a creation apparatus for running an intelligent contract provided by the present specification.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. The following description refers to the accompanying drawings in which the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with one or more embodiments of the present specification.
It should be noted that: in other embodiments, the steps of the corresponding methods are not necessarily performed in the order shown and described herein. In some other embodiments, the methods may include more or fewer steps than those described herein. Moreover, a single step described in this specification may be broken down into multiple steps in other embodiments; multiple steps described in this specification may be combined into a single step in other embodiments.
The block chain or block chain network described in one or more embodiments of the present specification may specifically refer to a P2P network system having a distributed data storage structure, where each node device achieves through a common recognition mechanism, and the book data in the block chain is distributed within temporally consecutive "blocks", where the latter block may include a data digest of the former block, and achieves full backup of data of all or part of nodes according to a difference of the particular common recognition mechanism (e.g., POW, POS, DPOS, or PBFT).
Blockchains are generally divided into three types: public chain (Public Blockchain), private chain (Private Blockchain) and alliance chain (Consortium Blockchain). Furthermore, there may be a combination of the above types, such as private chain + federation chain, federation chain + public chain, and so on.
Among them, the most decentralized is the public chain. The public chain is represented by bitcoin and ether house, and participants (also called nodes in the block chain) joining the public chain can read data records on the chain, participate in transactions, compete for accounting rights of new blocks, and the like. Moreover, each node can freely join or leave the network and perform related operations.
Private chains are the opposite, with the network's write rights controlled by an organization or organization and the data read rights specified by the organization. Briefly, a private chain may be a weakly centralized system with strict restrictions on nodes and a small number of nodes. This type of blockchain is more suitable for use within a particular establishment.
A federation chain is a block chain between a public chain and a private chain, and "partial decentralization" can be achieved. Each node in a federation chain typically has a physical organization or organization corresponding to it; the nodes are authorized to join the network and form a benefit-related alliance, and block chain operation is maintained together.
It is contemplated that the embodiments provided herein can be implemented in any suitable type of blockchain network.
The computing device may construct the data into a standard transaction (transaction) format supported by the blockchain, then issue the transaction to the blockchain, perform consensus processing on the received transaction by the node devices in the blockchain, and package the transaction into a block by the node devices serving as accounting nodes in the blockchain after the consensus is achieved, and perform persistent evidence storage in the blockchain.
Regardless of which consensus algorithm is adopted by the block chain, the accounting node can pack the received transaction to generate a latest block and send the latest block to other node devices for consensus verification. If the latest block is received by other node equipment and no problem is proved, the latest block can be added to the tail of the original block chain, so that the accounting process of the block chain is completed. The transactions contained in the block may also be performed during the process of the other nodes verifying the new block sent by the accounting node.
It should be noted that, each time a block chain generates a latest block, after a transaction in the latest block is executed, the corresponding status of the executed transactions in the block chain changes accordingly, for example, in the block chain structured by an account model, the account status of an external account or an intelligent contract account usually changes correspondingly with the execution of the transaction.
For example, when a "transfer transaction" is completed in a block, the balances of the transferring party account and the transferring party account associated with the "transfer transaction" (i.e., the field values of the Balance fields of these accounts) are usually changed.
For another example, the "intelligent contract call transaction" in the block is used to call an intelligent contract deployed on the blockchain, call the intelligent contract in the EVM corresponding to the node device to execute the "intelligent contract call transaction", and update the account status of the intelligent contract account in the account of the intelligent contract after the execution of the intelligent contract call transaction.
In practical applications, whether public, private, or alliance, it is possible to provide the functionality of an intelligent contract (Smart contract). An intelligent contract on a blockchain is a contract on a blockchain that can be executed triggered by a transaction. An intelligent contract may be defined in the form of code.
Taking an Etherhouse as an example, a user is supported to create and call some complex logic in the Etherhouse network. The ethernet workshop is used as a programmable block chain, and the core of the ethernet workshop is an ethernet workshop virtual machine (EVM), and each ethernet workshop node can run the EVM. The EVM is a well-behaved virtual machine through which various complex logic can be implemented. The user issuing and invoking smart contracts in the etherhouse is running on the EVM. In fact, EVM runs directly virtual machine code (virtual machine bytecode, hereinafter simply "bytecode"), so the intelligent contract deployed on the blockchain may be bytecode.
After Bob sends a Transaction (Transaction) containing information to create a smart contract to the ethernet network, each node can execute the Transaction in the EVM, as shown in fig. 1. The From field of the transaction in the figure is used To record the address of the account initiating the creation of the intelligent contract, the contract code held in the field value of the Data field of the transaction may be bytecode, and the field value of the To field of the transaction is a null account. After the nodes reach the agreement through the consensus mechanism, the intelligent contract is successfully created, and the follow-up user can call the intelligent contract.
After the intelligent contract is established, a contract account corresponding to the intelligent contract appears on the block chain, and the block chain has a specific address; for example, "0x68e12cf284 \8230" in each node in fig. 1 represents the address of the contract account created; the contract Code (Code) and account store (Storage) will be maintained in the account store for that contract account. The behavior of an intelligent contract is controlled by contract code, while the account storage of the intelligent contract preserves the state of the contract. In other words, an intelligent contract causes a virtual account to be created on a blockchain that includes contract code and account storage.
As mentioned above, the Data field containing the transaction that created the intelligent contract may hold the byte code of the intelligent contract. A bytecode consists of a series of bytes, each of which may identify an operation. Based on the multiple considerations of development efficiency, readability and the like, a developer can select a high-level language to write the intelligent contract code instead of directly writing the byte code. For example, the high-level language may employ a language such as Solidity, serpent, LLL, and the like. For intelligent contract code written in a high-level language, the intelligent contract code can be compiled by a compiler to generate byte codes which can be deployed on a blockchain.
Taking the Solidity language as an example, the contract code written by it is very similar to a Class (Class) in the object-oriented programming language, and various members including state variables, functions, function modifiers, events, etc. can be declared in one contract. A state variable is a value permanently stored in an account Storage (Storage) field of an intelligent contract to save the state of the contract.
As shown in FIG. 2, still taking the EtherFang as an example, after Bob sends a transaction containing the information of the calling intelligent contract to the EtherFang network, each node may perform the transaction in the EVM. The From field of the transaction in the figure is used for recording the address of the account initiating the intelligent contract calling, the To field is used for recording the address of the intelligent contract called, and the Data field of the transaction is used for recording the method and parameters for calling the intelligent contract. After invoking the smart contract, the account status of the contract account may change. Subsequently, a client may check the account status of the contract account through the accessed block link points, for example, the account status may be stored in the Storage tree of the intelligent contract in the form of a Key-Value pair. The results of the execution of the transaction that invoked the smart contract may be stored in the MPT receipt tree in the form of a transaction receipt (receipt).
The intelligent contract can be independently executed at each node in the blockchain network in a specified mode, and all execution records and data are stored on the blockchain, so that after the transaction is executed, transaction certificates which cannot be tampered and lost are stored on the blockchain.
A schematic diagram of creating an intelligent contract and invoking the intelligent contract is shown in fig. 3. An intelligent contract is created in an Ethernet workshop and needs to be subjected to the processes of writing the intelligent contract, changing the intelligent contract into byte codes, deploying the intelligent contract into a block chain and the like. Calling the intelligent contract in the Ethernet workshop initiates a transaction pointing to the intelligent contract address, the EVM of each node can respectively execute the transaction, and the intelligent contract code is operated in a virtual machine of each node in the Ethernet workshop in a distributed mode.
For accounts in a blockchain, the account status of the account is usually maintained through a structure. When a transaction in a block is executed, the status of the account associated with the transaction in the block chain is also typically changed.
Taking etherhouses as an example, the structure of an account usually includes fields such as Balance, nonce, code and Storage. Wherein:
a Balance field for maintaining the current account Balance of the account;
a Nonce field for maintaining a number of transactions for the account; the counter is used for guaranteeing that each transaction can be processed only once, and replay attack is effectively avoided;
a Code field for maintaining a contract Code for the account; in practical applications, only the hash value of the contract Code is typically maintained in the Code field; thus, the Code field is also commonly referred to as a Codehash field.
A Storage field for maintaining the Storage contents of the account (default field value is null); for a contract account, a separate storage space is usually allocated to store the storage content of the contract account; this separate storage space is often referred to as the account storage of the contract account. The storage content of the contract account is usually constructed into a data structure of an MPT (media Patricia Trie) tree and stored in the independent storage space; in which, the Storage content based on the contract account is constructed into an MPT tree, which is also commonly referred to as a Storage tree. Whereas the Storage field typically maintains only the root node of the Storage tree; thus, the Storage field is also commonly referred to as the Storage root field.
Wherein, for the external account, the field values of the Code field and the Storage field shown above are both null values.
For most blockchain models, merkle trees are typically used; alternatively, the data is stored and maintained based on the data structure of the Merkle tree. Taking etherhouses as an example, the etherhouses use MPT tree (a Merkle tree variation) as a data organization form for organizing and managing important data such as account status, transaction information, and the like.
The Etherhouse designs three MPT trees, namely an MPT state tree, an MPT transaction tree and an MPT receipt tree, aiming at data needing to be stored and maintained in a block chain. In addition to the three MPT trees, there is actually a Storage tree constructed based on the Storage content of the contract account.
An MPT state tree, which is an MPT tree organized by account state data of all accounts in a blockchain; an MPT transaction tree, which is an MPT tree organized by transaction (transaction) data in a blockchain; the MPT receipt tree is organized into transaction (receipt) receipts corresponding to each transaction generated after the transactions in the block are executed. The hash values of the root nodes of the MPT state tree, the MPT transaction tree, and the MPT receipt tree shown above are eventually added to the block header of the corresponding block.
The MPT transaction tree and the MPT receipt tree correspond to the blocks, namely each block has the MPT transaction tree and the MPT receipt tree. For the MPT transaction tree, the MPT receipt tree and the MPT state tree which are organized, the MPT transaction tree, the MPT receipt tree and the MPT state tree are finally stored in a Key-Value type database (such as a levelDB) which adopts a multi-level data storage structure.
In the public chain field, partial nodes contribute to storage and consensus resources, but do not obtain corresponding benefits. In token-free (token) blockchain models, such as alliance chains, especially in an open alliance chain environment, how to count blockchain resources provided by node devices and cover corresponding node costs is also an urgent problem to be solved. Currently, there is no method for resource management and charging for users of the blockchain based on the use or occupation of blockchain resources.
In view of the above, one or more embodiments of the present specification provide a variety of resource charging approaches in a blockchain system. It is contemplated that the embodiments provided herein can be implemented in any suitable type of blockchain network, including public, alliance, private, etc.
The management platform according to one or more embodiments provided in this specification may include a platform that is provided in or connected to each node device of the blockchain, so as to manage each node device of the blockchain. Optionally, the management platform includes a cloud computing management platform, and correspondingly, the node device of the block chain includes a virtual machine created on a physical host managed by the cloud computing management platform.
The blockchain client described in one or more embodiments provided in this specification may be connected to a node device of a blockchain through the management platform, so as to send a transaction to a blockchain network or obtain a transaction execution result in the blockchain network based on communication with the management platform.
In the blockchain provided in this specification, the management platform performs value anchoring on system resources and virtual resources carried by a node device of the blockchain.
The virtual resources may include digitized forms of real assets circulating under the blockchain, such as assets in the form of currency, real estate, stocks, bonds, loan contracts, notes, accounts receivable, and the like; and may also include block chain assets having a value anchoring relationship with the off-chain real assets held by the user, and may issue virtual resources anchored with the frozen real assets and capable of circulating on the chain by freezing real-world real assets (including assets in the form of currency, real property, stock, loan contracts, bills, accounts receivable, etc.) on the chain.
When the method is realized, the user client side can perform an asset freezing exchange process with the management platform, freeze a certain amount of real assets and send a freezing certificate to the management platform; after receiving the frozen voucher, the management platform can instruct the node device to add virtual resources corresponding to the frozen real asset amount value to the balance of the user's blockchain account on the blockchain based on the frozen voucher.
The virtual resource corresponding to the frozen real asset amount value is added into the balance of the user's blockchain account based on the frozen certificate, and the method can be further realized by the interaction of the user and an intelligent contract: the management platform triggers a virtual resource exchange transaction sent to a blockchain network, wherein the virtual resource exchange transaction comprises the asset freezing voucher; responding to the virtual resource exchange transaction, the node equipment of the blockchain calls a virtual resource exchange contract deployed on the blockchain, executes the resource exchange logic declared by the intelligent contract, and adds virtual resources corresponding to the real asset amount value frozen by the asset freezing voucher into the account balance of the blockchain of the user.
Based on the mode, the user can obtain virtual resources which can be anchored with the value of the real assets in the block chain network based on the real assets held by the user, and the virtual resources can be expressed as the balance of the account on the chain of the user.
In the block chain network system, the system resources provided by the node devices of the block chain for the block chain service can be value-anchored with the virtual resources. For example, the storage resources provided by the node device for the data on the blockchain may perform value anchoring with the virtual resources, and the blockchain data per storage unit capacity may obtain the virtual resources corresponding thereto; for another example, the CPU computational resources provided by the node device for executing any transaction on the blockchain may perform value anchoring with the virtual resources, and each CPU instruction set of the execution unit number may obtain the virtual resources corresponding thereto; for another example, the node device may perform value anchoring with the virtual resource for a network resource provided by broadcast or consensus of any transaction on the block chain, and may obtain the corresponding virtual resource based on network traffic consumed in the broadcast or consensus process of the uplink transaction.
The block chain developer or the management platform may quantify the system resources in the form of the storage resources, the computing resources, the network resources, and the like, and price the number of virtual resources corresponding to each unit of the storage resources, the computing resources, the network resources, or the system resources in other forms in the block chain network. For a federation chain, whose federation members are relatively fixed, the system resource pricing resulting from the anchoring can remain fixed for a longer period of time; for a public link system, it is more frequent that a node enters or exits a blockchain network, and after unit pricing is performed on the system resources in various forms by a blockchain developer, real-time virtual resource transfer is performed based on the blockchain scale when a user uses a blockchain, or periodic virtual resource transfer is performed according to a shorter period. Those skilled in the art can also perform virtual resource deduction for the user for the blockchain service provided by the blockchain node device based on any form of system resource having a value anchoring relationship with the virtual resource from the actual cost requirement, which is not limited in this specification.
As shown in fig. 4, the intelligent contract creation method provided in an exemplary embodiment of the present specification, executed by the management platform, may include:
The embodiment does not limit the identity of the builder of the intelligent contract creation transaction described above. In an illustrated embodiment, the intelligent contract creation transaction may be constructed by the blockchain client, and after construction, based on a trigger operation of a user at the client, the intelligent contract creation transaction is sent to the management platform, so that the management platform forwards the transaction to a blockchain network after acquiring the intelligent contract creation transaction.
In yet another illustrated embodiment, the blockchain client may send the intelligent contract code to a management platform to trigger the management platform to construct an intelligent contract creation transaction based on the intelligent contract code and send the intelligent contract creation transaction constructed by the management platform to a blockchain network.
The user-requested account storage capacity corresponding to the intelligent contract comprises a capacity of storage resources allocated by the user-requested node device for an intelligent contract account created based on the intelligent contract code. In yet another illustrated embodiment, the blockchain system may provide a default account storage capacity for the intelligent contract account, at which time, the fields included in the intelligent contract creation transaction and corresponding to the user-requested account storage capacity corresponding to the intelligent contract may be empty to perform, by the node device, calculation of the amount of virtual resources that can be deducted (as set forth in step 404) and allocation of storage resources based on the default account storage capacity.
The process of processing the intelligent contract creation transaction by the node devices of the blockchain may include one or more of receiving, forwarding (broadcasting) the intelligent contract creation transaction, performing consensus verification on the intelligent contract creation transaction, virtual resource transfer, executing the intelligent contract creation transaction, creating an intelligent contract account corresponding to the intelligent contract code, and including the intelligent contract creation transaction in a new block or the like. Because the value of the system resources carried by the node devices is anchored with the virtual resources, and the node devices of the block chain provide the system resources of the node devices in the whole process of processing the intelligent contract creation transaction, the management platform can calculate and determine the virtual resources with the first quantity anchored with the system resource value of the quantity based on the quantity of the system resources consumed or provided by the node devices in the process of processing the intelligent contract creation transaction.
Specifically, the above-mentioned system resources of the node device consumed for processing the intelligent contract creation transaction may include the account storage capacity requested by the user, the account storage resources allocated by the node device of the block chain for the intelligent contract, for example, the management platform may price the storage resources provided by the node device: m (virtual resource unit)/Gb, the user requests the storage capacity of NGb for the account of the intelligent contract in the intelligent contract creation transaction, and the management platform may calculate the first amount of virtual resources anchored to the storage resource value of the node device consumed to process the intelligent contract creation transaction, including: m N (virtual resource units).
It is noted that the pricing of the storage resource provided by the node device by the management platform may be related to the number of nodes of the blockchain system, and it is expected that the more node devices of the blockchain, the more total amount of the storage resource actually occupied by the created intelligent contract account, and therefore, the blockchain system may adjust the pricing per unit of the storage resource charged to the user based on the number of the node devices.
Based on the specific setting of the block chain system, the first amount of the virtual resources charged to the user may cause the node device to permanently provide the storage resource of the NGb for the account of the intelligent contract, and may also cause the node device to provide the storage resource of the NGb for the account of the intelligent contract within a preset effective duration.
To customize the specific length of time that a node device may provide storage resources for an account of a smart contract based on the needs of a user, in yet another illustrated embodiment, the smart contract creation transaction further comprises: the effective duration corresponding to the account storage capacity requested by the user; the effective duration of the storage resources carried by the node equipment is subjected to value anchoring with the virtual resources released on the block chain; accordingly, calculating the amount of virtual resources that are anchored to the account storage resource value includes: calculating the number of virtual resources anchored to the account storage resources and the expiration date value.
For example, the blockchain system may price the storage resources provided by the node devices: m (virtual resource unit)/Gb/day, the storage capacity of NGb and the effective duration of one year are requested for the account of the intelligent contract by the user in the intelligent contract establishing transaction; the step of calculating, by the management platform, a first amount of virtual resources anchored to the value of the storage resources of the node device consumed for processing the smart contract creation transaction comprises: m × N × 365 (virtual resource unit).
It is noted that the field corresponding to the validity duration corresponding to the account storage capacity requested by the user, which is included in the smart contract creation transaction, may be null, so that the management platform performs the calculation of the first amount of the virtual resource based on the validity duration default by the blockchain system.
In yet another illustrative embodiment, the system resources of the node device consumed for processing the intelligent contract creation transaction may further include computing resources of the node device consumed for processing the intelligent contract creation transaction, or network resources.
The computing resources may include the number of instructions in the CPU instruction set that are consumed by the node device to execute the smart contract creation transaction. For example, the blockchain system (or the management platform) may price the computing resources provided by the node devices: m (virtual resource units)/instructions, the management platform may first calculate the number N of instructions in the CPU instruction set consumed to execute the intelligent contract creation transaction, and then calculate a first number of virtual resources corresponding to the N instructions, anchored to the value of the computational resources of the node device consumed to process the intelligent contract creation transaction: m N (virtual resource units).
The network resource may include blockchain network traffic consumed in broadcasting, consensus, etc. transmission of the intelligent contract creation transaction, and the network resource is positively correlated to the number of nodes in the blockchain. For example, the blockchain system (or management platform described above) may price the network resources provided by the node devices: m (virtual resource units)/mega traffic, the management platform may first calculate a total network traffic N mega consumed to execute the intelligent contract creation transaction, and then calculate a first number of virtual resources corresponding to the N mega traffic, anchored to the network resource value of the node device consumed to process the intelligent contract creation transaction: m N (virtual resource units).
In this embodiment, the form of the system resource is not specifically limited, and in addition to the computing resource, the network resource, the storage resource, and the storage duration, the management platform may perform value anchoring with the form of the system resource and the virtual resource based on other forms of system resources of the block link node device consumed in the process of creating the intelligent contract, so that a corresponding amount of virtual resources is deducted from the virtual resource account of the user based on the form of system resource consumption in the process of creating the intelligent contract.
In an illustrated embodiment, a calculation model for calculating the amount of the virtual resource anchored by the system resource value of the node device consumed for processing the intelligent contract creation transaction may be deployed in the management platform, and after the management platform obtains the intelligent contract creation transaction triggered by the blockchain client, the management platform may calculate, based on invoking the calculation model, a first amount of the virtual resource anchored by the system resource value and consumed for processing the intelligent contract creation transaction. The system resource may include one or more of the storage resources, storage durations, computing resources, network resources, and other resource forms described in the foregoing embodiments.
Alternatively, an intelligent contract (hereinafter referred to as a resource computation contract) for computing virtual resource consumption for the intelligent contract creation transaction may be further deployed on the blockchain, and the contract code of the resource computation contract includes execution logic including resource computation logic for computing a first amount of virtual resources that are value-anchored to system resources of the node device consumed for processing the intelligent contract creation transaction;
accordingly, the above embodiments wherein the management platform calculates the first amount of the virtual resource anchored to the system resource value of the node device of the blockchain consumed by processing the smart contract creation transaction, comprise:
invoking the resource computation contract, executing the resource computation logic, computing a first amount of the virtual resource anchored to a system resource value of a node device consumed to execute the smart contract creation transaction.
It should be noted that, when the management platform invokes the resource calculation intelligent contract to execute the resource calculation logic, a Local Transaction (Local Transaction or Local call) may be constructed in response to the intelligent contract creation Transaction, and the resource calculation intelligent contract deployed on the blockchain is invoked locally to determine the first amount of the virtual resource anchored by the system resource value of the node device consumed for executing the intelligent contract creation Transaction. At this time, the management platform may obtain the call execution result of the resource computation contract locally without the need to identify the call execution result of the resource computation contract on the blockchain.
Specifically, when the computing resources, network resources, storage resources, or storage durations consumed by the node devices of the blockchain to process the intelligent contract creation transaction all account for the computing process of system resource consumption, the content, included in the resource computing logic deployed by the computing model or the resource computing contract, of the first amount of the virtual resources anchored to the system resource value of the node devices consumed to process the intelligent contract creation transaction may include:
calculating a second amount of computing resources of the node device consumed for processing the smart contract creation transaction and determining a third amount of the virtual resources anchored to the second amount of computing resource value; the computing resources may comprise the number of instructions in a CPU instruction set consumed by the node device to process the smart contract creation transaction;
calculating a fourth amount of network resources of the node device consumed for processing the smart contract creation transaction and determining a fifth amount of the virtual resources that are anchored with the fourth amount of network resource value; the network resource may include a blockchain network traffic consumed in broadcasting, consensus, etc. transmission of the transaction, the network resource being positively correlated to a number of nodes of the blockchain;
calculating a sixth amount of the virtual resource anchored to the account storage capacity value within the validity duration of the user request;
based on the third quantity, the fifth quantity, and the sixth quantity, a sum of virtual resources anchored to system resource values of node devices consumed to process the smart contract creation transaction may be determined to be a sum of the third quantity, the fifth quantity, and the sixth quantity.
The virtual resource account of the user is an account storing the same type of resources as the virtual resources; when the virtual resource is an out-of-chain real resource, the virtual resource account may include a currency account (such as a bank account), or a virtual currency or virtual point account that is established on the management platform by the user and exchanged by using currency; when the virtual resource is a virtual resource issued on a blockchain, the virtual resource account may include a user's blockchain account.
When the virtual resource account of the user is a money account, the entity that deducts the first amount of virtual resources from the virtual resource account of the user may be a financial institution such as a bank, and may transfer the deducted first amount of virtual resources to a money account corresponding to a management platform; when the virtual resource account of the user is a virtual coin or a virtual point account established on the management platform, an entity for deducting the first amount of virtual resources from the virtual resource account of the user may be the management platform; when the virtual resource account of the user is a blockchain account, the entity that performs deduction of the first amount of virtual resources from the virtual resource account of the user may be a node device of a blockchain, and may transfer the deducted first amount of virtual resources to a blockchain account corresponding to a management platform.
The present embodiment does not limit the execution subject, the deduction timing, and the specific manner of deducting the first amount of virtual resources from the virtual resource account of the user.
The management platform sends the intelligent contract creating transaction to a blockchain, so that the intelligent contract creating transaction can be broadcasted in the blockchain network, subjected to consensus verification, and executed by node equipment of the blockchain after the consensus verification is passed, so as to create an intelligent contract account corresponding to the intelligent contract code in a state database of the blockchain.
As previously described, a structure of a smart contract account may generally include fields such as Balance, nonce, code, and Storage. A Balance field for maintaining the current account Balance of the account; a Nonce field for maintaining a number of transactions for the account; the counter is used for guaranteeing that each transaction can be processed only once, and effectively avoids replay attack; a Code field for maintaining a contract Code for the account; in practice, only the hash value of the contract Code is typically maintained in the Code field (the Code of the smart contract is then stored in the block in which the smart contract-creating transaction described above is recorded).
A Storage field for maintaining the Storage content of the account; for a contract account, a separate storage space is usually allocated to store the storage content of the contract account; this separate storage space is often referred to as the account storage of the contract account. The storage content of the contract account is usually constructed into a data structure of an MPT (media Patricia Trie) tree and stored in the independent storage space; in which, the Storage content based on the contract account is constructed into an MPT tree, which is also commonly referred to as a Storage tree. Whereas the Storage field typically maintains only the root node of the Storage tree; thus, the Storage field is also commonly referred to as the StorageRoot field.
When the intelligent contract account corresponding to the intelligent contract code is created in the blockchain (for example, the MPT status tree), the node device may record a transaction receipt (receive) including an execution result of the intelligent contract creation transaction in the MPT receipt tree of the blockchain, and then the management platform may return a prompt that the intelligent contract creation is successful to the blockchain client based on the transaction receipt.
Based on the method for creating an intelligent contract according to one or more embodiments, the value of the system resource carried by the node device of the block chain may be anchored with the virtual resource, so that the node device system resource of the block chain consumed by the transaction created based on the intelligent contract processed by the node device may be anchored with the first amount of virtual resource, and the first amount of virtual resource is deducted from the virtual resource account of the user, thereby optimizing and utilizing the block chain resource and effectively preventing the waste of the system resource on the block chain.
It should be noted that the execution sequence of steps 404, 406 and 408 is not limited in the above embodiment.
In an illustrated embodiment, after acquiring an intelligent contract creation transaction triggered by a blockchain client, a management platform calculates a first quantity of the virtual resources anchored with system resource values of node devices of the blockchain consumed for processing the intelligent contract creation transaction; after obtaining the message that the first amount of virtual resources are deducted from the virtual resource account of the user, sending the intelligent contract creation transaction to the blockchain, so that the node device of the blockchain executes the intelligent contract creation transaction, creating an intelligent contract account corresponding to the intelligent contract code in the blockchain, and allocating account storage resources for the intelligent contract account based on the account storage capacity.
The management platform may send a payment instruction of the first amount of virtual resources to the user client after calculating the first amount of virtual resources anchored to the system resource value of the node device of the block chain consumed for processing the smart contract creation transaction.
For example, the user client may push a cash payment page on a user interface of the client, so that the deduction of the first amount of virtual resources from the cash account of the user is completed by a financial institution corresponding to the cash account of the user in response to payment verification information (e.g., a numeric password, and biological identification information) input by the user at the client.
For another example, the user client may push, on a user interface of the client, a virtual point payment page circulated on the management platform, where the virtual point is obtained by the user exchanging money with cash on the management platform, and the virtual point is stored in a virtual point account opened by the user on the management platform, so that, in response to payment verification information (e.g., a digital password, biometric identification information) input by the user on the client, the management platform deducts the first amount of virtual resources from the virtual point account of the user on the management platform.
When the virtual resource is a virtual resource issued on a blockchain, the management platform may construct a page for the transfer transaction on the blockchain, which is pushed on a user interface of the client, so that the blockchain client may further send the transfer transaction to the blockchain through the management platform, so that after the transfer transaction is verified by the blockchain, the node device of the blockchain deducts the virtual resource of the first quantity from the blockchain account of the user, or deducts the virtual resource of the first quantity from the blockchain account of the user and transfers the virtual resource of the first quantity to the blockchain account corresponding to the management platform. And then, the management platform can acquire a message whether the transfer transaction is successfully executed from the node equipment.
If the deduction process fails due to the fact that the number of the virtual resources held by the virtual resource account of the user is smaller than the first number, or the management platform does not acquire a message that the virtual resource account of the client user is deducted by the first number of the virtual resources within a preset time limit, the management platform may return a prompt that the execution of the intelligent contract creation transaction fails to the blockchain client.
It should be noted that, because the system resources consumed by the node device to execute the intelligent contract creation transaction include various forms such as computing resources, network resources, storage resources, and the like, some resource forms may be calculated based on the code of the intelligent contract before the intelligent contract creation transaction is executed, and some resource forms may be accurately known only after the intelligent contract creation transaction is executed. Thus, the first amount of virtual resources to be deducted, as described in step 406 of this embodiment, may be based on an estimate of system resources that may need to be consumed to execute the smart contract-creation transaction; the management platform may further monitor, after the intelligent contract creation transaction is successfully executed, actual system resource loss of the statistical node device in the process of processing the intelligent contract creation transaction, to check whether system resources consumed by the intelligent contract after creation are obviously inconsistent with estimated system resources, so as to perform corresponding virtual resource supplement or return operation, which is not limited in this specification.
In yet another illustrated embodiment, after acquiring the intelligent contract creation transaction triggered by the blockchain client, the management platform performs step 408, and sends the intelligent contract creation transaction to the blockchain, so that the node device of the blockchain executes the intelligent contract creation transaction, creates an intelligent contract account corresponding to the intelligent contract code, and temporarily stores the intelligent contract account and a transaction receipt (receive) corresponding to the intelligent contract creation transaction in a memory; the management platform then performs step 404 to calculate a first amount of the virtual resources anchored to the system resource value of the node device of the block chain consumed for processing the smart contract creation transaction, so as to deduct the first amount of the virtual resources from the virtual resource account of the user.
In the above process of calculating and processing the first amount of the virtual resource anchored by the system resource value of the node device of the block chain consumed by the intelligent contract creation transaction, the management platform may perform statistical calculation on the system resource actually consumed by the node device of the block chain to process the intelligent contract creation transaction, for example, the management platform communicates with each node device to obtain the storage resource capacity actually occupied by the intelligent contract account and the calculation resource actually consumed by executing the intelligent contract creation transaction, which are statistically recorded by each node device, and may also perform statistical calculation on the network resource consumed by transmitting the intelligent contract creation transaction in the block chain network.
When the virtual resource is an entity asset outside a block chain, or the management platform issues circulating credits or tokens anchored to an entity asset, after learning that the node device temporarily stores the smart contract account and a transaction receipt (receive) corresponding to the smart contract creation transaction in a memory, the management platform may issue an instruction to pay the first amount of the virtual resource to the client, for example, push a cash money payment page on a user interface of the client, issue a circulating virtual credit payment page by the management platform, in response to payment verification information (such as a digital password and biometric identification information) input by the user at the client, complete deduction of the first amount of the virtual resource from the cash money account of the user by a financial institution corresponding to the cash money account of the user, or from the virtual credit account of the user at the management platform by the management platform. When the virtual resource is currency cash, the first amount of virtual resource may be transferred to a currency-cash account corresponding to the management platform.
If the first amount of virtual resources are successfully deducted from the cash money account of the user or the virtual resources held by the virtual points account of the management platform by the user, the node equipment can create the intelligent contract account in a blockchain and save a transaction receipt (receipt) generated after the intelligent contract creation transaction is executed in an MPT receipt tree of the blockchain; at this time, the management platform may return a prompt to the blockchain client that the execution of the intelligent contract creation transaction is completed (for example, the intelligent contract creation is successful);
if the amount of the cash money account of the user or the virtual resources held by the virtual points account of the management platform by the user is less than the first amount or the first amount of the virtual resources are not successfully deducted within a preset payment period, the management platform can instruct the node equipment to delete the intelligent contract account stored in the memory and a transaction receipt (receipt) indicating that the intelligent contract creation transaction is successfully executed; at this time, the management platform may return a prompt that the execution of the intelligent contract creation transaction fails to the blockchain client.
When the virtual resource is a virtual resource issued on a blockchain, the intelligent contract creation transaction may further include an account identifier of a blockchain account of the user. The account identifier is an account identifier of a user account from which the first amount of virtual resources is deducted for creation of the smart contract; the account identification may include the account identification of the intelligent contract creation transaction publisher, and may also include account identifications of other users specified by the intelligent contract creation transaction publisher. The type of the account corresponding to the account identifier may include an external account, or may also include an intelligent contract account, for example, a creation transaction for another intelligent contract is initiated by an intelligent contract that has been created in the block chain, which is not limited in this embodiment.
In this embodiment, after the node device temporarily stores the smart contract account and a transaction receipt (receive) corresponding to the smart contract creation transaction in the memory, the node device may deduct the first amount of virtual resources from the blockchain account specified by the smart contract creation transaction including the account identifier, or deduct the first amount of virtual resources from the blockchain account specified by the smart contract creation transaction including the account identifier, and add the first amount of virtual resources to the blockchain account corresponding to the management platform.
If the first amount of virtual resources are successfully deducted from the virtual resources held by the blockchain account corresponding to the account identifier, the node equipment can create the intelligent contract account in the blockchain and store a transaction receipt (receive) generated after the intelligent contract creation transaction is executed in an MPT receipt tree of the blockchain; at this time, the management platform may return a prompt to the blockchain client that the execution of the intelligent contract creation transaction is completed (for example, the intelligent contract creation is successful);
if the amount of the virtual resources held by the blockchain account corresponding to the account identifier is smaller than the first amount, the node device cannot deduct the first amount of the virtual resources from the blockchain account corresponding to the account identifier, and at this time, the node device may delete the intelligent contract account stored in the memory and a transaction receipt (receipt) indicating that the intelligent contract creation transaction is successfully executed; at this time, the management platform may return a prompt to the blockchain client that the execution of the intelligent contract creation transaction failed.
Or, when the amount of the virtual resources held by the virtual resource account is less than the first amount and the first amount of the virtual resources cannot be deducted in a sufficient amount, the management platform may instruct the node device to temporarily store the transaction receipt, send a balance supplement reminder to the blockchain client, after the blockchain client completes balance supplement on the user account, perform deduction of the first amount of the virtual resources, and after successful deduction, create an intelligent contract account corresponding to the intelligent contract code in the blockchain, and store the transaction receipt (receipt) in an MPT receipt tree of the blockchain, so that the management platform returns a prompt of completion of creation of the transaction of the intelligent contract to the blockchain client.
In another embodiment, when the virtual resource is a virtual resource issued on a blockchain, the process of broadcasting, consensus verification, and execution of the creation transaction of the smart contract in the blockchain may specifically include:
after receiving the intelligent contract establishing transaction sent by the blockchain client, the node equipment can broadcast and transmit the intelligent contract establishing transaction in a blockchain network;
after receiving the intelligent contract establishing transaction, the consensus node in the block chain can perform consensus verification on the intelligent contract establishing transaction;
if consensus verification for the smart contract creation transaction passes, a node device of a blockchain may deduct a first amount of virtual resources from a blockchain account corresponding to a user identification based on the first amount of virtual resources anchored to a value of system resources of the blockchain node device consumed to process the smart contract creation transaction; and creating an intelligent contract account in the blockchain that corresponds to the intelligent contract code.
In this embodiment, in order to reduce the waste of system resources of a node device due to a failure of creating the intelligent contract caused by an insufficient balance of virtual resources in the blockchain account corresponding to the user identifier for paying the first amount of virtual resources required to be transferred for processing the intelligent contract creation transaction, the consensus verification process performed by the consensus node of the blockchain may include: verifying whether the quantity of virtual resources held by the blockchain account corresponding to the user identification contained in the intelligent contract creation transaction is not less than a preset threshold value.
The preset threshold may be a fixed virtual resource value set by the blockchain developer for the transaction of the intelligent contract creation type, for example, the preset threshold may be set based on the minimum system resource consumption for executing the transaction of the intelligent contract creation type or the amount of virtual resources anchored by the average system resource consumption; under the condition, in order to successfully create the intelligent contract, the virtual resource quantity meeting the preset threshold value needs to be held in the blockchain account corresponding to the user identifier, so that when the virtual resource quantity in the blockchain account corresponding to the user identifier is less than the preset threshold value, a prompt that the consensus verification fails is directly returned, and system resources consumed by processing the transaction created by the intelligent contract after the node equipment is in the consensus verification stage are avoided.
In some embodiments, although the smart contract creation transaction passes the consensus verification including that the balance of the user account is not less than the preset threshold, the transaction execution may fail due to the fact that the first amount of the virtual resource determined by the calculation is greater than the balance of the blockchain account corresponding to the user identifier, the account storage capacity corresponding to the smart contract requested by the user is too large, or the logic of the smart contract is too complex.
Optionally, the consensus verification may further include the process of calculating and processing the first amount of the virtual resource anchored by the system resource value of the node device of the block chain consumed by the intelligent contract creation transaction in step 404, for example, when the underlying protocol of the block chain deploys a calculation model for calculating the amount of the virtual resource anchored by the system resource value of the node device of the block chain consumed by processing the intelligent contract creation transaction, when the consensus node acquires the intelligent contract creation transaction, the first amount of the virtual resource to be deducted from the user account based on the creation of the intelligent contract may be acquired based on the calculation model, and in this case, the preset threshold may be the first amount of the virtual resource determined by the calculation process, so that the consensus node of the block chain performs the consensus verification based on the first amount of the virtual resource delivered for processing the intelligent contract creation transaction directly in the consensus verification, thereby providing more precise consensus verification and increasing the success rate of executing the contract creation transaction by the consensus verification.
In one or more embodiments, after the management platform learns that the virtual resource account of the user is successfully deducted by the first amount of virtual resources, the management platform may hold the virtual resource account of the first amount of virtual resources, which is allocated to the user or mechanism entity corresponding to the node device of the block chain based on a preset period (including real-time or periodically), so as to complete allocation of virtual resources to the user or mechanism entity providing system resources in the block chain system.
The present embodiment does not limit the specific manner in which the virtual resources are allocated. For example, the management platform may allocate the received currency cash or the currency cash corresponding to the deducted virtual credits to a currency cash account of a user or institution entity corresponding to the node device of the blockchain, or the management platform may allocate virtual resources issued on the chain received in the blockchain account to a blockchain account of a user or institution entity corresponding to the node device of the blockchain, and then, in response to a redemption request of the user or institution, redeem the virtual resources allocated in the blockchain account thereof to entity assets outside the chain, and perform logout processing on the redeemed virtual resources on the chain.
The rule for allocating the first amount of virtual resources to the blockchain account corresponding to each node device in the blockchain in the present specification is not particularly limited. For example, the node device may averagely allocate the deducted virtual resources of the first quantity to virtual resource accounts of users or institution entities corresponding to the node devices of the block chain to hold the virtual resources.
Or, based on the storage medium performance attribute of the account storage resource allocated to the intelligent contract by each node device of the block chain, the virtual resource accounts allocated to the users or the mechanism entities corresponding to each node device of the block chain from the first number of virtual resources are respectively held. For example, since the storage media of the node devices are configured differently, the blockchain system may rank the storage media of each node device based on the storage media performance attribute (e.g., hard disk performance attribute such as hdd, ssd, or nvm) of each node device obtained by monitoring each node device, thereby allocating a higher proportion of virtual resources to the node device providing a high-level storage medium and allocating a lower proportion of virtual resources to the node device providing a low-level storage medium.
In one or more of the above embodiments, the management platform may maintain the status of the account storage resources that the block link node device may allocate to the intelligent contract account, for example, the remaining storage capacity of the account storage, and/or the remaining effective duration corresponding to the account storage resources; for saving the blockchain storage resources, the node device may not maintain the account storage resource status of the intelligent contract account; and the node equipment receives and executes the intelligent contract creating transaction or the subsequent calling transaction of the intelligent contract sent by the management platform without actually reserving the account storage capacity corresponding to the intelligent contract requested by the user for the intelligent contract account.
In the duration of the intelligent contract, the user may correspondingly extend or reduce the capacity of the storage resource allocated by the node device to the intelligent contract according to the actual demand, and/or correspondingly extend or reduce the effective duration corresponding to the account storage resource, so as to change the state of the remaining storage capacity of the account storage resource allocated by the node device of the block chain maintained in the management platform to the intelligent contract account, and/or the state of the remaining effective duration corresponding to the account storage resource.
Since the data capacity actually stored in the intelligent contract account changes correspondingly after the call transaction of the intelligent contract is executed, for example, when the call transaction of the intelligent contract is used to store the business data in the intelligent contract account, after the call transaction of the intelligent contract is executed, the storage capacity actually occupied in the intelligent contract account is further increased by the storage data, so that the residual storage capacity maintained in the management platform (as maintained in the intelligent contract account or in the management contract account) is not enough to support the storage capacity actually increased by the intelligent contract account.
Therefore, another illustrative embodiment of the present specification further provides a method for invoking an intelligent contract, including:
the management platform receives an intelligent contract calling transaction sent by a blockchain client;
verifying whether the remaining storage capacity maintained in the management platform is lower than a preset threshold; the preset threshold value can comprise a default and residual storage capacity threshold value set by the management platform for the transaction of the intelligent contract calling transaction type, or the management platform calculates the storage capacity of an intelligent contract account which is preset based on a preset storage resource occupation algorithm and is newly occupied by executing the intelligent contract calling transaction based on the intelligent contract calling transaction;
and/or verifying whether the remaining effective duration maintained in the management platform is lower than a preset threshold value; the preset threshold may comprise a default, remaining validity duration threshold (which may be zero) set by the blockchain system for transactions of the intelligent contract invocation transaction type;
if so, returning a prompt of failure in executing the calling transaction to the blockchain client side which sends the calling transaction;
if not, the intelligent contract calling transaction is sent to the block chain, so that the node equipment of the block chain executes the calling transaction of the intelligent contract, the occupation of the storage resource of the intelligent contract account is monitored after the execution of the calling transaction of the intelligent contract is completed, and the remaining storage capacity and/or the remaining effective duration of the intelligent contract account maintained in the management platform are/is updated.
Correspondingly, another illustrative embodiment of the present specification further provides a method for calling an intelligent contract, including:
the management platform receives an intelligent contract calling transaction sent by a blockchain client;
sending the intelligent contract calling transaction to the blockchain so that node equipment of the blockchain executes the intelligent contract calling transaction, and temporarily storing the state of the intelligent contract account after the intelligent contract calling transaction is executed and a transaction receipt of the intelligent contract calling transaction in a memory by the node equipment of the blockchain;
verifying whether the residual storage capacity of the intelligent contract account is lower than a preset threshold value after executing the intelligent contract calling transaction; the preset threshold may comprise a default, remaining storage capacity threshold (which may be zero) set by the blockchain system for transactions of the intelligent contract invocation transaction type;
and/or verifying whether the remaining effective duration is lower than a preset threshold value; the preset threshold may include a default, remaining valid duration threshold (which may be zero) set by the blockchain system for transactions of the intelligent contract invocation transaction type;
if so, indicating the node equipment of the blockchain to delete the state of the intelligent contract account and the transaction receipt of the intelligent contract calling transaction stored in the memory, and returning a prompt of failure execution of the calling transaction to the blockchain client sending the calling transaction;
if not, indicating the node equipment of the block chain to update the state of the intelligent contract account on the block chain, saving a transaction receipt of the intelligent contract calling transaction to an MPT receipt tree, and updating the residual storage capacity and/or the residual effective duration of the intelligent contract account maintained by the management platform.
In this embodiment, the node device executes the intelligent contract invocation transaction first to obtain the actual remaining storage capacity of the intelligent contract account after the transaction is executed, so that the management platform may verify whether the actual remaining storage capacity of the intelligent contract account is lower than a preset threshold after the intelligent contract invocation transaction is executed, and/or verify whether the remaining effective duration is lower than a preset threshold.
In yet another illustrated embodiment, an intelligent contract creator may set virtual resource transfer logic in execution logic corresponding to contract code of an intelligent contract to cause a node device of a blockchain to invoke a transaction in response to the intelligent contract, invoke the virtual resource transfer logic of the intelligent contract, deduct a virtual resource amount corresponding to the intelligent contract invocation transaction from a user account sending the invocation transaction, and allocate the virtual resource amount corresponding to the intelligent contract invocation transaction to the intelligent contract account or an administrative user account maintained by the intelligent contract.
Specifically, the virtual resource transfer logic of the intelligent contract may declare a virtual resource transfer rule corresponding to a called function type of the intelligent contract call transaction, or an anchor relationship between the new storage capacity occupation of the intelligent contract account and the value of the virtual resource after the intelligent contract call transaction is executed, and the like.
By the intelligent contract calling method, the user can call the execution of the transaction based on the intelligent contract sent by the user, and perform corresponding virtual resource transfer to the intelligent contract account or the management user account maintained by the intelligent contract, so that the user is prevented from calling the intelligent contract randomly, and the storage space management of the intelligent contract account is optimized; and because the intelligent contract can obtain a corresponding amount of virtual resources due to providing the intelligent contract calling service for the user, the intelligent contract developer is encouraged to develop a better intelligent contract calling service.
Based on the calling method of the intelligent contract provided by the embodiment, a user can allocate the residual storage capacity of the account storage resource to the intelligent contract through the node equipment maintained on the management platform; and/or performing authority control on whether the intelligent contract can be called or not according to the remaining effective duration corresponding to the account storage resource.
Based on the method for creating an intelligent contract according to one or more embodiments, the system resources hosted by the node devices of the block chain may be value-anchored with the virtual resources published on the block chain, so that the management platform may collect and allocate the first amount of virtual resources on behalf of the user or institution entity corresponding to the node devices of the block chain on the basis of the first amount of the virtual resources anchored by the system resource value of the node devices consumed for processing the intelligent contract creation transaction. The block chain resource allocation is optimized, block chain system resource waste caused by random establishment of intelligent contracts in a non-charging mode is prevented, and compared with the existing mode that only part of nodes charge transaction fees, each node device in the block chain is encouraged to contribute corresponding system resources in a fairer virtual resource allocation mode.
Corresponding to the above flow implementation, the embodiments of the present specification further provide apparatuses 50 and 60 for creating an intelligent contract. The means 50, 60 may be implemented by software, by hardware or by a combination of both. Taking a software implementation as an example, the logical device is formed by reading a corresponding computer program instruction into a memory for running through a Central Processing Unit (CPU) of the device. In terms of hardware, the device in which the apparatus is located generally includes other hardware such as a chip for transmitting and receiving wireless signals and/or other hardware such as a board for implementing a network communication function, in addition to the CPU, the memory, and the storage shown in fig. 7.
As shown in fig. 5, the present specification further provides an intelligent contract creation apparatus 50, which is applied to a management platform that performs management on node devices of a blockchain, where system resources and virtual resources carried by the node devices of the blockchain are value-anchored; the apparatus 50 comprises:
an obtaining unit 502, configured to obtain an intelligent contract creation transaction triggered by a blockchain client, where the intelligent contract creation transaction includes an intelligent contract code and an account storage capacity corresponding to an intelligent contract requested by a user;
a calculating unit 504 that calculates a first amount of the virtual resource anchored to a system resource value of a node device of the blockchain consumed for processing the smart contract creation transaction, such that the virtual resource account of the user is deducted by the first amount of the virtual resource; wherein the processing of system resources of node devices of the blockchain consumed by the smart contract creation transaction includes allocating account storage resources in a node device for the smart contract based on the account storage capacity requested by a user;
a sending unit 506, configured to send the intelligent contract creation transaction to the blockchain after the virtual resource account of the user is deducted by the first amount of virtual resources, so that a node device of the blockchain executes the intelligent contract creation transaction, and creates an intelligent contract account corresponding to the intelligent contract code in the blockchain.
In yet another illustrated embodiment, the apparatus 50 further comprises:
an allocating unit 508, configured to allocate the first amount of virtual resources to a user account corresponding to a node device of the block chain for holding.
In yet another illustrated embodiment, the allocating unit 508 is further configured to:
averagely distributing the first quantity of virtual resources to user accounts corresponding to the node devices of the block chain for holding;
or, based on the storage medium performance attribute of the account storage resource allocated to the intelligent contract by each node device of the block chain, allocating the first number of virtual resources to the user account corresponding to the node device of the block chain for holding.
In yet another illustrated embodiment, the smart contract creation transaction further comprises: the effective duration corresponding to the account storage capacity requested by the user;
the effective duration of the storage resources carried by the node equipment is subjected to value anchoring with the virtual resources released on the block chain;
the calculating unit 504 is further configured to:
calculating the number of virtual resources anchored to the account storage resources and the expiration date value.
In yet another illustrated embodiment, the management platform maintains a remaining storage capacity of account storage resources allocated by a node device for the intelligent contract; and/or the remaining effective duration corresponding to the account storage resource;
the device further comprises:
a verification unit 510, configured to verify whether the remaining storage capacity maintained in the blockchain is lower than a preset threshold in response to a call transaction initiated by a blockchain client for the smart contract; and/or whether the remaining effective duration is lower than a preset threshold value;
a returning unit 512, if yes, returning a prompt that the execution of the calling transaction fails to the blockchain client that sent the calling transaction;
if not, the updating unit 514 updates the remaining storage capacity and/or the remaining effective duration maintained in the management platform after executing the call transaction of the intelligent contract.
In yet another illustrative embodiment, the executing the invoking transaction of the smart contract comprises:
and calling virtual resource transfer logic of the intelligent contract, deducting the virtual resource quantity corresponding to the calling transaction from the user account sending the calling transaction, and distributing the virtual resource quantity corresponding to the calling transaction to the intelligent contract account or a management user account maintained by the intelligent contract.
In yet another illustrative embodiment, processing system resources of node devices of the blockchain consumed by the smart contract creation transaction includes:
processing computing resources of node devices of the blockchain consumed by the smart contract creation transaction; or,
processing network resources of node devices of the blockchain consumed by the smart contract creation transaction.
In yet another illustrated embodiment, the blockchain deploys resource computation contracts whose contract code contains execution logic that includes resource computation logic;
the calculating unit 504 further includes:
invoking the resource computation intelligence contract, executing the resource computation logic, computing the first amount of the virtual resource anchored to the system resource value of the node device of the blockchain consumed to process the intelligence contract to create the transaction.
In yet another illustrated embodiment, the apparatus 50 further comprises:
a returning unit 512, if the amount of virtual resources held in the virtual resource account of the user is smaller than the first amount, returns a prompt that the execution of the smart contract creation transaction fails to the blockchain client.
In yet another illustrated embodiment, the management platform comprises a cloud computing management platform; the node devices of the blockchain include virtual machines created on physical hosts managed by a cloud computing management platform.
The specific details of the implementation process of the function and the action of each unit in the apparatus 50 are described in the implementation process of the corresponding step in the intelligent contract creation method executed by the management platform, and the relevant points may be referred to the partial description of the method embodiment, which is not described herein again.
As shown in fig. 6, the present specification further provides an intelligent contract creation apparatus 60, which is applied to a management platform that performs management on node devices of a blockchain, where system resources and virtual resources carried by the node devices of the blockchain are value-anchored; the device comprises:
an obtaining unit 602, configured to obtain an intelligent contract creation transaction triggered by a blockchain client, where the intelligent contract creation transaction includes an intelligent contract code and an account storage capacity corresponding to an intelligent contract requested by a user;
a sending unit 604, configured to send the intelligent contract creation transaction to the blockchain, so that a node device of the blockchain executes the intelligent contract creation transaction, and creates an intelligent contract account corresponding to the intelligent contract code in the blockchain;
a calculating unit 606, configured to calculate a first amount of the virtual resource anchored to the system resource value of the node device of the blockchain consumed by processing the smart contract creation transaction, so that the virtual resource account of the user is deducted by the first amount of the virtual resource; wherein the processing system resources of the node devices of the blockchain consumed by the smart contract creation transaction includes account storage resources allocated in the node devices for the smart contract based on the account storage capacity requested by the user.
In yet another illustrated embodiment, the apparatus 60 further comprises:
an allocating unit 608 is configured to allocate the first amount of virtual resources to a user account corresponding to the node device of the block chain for holding.
In yet another illustrated embodiment, the assigning unit 608 is further configured to:
averagely distributing the first quantity of virtual resources to user accounts corresponding to the node devices of the block chain for holding;
or, based on the storage medium performance attribute of the account storage resource allocated to the intelligent contract by each node device of the block chain, allocating the first number of virtual resources to the user account corresponding to the node device of the block chain for holding.
In yet another illustrated embodiment, the smart contract creation transaction further comprises: the effective duration corresponding to the account storage capacity requested by the user;
the effective duration of the storage resources carried by the node equipment is subjected to value anchoring with the virtual resources released on the block chain;
the calculating unit 606 is further configured to:
calculating the number of virtual resources anchored with the account storage resources and the validity duration value.
In yet another illustrated embodiment, the management platform maintains a remaining storage capacity of account storage resources allocated by a node device for the intelligent contract; and/or the remaining effective duration corresponding to the account storage resource;
the apparatus 60 further comprises:
a verification unit 610, configured to verify whether the remaining storage capacity maintained in the blockchain is lower than a preset threshold in response to a call transaction initiated by a blockchain client for the intelligent contract; and/or whether the remaining effective duration is lower than a preset threshold value;
a returning unit 612, if yes, returning a prompt that the execution of the call transaction fails to the blockchain client that sent the call transaction;
if not, after executing the call transaction of the intelligent contract, the updating unit 614 updates the remaining storage capacity and/or the remaining effective duration maintained in the management platform.
In yet another illustrative embodiment, the executing the invoking transaction of the smart contract comprises:
and calling virtual resource transfer logic of the intelligent contract, deducting the virtual resource quantity corresponding to the calling transaction from the user account sending the calling transaction, and distributing the virtual resource quantity corresponding to the calling transaction to the intelligent contract account or a management user account maintained by the intelligent contract.
In yet another illustrative embodiment, processing system resources of node devices of the blockchain consumed by the smart contract creation transaction includes:
processing computing resources of node devices of the blockchain consumed by the smart contract creation transaction; or,
processing network resources of node devices of the blockchain consumed by the smart contract creation transaction.
In yet another illustrated embodiment, the blockchain deploys a resource computation contract, the contract code of the resource computation contract comprising execution logic including resource computation logic;
the calculating unit 606 is further configured to:
invoking the resource computation intelligence contract, executing the resource computation logic, computing the first amount of the virtual resource anchored to the system resource value of the node device of the blockchain consumed to process the intelligence contract to create the transaction.
In yet another illustrated embodiment, the virtual resource is a blockchain asset published on a blockchain anchored as value to an off-chain asset held by a user; the virtual resource account of the user comprises a blockchain account of the user;
the smart contract creation transaction may also include an account identification of the user's blockchain account.
In yet another illustrated embodiment, the apparatus 60 further comprises:
a returning unit 612, configured to, if the virtual resource account of the user is successfully deducted by the first amount of virtual resources, return a prompt that the creation of the intelligent contract is successful to the blockchain client based on a transaction receipt stored in a blockchain and corresponding to the transaction of the creation of the intelligent contract;
and if the quantity of the virtual resources held by the virtual resource account of the user is less than the first quantity, indicating the node equipment to delete a transaction receipt corresponding to the intelligent contract creation transaction, and returning a prompt of failure in creating the intelligent contract to the blockchain client.
In yet another illustrated embodiment, the management platform comprises a cloud computing management platform; the node devices of the blockchain include virtual machines created on physical hosts managed by a cloud computing management platform.
The specific details of the implementation process of the function and the role of each unit in the apparatus 60 are described in the implementation process of the corresponding step in the intelligent contract creation method executed by the management platform, and relevant parts may refer to the partial description of the method embodiment, which is not described herein again.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical modules, may be located in one place, or may be distributed on a plurality of 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 the specification. One of ordinary skill in the art can understand and implement it without inventive effort.
The apparatuses, units and modules illustrated in the above embodiments may be specifically implemented by a computer chip or an entity, or implemented by a product with certain functions. A typical implementation device is a computer, which may take the form of a personal computer, laptop computer, cellular telephone, camera phone, smart phone, personal digital assistant, media player, navigation device, email messaging device, game console, tablet computer, wearable device, or a combination of any of these devices.
Corresponding to the above method embodiment, an embodiment of the present specification further provides a computer device, as shown in fig. 7, including a memory and a processor. Wherein the memory has stored thereon a computer program executable by the processor; the processor, when executing the stored computer program, performs the steps of the intelligent contract creation method performed by the management platform in an embodiment of sending the intelligent contract creation transaction into the blockchain after the first amount of virtual resources is deducted from the user's virtual resource account. The detailed description of the steps of the intelligent contract creation method executed by the management platform is referred to the previous contents and will not be repeated.
Corresponding to the above method embodiment, the embodiment of the present specification further provides a computer device, as shown in fig. 7, including a memory and a processor. Wherein the memory has stored thereon a computer program executable by the processor; the processor, when executing the stored computer program, performs the steps of the intelligent contract creation method performed by the management platform in an embodiment in which the first amount of virtual resources is calculated after sending the intelligent contract creation transaction to the blockchain such that the first amount of virtual resources is deducted. The detailed description of the steps of the intelligent contract creation method executed by the management platform is referred to the previous contents and will not be repeated.
The above description is only a preferred embodiment of the present disclosure, and should not be taken as limiting the present disclosure, and any modifications, equivalents, improvements, etc. made within the spirit and principle of the present disclosure should be included in the scope of the present disclosure.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data.
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 Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrases "comprising a," "8230," "8230," or "comprising" does not exclude the presence of other like elements in a process, method, article, or apparatus comprising the element.
As will be appreciated by one skilled in the art, embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, embodiments of the present description may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present description may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and so forth) having computer-usable program code embodied therein.
Claims (16)
1. A method for establishing an intelligent contract is applied to a management platform for managing node equipment of a block chain, wherein value anchoring is carried out on system resources and virtual resources carried by the node equipment of the block chain; the method comprises the following steps:
acquiring an intelligent contract creation transaction triggered by a blockchain client, wherein the intelligent contract creation transaction comprises an intelligent contract code and an account storage capacity corresponding to an intelligent contract requested by a user;
calculating a first amount of the virtual resource anchored to a system resource value of a node device of the blockchain consumed to process the smart contract creation transaction; wherein the processing of system resources of node devices of the blockchain consumed by the intelligent contract creation transaction comprises allocating account storage resources in node devices for the intelligent contract based on the account storage capacity requested by a user and computing resources or network resources of node devices of the blockchain consumed by the processing of the intelligent contract creation transaction;
after the virtual resource account of the user is deducted by the first amount of virtual resources, sending the intelligent contract creation transaction to the blockchain to cause a node device of the blockchain to execute the intelligent contract creation transaction, creating an intelligent contract account corresponding to the intelligent contract code in the blockchain.
2. The method of claim 1, further comprising:
and allocating the first amount of virtual resources to a virtual resource account corresponding to the node equipment of the block chain for holding.
3. The method of claim 2, wherein said allocating the first amount of virtual resources to virtual resource accounts corresponding to node devices of the blockchain for holding comprises:
averagely distributing the first quantity of virtual resources to virtual resource accounts corresponding to the node devices of the block chain for holding;
or, based on the storage medium performance attribute of the account storage resource allocated to the intelligent contract by each node device of the block chain, allocating the first number of virtual resources to the virtual resource account corresponding to the node device of the block chain for holding.
4. The method of claim 1, the smart contract creation transaction further comprising: the effective duration corresponding to the account storage capacity requested by the user;
the effective duration of the storage resources carried by the node equipment is subjected to value anchoring with the virtual resources released on the block chain;
calculating the amount of virtual resources anchored to the account storage resource value, comprising:
calculating the number of virtual resources anchored to the account storage resources and the expiration date value.
5. The method of claim 4, wherein the management platform maintains a remaining storage capacity of account storage resources allocated by node devices for the intelligent contracts; and/or the remaining effective duration corresponding to the account storage resource;
the method further comprises the following steps:
verifying whether the remaining storage capacity maintained in the blockchain is below a preset threshold in response to a call transaction initiated by a blockchain client for the intelligent contract; and/or whether the remaining effective duration is lower than a preset threshold value;
if so, returning a prompt of failure in executing the calling transaction to the blockchain client side which sends the calling transaction;
if not, after executing the calling transaction of the intelligent contract, updating the residual storage capacity maintained in the management platform and/or the residual effective duration.
6. The method of claim 5, the executing the call transaction for the smart contract comprising:
and calling virtual resource transfer logic of the intelligent contract, deducting the virtual resource quantity corresponding to the calling transaction from the user account sending the calling transaction, and distributing the virtual resource quantity corresponding to the calling transaction to the intelligent contract account or a management user account maintained by the intelligent contract.
7. The method of claim 1, the blockchain deploying resource computation contracts, contract code of the resource computation contracts containing execution logic comprising resource computation logic;
the calculating a first amount of the virtual resource anchored to a system resource value of a node device of the blockchain consumed by processing the smart contract creation transaction includes:
invoking the resource computation intelligence contract, executing the resource computation logic, computing the first amount of the virtual resource anchored to the system resource value of the node device of the blockchain consumed to process the intelligence contract to create the transaction.
8. The method of claim 1, the virtual resource is a blockchain asset published on a blockchain with an out-of-chain asset held by a user anchored as value; the virtual resource account of the user comprises a blockchain account of the user;
the smart contract creation transaction may also include an account identification of the user's blockchain account.
9. The method of claim 1 or 8, further comprising:
before sending the intelligent contract creation transaction to the blockchain, if the virtual resource account of the user is not successfully deducted the first amount of virtual resources within a preset time limit, returning a prompt of failure in executing the intelligent contract creation transaction to the blockchain client.
10. The method of claim 1, the management platform comprising a cloud computing management platform; the node devices of the blockchain include virtual machines created on physical hosts managed by a cloud computing management platform.
11. A method for establishing an intelligent contract is applied to a management platform for managing node equipment of a block chain, wherein value anchoring is carried out on system resources and virtual resources carried by the node equipment of the block chain; the method comprises the following steps:
acquiring an intelligent contract establishing transaction triggered by a blockchain client, wherein the intelligent contract establishing transaction comprises an intelligent contract code and an account storage capacity corresponding to an intelligent contract requested by a user;
sending the intelligent contract creation transaction to the blockchain to cause a node device of the blockchain to execute the intelligent contract creation transaction, creating an intelligent contract account corresponding to the intelligent contract code in the blockchain;
after the node devices of the blockchain perform the intelligent contract creation transaction, calculating a first amount of the virtual resource anchored to the system resource value of the node devices of the blockchain consumed to process the intelligent contract creation transaction, such that the virtual resource account of the user is deducted by the first amount of the virtual resource; wherein the processing of the system resources of the node devices of the blockchain consumed by the intelligent contract creation transaction comprises the account storage capacity requested by a user, the account storage resources allocated by a node device for the intelligent contract, and the computing resources or network resources of the node devices of the blockchain consumed by the processing of the intelligent contract creation transaction; the management platform maintains the residual storage capacity of the account storage resources allocated by the node equipment for the intelligent contract.
12. The method of claim 11, wherein the first and second light sources are selected from the group consisting of,
if the virtual resource account of the user is successfully deducted by the first amount of virtual resources, returning a prompt that the intelligent contract is successfully created to the blockchain client based on a transaction receipt stored in a blockchain and corresponding to the intelligent contract creation transaction;
and if the quantity of the virtual resources held by the virtual resource account of the user is less than the first quantity, indicating the node equipment to delete a transaction receipt corresponding to the intelligent contract creation transaction, and returning a prompt of failure in the intelligent contract creation to the blockchain client.
13. The method of claim 12, prior to a node device executing the smart contract creation transaction, the method further comprising:
the node equipment broadcasts the intelligent contract creation transaction to a blockchain network to perform consensus verification on the intelligent contract creation transaction; wherein the consensus verification comprises: verifying whether the number of virtual resources held by the user account is not less than a preset threshold value;
if the consensus verification for the intelligent contract creation transaction passes, the node device executes the intelligent contract creation transaction.
14. A device for creating an intelligent contract is applied to a management platform for managing node equipment of a block chain, wherein system resources and virtual resources carried by the node equipment of the block chain are subjected to value anchoring; the device comprises:
the system comprises an acquisition unit, a block chain client and a block chain management unit, wherein the acquisition unit is used for acquiring an intelligent contract creation transaction triggered by the block chain client, and the intelligent contract creation transaction comprises an intelligent contract code and an account storage capacity which is requested by a user and corresponds to the intelligent contract;
a calculation unit to calculate a first amount of the virtual resource anchored to a system resource value of a node device of the blockchain consumed to process the smart contract creation transaction such that the user's virtual resource account is deducted the first amount of virtual resource; wherein the processing of system resources of node devices of the blockchain consumed by the intelligent contract creation transaction comprises allocating account storage resources in node devices for the intelligent contract based on the account storage capacity requested by a user and computing resources or network resources of node devices of the blockchain consumed by the processing of the intelligent contract creation transaction;
and a sending unit, configured to send the intelligent contract creation transaction to the blockchain after the virtual resource account of the user is deducted by the first amount of virtual resources, so that a node device of the blockchain executes the intelligent contract creation transaction, and creates an intelligent contract account corresponding to the intelligent contract code in the blockchain.
15. A device for creating an intelligent contract is applied to a management platform for managing node equipment of a block chain, wherein system resources and virtual resources carried by the node equipment of the block chain are subjected to value anchoring; the device comprises:
the intelligent contract creating method comprises the steps that an obtaining unit obtains an intelligent contract creating transaction triggered by a blockchain client, wherein the intelligent contract creating transaction comprises an intelligent contract code and an account storage capacity corresponding to an intelligent contract requested by a user;
a sending unit, configured to send the intelligent contract creation transaction to the blockchain, so that a node device of the blockchain executes the intelligent contract creation transaction, and an intelligent contract account corresponding to the intelligent contract code is created in the blockchain;
a calculating unit, configured to calculate a first amount of the virtual resource anchored with a system resource value of a node device of the blockchain consumed for processing the intelligent contract creation transaction after the node device of the blockchain executes the intelligent contract creation transaction, so that the virtual resource account of the user is deducted by the first amount of the virtual resource; wherein the processing of system resources of node devices of the blockchain consumed by the smart contract creation transaction includes allocating account storage resources in a node device for the smart contract based on the account storage capacity requested by a user, and computing resources or network resources of node devices of the blockchain consumed by the processing of the smart contract creation transaction.
16. A computer device, comprising: a memory and a processor; the memory having stored thereon a computer program executable by the processor; the processor, when executing the computer program, performs the method of any of claims 1 to 10 or 11 to 13.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210657495.XA CN115456772A (en) | 2020-10-20 | 2020-10-20 | Intelligent contract creating method and device |
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011126772.1A CN111967994B (en) | 2020-10-20 | 2020-10-20 | Intelligent contract creating method and device |
CN202210657495.XA CN115456772A (en) | 2020-10-20 | 2020-10-20 | Intelligent contract creating method and device |
Related Parent Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011126772.1A Division CN111967994B (en) | 2020-10-20 | 2020-10-20 | Intelligent contract creating method and device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115456772A true CN115456772A (en) | 2022-12-09 |
Family
ID=73387587
Family Applications (2)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210657495.XA Pending CN115456772A (en) | 2020-10-20 | 2020-10-20 | Intelligent contract creating method and device |
CN202011126772.1A Active CN111967994B (en) | 2020-10-20 | 2020-10-20 | Intelligent contract creating method and device |
Family Applications After (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011126772.1A Active CN111967994B (en) | 2020-10-20 | 2020-10-20 | Intelligent contract creating method and device |
Country Status (1)
Country | Link |
---|---|
CN (2) | CN115456772A (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113762939A (en) * | 2021-09-06 | 2021-12-07 | 支付宝(杭州)信息技术有限公司 | Asset management method and device based on block chain and electronic equipment |
CN113900592A (en) * | 2021-10-10 | 2022-01-07 | 普华云创科技(北京)有限公司 | Space presentation method and device based on block chain technology and electronic equipment |
CN114169875B (en) * | 2021-12-17 | 2024-06-21 | 中国电子科技网络信息安全有限公司 | Alliance chain GAS chain design method |
Family Cites Families (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20070027941A1 (en) * | 2005-07-27 | 2007-02-01 | International Business Machines Corporation | System, method, and service for enforcing resource utilization in a distributed system |
CN104239141B (en) * | 2014-09-05 | 2017-07-28 | 北京邮电大学 | Optimizing and scheduling task method based on workflow critical path in data center |
US11196551B2 (en) * | 2018-06-27 | 2021-12-07 | International Business Machines Corporation | Automated task management on a blockchain based on predictive and analytical analysis |
CN110458702A (en) * | 2019-07-15 | 2019-11-15 | 阿里巴巴集团控股有限公司 | Based on the virtual resource allocation method and device of block chain, electronic equipment |
CN110392052B (en) * | 2019-07-22 | 2021-05-25 | 中国工商银行股份有限公司 | Intelligent contract processing system and method for block chain |
CN110458631B (en) * | 2019-07-31 | 2020-11-10 | 创新先进技术有限公司 | Bill number distribution method and device based on block chain and electronic equipment |
CN110503534A (en) * | 2019-08-27 | 2019-11-26 | 山东大学 | Cloud computing service resource dynamic dispatching method and system based on price expectation |
-
2020
- 2020-10-20 CN CN202210657495.XA patent/CN115456772A/en active Pending
- 2020-10-20 CN CN202011126772.1A patent/CN111967994B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN111967994B (en) | 2022-04-22 |
CN111967994A (en) | 2020-11-20 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2021008122A1 (en) | Virtual resource allocation method and device employing blockchain, and electronic apparatus | |
US20210297368A1 (en) | Allocating virtual resource based on blockchain | |
US10986177B2 (en) | Systems and methods of self-forking blockchain protocol | |
CN112015823B (en) | Block chain data deleting method and device | |
CN111966538B (en) | Block chain data recovery method and device | |
CN110147990B (en) | Payment withholding subscription method and device based on block chain and electronic equipment | |
CN110458631B (en) | Bill number distribution method and device based on block chain and electronic equipment | |
CN111967995A (en) | Intelligent contract creating method and device | |
CN112015596B (en) | Block chain data recovery method and device | |
CN111966757B (en) | Method and device for managing storage space of intelligent contract account | |
CN110599323B (en) | Resource processing method and processing equipment | |
CN111967994B (en) | Intelligent contract creating method and device | |
CN112883109B (en) | Block chain-based digital commodity transaction method and device | |
CN112200567B (en) | Resource management method and device based on block chain and electronic equipment | |
CN112200571A (en) | Resource distribution method and device based on block chain and electronic equipment | |
CN112015576A (en) | Calling method and device of intelligent contract | |
CN112015822B (en) | Block chain data deleting method and device | |
CN112819616A (en) | Block chain-based original work transaction method and device and electronic equipment | |
CN112015577B (en) | Intelligent contract calling method and device | |
CN111966503B (en) | Method and device for managing storage space of intelligent contract account | |
CN111738724B (en) | Cross-border resource transfer authenticity auditing method and device, and electronic equipment | |
CN110443612B (en) | Block chain-based reimbursement expense segmentation method and device and electronic equipment | |
CN112766854A (en) | Block chain-based digital commodity transaction method and device | |
CN112200570A (en) | Resource distribution method and device based on block chain and electronic equipment | |
CN113034137A (en) | Data processing method and device based on block chain and related equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
TA01 | Transfer of patent application right |
Effective date of registration: 20241008 Address after: Room 803, floor 8, No. 618 Wai Road, Huangpu District, Shanghai 200010 Applicant after: Ant blockchain Technology (Shanghai) Co.,Ltd. Country or region after: China Address before: 310000 801-11 section B, 8th floor, 556 Xixi Road, Xihu District, Hangzhou City, Zhejiang Province Applicant before: Alipay (Hangzhou) Information Technology Co.,Ltd. Country or region before: China |
|
TA01 | Transfer of patent application right |