WO2022048436A1 - 区块链智能合约方法、电子设备、系统及计算机可读存储介质 - Google Patents

区块链智能合约方法、电子设备、系统及计算机可读存储介质 Download PDF

Info

Publication number
WO2022048436A1
WO2022048436A1 PCT/CN2021/112991 CN2021112991W WO2022048436A1 WO 2022048436 A1 WO2022048436 A1 WO 2022048436A1 CN 2021112991 W CN2021112991 W CN 2021112991W WO 2022048436 A1 WO2022048436 A1 WO 2022048436A1
Authority
WO
WIPO (PCT)
Prior art keywords
transaction
smart contract
smart
blockchain
output
Prior art date
Application number
PCT/CN2021/112991
Other languages
English (en)
French (fr)
Inventor
徐皓
Original Assignee
徐皓
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by 徐皓 filed Critical 徐皓
Priority to EP21863503.5A priority Critical patent/EP4209982A4/en
Publication of WO2022048436A1 publication Critical patent/WO2022048436A1/zh
Priority to US18/178,524 priority patent/US20230205764A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION 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/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2379Updates performed during online database operations; commit processing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/64Protecting data integrity, e.g. using checksums, certificates or signatures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION 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
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/40Authorisation, e.g. identification of payer or payee, verification of customer or shop credentials; Review and approval of payers, e.g. check credit lines or negative lists
    • G06Q20/401Transaction verification
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/12Applying verification of the received information
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2209/00Additional information or applications relating to cryptographic mechanisms or cryptographic arrangements for secret or secure communication H04L9/00
    • H04L2209/56Financial cryptography, e.g. electronic payment or e-cash
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/50Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using hash chains, e.g. blockchains or hash trees

Definitions

  • the present invention relates to the technical field of blockchain, in particular to a blockchain smart contract method, electronic device, system and computer-readable storage medium.
  • a smart contract is a computer protocol designed to inform, verify, or execute a contract. Smart contracts allow for trusted transactions without third parties that are traceable and irreversible. Blockchain technology can not only support programmable contracts, but also has the advantages of decentralization, non-tampering, transparent and traceable processes, and is naturally suitable for smart contracts. Ethereum was the first blockchain to support smart contracts.
  • Blockchain smart contracts are programs and data deployed on the blockchain, and users trigger the execution of smart contract programs by sending transactions containing calls to smart contracts to blockchain nodes (miners).
  • the miner After receiving the transaction, the miner executes the called smart contract program. If the smart contract program returns a successful execution result, the miner packs the transaction into the block and adds the block to the blockchain.
  • the user who sends the transaction does not have any control over the execution result of the smart contract except for the parameters of the smart contract invocation.
  • the smart contracts deployed by users may contain errors or even malicious code. If the execution result does not meet the caller's expectations due to the caller's misunderstanding of the smart contract, or the smart contract itself is wrong or malicious, the caller can only accept it, because once the smart contract is successfully executed, the caller cannot prevent the miner from transacting the transaction. Adding to a block becomes part of the blockchain record, which is immutable and irrevocable.
  • the present invention proposes a blockchain smart contract method, aiming to improve the above problems.
  • the present invention is implemented in this way, a blockchain smart contract method, the method specifically includes the following steps:
  • the node receives the smart transaction submitted by the user or the block sent by other nodes, and the block contains the smart transaction;
  • the node executes all smart contract calls in the smart transaction, and the smart contract adds input items to the transaction;
  • the node verifies the legality of the smart transaction.
  • the legality verification of the transaction includes verifying the integrity of the transaction after the execution of all smart contract calls;
  • An intelligent transaction is a transaction that contains a smart contract call, and an intelligent transaction can define user expectations in the output items of the transaction;
  • accepting the intelligent transaction will package the transaction into the current block; rejecting the intelligent transaction means giving up the intelligent transaction;
  • rejecting the smart transaction is refusing to add the block to the blockchain.
  • the node uses a virtual machine to interpret and execute the program of the smart contract, and the instruction set of the virtual machine includes: spending instructions, and the method for the virtual machine to interpret and execute the spending instructions includes the following steps: adding an input item to the input list of the smart transaction.
  • the instruction set of the virtual machine includes at least one of the following instructions: payment instruction, coinage instruction;
  • the method for interpreting and executing the payment instruction by the virtual machine includes the following steps: adding an output item to the output list of the intelligent transaction;
  • the method for the virtual machine to interpret and execute the coinage instruction includes the following steps: adding an output item to the output list of the current block coinbase transaction.
  • script in the output item is called by another smart contract.
  • the output items included in the payment instruction data are added to the output list of the smart transaction.
  • the output item includes a new token in the coinage instruction data.
  • the method for the virtual machine to interpret and execute the spending instruction further includes the following steps:
  • the input item is the data in the spending instruction.
  • the virtual machine verifies whether the input item is owned by the smart contract. Only when the verification result is yes, the input item is added to the input list of the smart transaction.
  • the present invention is implemented in this way, a blockchain system, the system includes several nodes and terminal equipment, the terminal equipment can send intelligent transactions to nodes, nodes can send blocks to other nodes, and nodes receive intelligent transactions or blocks After that, execute the smart contract method of the blockchain as described above.
  • the present invention is realized by an electronic device including a memory, a processor and a computer program stored in the memory and executable on the processor, the processor implements the above-mentioned blockchain when executing the program smart contract method.
  • the present invention is implemented by a computer-readable storage medium storing a program for implementing the smart contract method of the blockchain as described above.
  • Smart contracts provide the appropriate input to satisfy the user's desired outcome.
  • the miner verifies that the input provided by the smart contract meets the user's desired result. In the sense of contract law, this is equivalent to verifying whether the two parties agree. Only verified transactions will be accepted by the blockchain. Therefore, the smart contract using the method of the present invention is more in line with the legal definition of a contract. Can refuse to accept the result of smart contract execution that does not meet user expectations.
  • FIG. 1 is a schematic structural diagram of a blockchain system provided by an embodiment of the present invention.
  • FIG. 2 is a flowchart of a smart contract method of a blockchain provided by an embodiment of the present invention.
  • Figure 1 is a blockchain system consisting of one or more network terminals (S102) connected to the Internet (S101) and one or more blockchain nodes (S103) connected to the Internet (S101).
  • the network terminal (S102) constructs a transaction according to the user input, and sends the transaction information to the nodes of the blockchain through the Internet (S101) (S103).
  • Each blockchain node (S103) can receive transaction information from the network terminal (S102) and blocks from other nodes (S103).
  • a transaction consists of a list of inputs and a list of outputs. Each output of a transaction includes a token. Tokens are expressions of value.
  • each input of a transaction contains a reference to the output of another transaction; in other blockchain implementations, using account accounting, each input of a transaction Contains a token and address.
  • the node (S103) verifies whether the received transaction is legal, including verifying that the input token of the transaction is an unused token in the blockchain; the transaction has proper authorization.
  • unused tokens refer to the tokens in the transaction output that are not referenced by any transaction as input; for those using the account accounting method In terms of blockchain, unused tokens refer to tokens in the account of the input address.
  • the node (S103) packages the legal transactions received within a period of time to generate a block, adds the block to the local blockchain as the latest block of the blockchain, and sends the data to other nodes in the network through the network (S101). (S103) Broadcast. After the node (S103) receives the new block from other nodes (S103), it verifies that all transactions in the received block are legal. If all transactions are verified as valid, the block is added to the end of the local blockchain as the latest block of the blockchain.
  • Verifying the legitimacy of a transaction includes verifying the integrity of the transaction.
  • a smart contract on the blockchain includes the smart contract program (code) stored on the blockchain and data describing its state. Users can submit transactions containing smart contract calls to nodes, called smart transactions.
  • the Expert Advisor submitted by the user can be incomplete, that is, the total value of the input and the total value of the output can be different.
  • the method includes the following steps:
  • Miners receive smart transactions submitted by users; smart transactions are transactions involving smart contract calls; users include people or electronic devices connected to nodes locally or through the network; user expectations are defined in the output of smart transactions ;
  • the node executes all smart contract calls in the smart transaction; during the execution process, the smart contract adds input items to the smart transaction to which it belongs;
  • the node verifies the legitimacy of the smart transaction, including verifying the integrity of the smart transaction;
  • the miner accepts the smart transaction; accepting the smart transaction includes adding the smart transaction to the current block; if the smart transaction is illegal, the miner abandons the smart transaction.
  • the current block is a new block that miners are building. After miners package a certain number of legal transactions (including ordinary transactions without smart contract calls) into the current block, they add the current block to the local blockchain and broadcast it to the entire network.
  • Another embodiment of the present invention is a blockchain smart contract method.
  • Other nodes can transmit new blocks to the node, which contain smart transactions.
  • the method includes the following steps:
  • the miner ie, the node receives the block transmitted by other nodes, and the block contains the intelligent transaction; the block is called the current block;
  • the node executes all smart contract calls in the smart transaction; user expectations are defined in the output item of the smart transaction; during the execution process, the smart contract adds input items to the smart transaction to which it belongs;
  • the node verifies the legitimacy of the smart transaction, including verifying the integrity of the smart transaction;
  • the miner will add the current block to the local blockchain.
  • the node if the execution result of any smart contract invocation is failure, the node abandons the smart transaction; if the smart transaction belongs to a new block sent by other nodes, the node abandons the new block.
  • the verification of the legitimacy of the smart transaction includes: verifying the signature for the original input item, preventing double spending and verifying the integrity of the transaction; the original input item refers to the input item included in the smart transaction submitted by the user, not the smart contract added to the smart transaction
  • the double-spending block includes verifying that all inputs of the smart transaction (including those added in the execution of the smart contract) refer to unused transaction outputs
  • double-spending prevention includes verifying that all inputs of the smart transaction (including those added in the execution of the smart contract) are not greater than the account balance; legal transactions must be complete; verifying the integrity of transactions is included in the smart transaction After the execution of all smart contract calls in the smart transaction is completed, it is verified that the total value of all input tokens of the smart transaction is equal to the total value of the output tokens, and the transaction fee is taken into account if necessary.
  • the transaction includes a set of inputs and a set of outputs.
  • Each output of the transaction includes a token and a script.
  • the script includes an output address. If the output address is a smart contract address, the output item is a call to the smart contract.
  • the script also Include the parameters for calling the smart contract.
  • a smart transaction is a transaction that contains the output of a smart contract invocation.
  • a smart transaction can contain multiple output items containing smart contract calls, and miners sequentially execute the smart contract calls in the smart transaction.
  • input or output items can be added to the current smart transaction, or output items can be added to the current block coin base transaction.
  • transactions stored in the blockchain contain inputs and outputs added by the smart contract.
  • the receiving node since the receiving node will execute the smart contract invocation in the transaction and generate the input and output items added by the smart contract, in order to reduce data transmission, when transferring blocks, the The transaction contains only the original input and output items, not the input and output items added by the smart contract.
  • the transmission block contains the input and output items added by the smart contract, in order to avoid double calculation when verifying the integrity of the transaction, it is necessary to strip the input and output items added by the smart contract before executing the smart contract. Therefore, it is necessary to distinguish which input/output items are original (ie submitted by the user) in the smart transaction and which are added by the smart contract.
  • One way to do this is to add quarantined items to the input/output list, adding a quarantined item to the corresponding list before adding an input/output item to the Expert Advisor for the first time.
  • the input/output items before the quarantined item in the list are the original input/output items, and the ones added by the intelligence after that.
  • Another way is to add a flag to the input/output item that indicates whether the item is original or added by a smart contract.
  • the coinbase transaction is the first transaction of the block, which is not submitted by users, but generated by nodes (miners).
  • the transaction has no inputs, only outputs.
  • coinbase transactions are used to record rewards to miners and fees received by miners.
  • the coin base transaction is also used to record the new token created by the smart contract.
  • nodes contain virtual machines that can interpret and execute smart contract programs.
  • the smart contract program is a sequence of virtual machine instructions, and the method for the miner to execute the smart contract program includes starting the virtual machine to interpret and execute the called smart contract program.
  • Starting the virtual machine includes reading the smart contract program from the blockchain according to the smart contract address in the smart contract call to be executed, and setting the initial virtual machine according to the smart contract call parameters and the token in the transaction output item to which the smart contract call belongs. state, read an instruction in the smart contract program determined according to the initial state and interpret and execute the instruction.
  • a virtual machine is a program that interprets and executes smart contract instructions. Instructions include instruction code and data. The script defines the function to be performed. Each instruction code thus represents a class of instructions. All the instruction types that a virtual machine can process make up the virtual machine's instruction set.
  • the virtual machine reads an instruction in the smart contract program, interprets and executes the instruction, reads the next instruction of the smart contract program according to the virtual machine state after interpretation and execution, and repeats this cycle until the instruction execution fails or the execution reaches the end instruction. If the instruction execution fails, the virtual machine returns the result of the execution failure to the miner. If the end command is executed, the virtual machine returns the result of execution success or failure to the miner according to the state of the virtual machine at the end or the data of the end command.
  • the virtual machine can add new input items and/or output items to the smart transaction that caused the execution of the program.
  • One embodiment of the present invention is a blockchain smart contract virtual machine whose instruction set includes a spending instruction. A new input is added to the current transaction when the virtual machine interprets and executes the spend instruction.
  • Another embodiment of the present invention is a blockchain smart contract virtual machine, the instruction set of the virtual machine includes a delivery instruction, and a new output item is added to the current transaction when the virtual machine executes the delivery instruction.
  • the data of the spending instruction includes the data of the input items.
  • the virtual machine interprets and executes the spend instruction, it verifies that the input is owned by the called smart contract.
  • verifying that the called smart contract owns the input includes verifying that the address in the script of the transaction output referenced by the input is called smart contract address.
  • verifying that the called smart contract owns the input includes verifying that the address of the input is the address of the called smart contract and that the smart contract account balance is not less than the input value. If the verification is successful, the input item is added to the input list of the current transaction, and the instruction is executed successfully.
  • the data for the delivery order includes an output that includes a token and script.
  • the virtual machine executes the delivery instruction, it verifies that the content of the token and the script is legal. If the verification is successful, the output item is added to the output list of the current transaction, and the instruction is successfully executed.
  • the virtual machine instruction set further includes a minting instruction.
  • the coinage instruction is an instruction to create a token out of thin air.
  • the data for the minting order includes a token.
  • an output item containing the token is added to the output list of the block's coinbase transaction.
  • the script address in the output item is the address of the called smart contract.
  • the data of the minting instruction further includes an address, and the script address in the output item is the address.
  • the token is added to the account balance of the called smart contract when the virtual machine executes the minting instruction.
  • the data of the coinage instruction further includes an address, and the token is added to the account balance of the address when the virtual machine executes the coinage instruction.
  • the node verifies the legitimacy of the transaction.
  • legality verification includes conditions such as verifying signatures, preventing double-spending, and total output not being greater than total input.
  • the transaction to be verified includes the input amount and output items added to the transaction during the execution of all smart contract programs, and the tokens in the transaction can have multiple Therefore, the validity verification includes: verifying the signature for the original input, preventing double-spending, and verifying the integrity of the transaction after the execution of all smart contract calls.
  • a legitimate transaction must be complete, i.e. the total token value of the transaction input and the total token value of the output (after taking transaction fees into account) are equal.
  • Nodes package legal transactions into blocks, add legal blocks to the local blockchain and broadcast them to other nodes.
  • the token is a numerical value.
  • the token data includes two items of token type and token value.
  • the value item of the token can be one of the following three types:
  • a value for example, the value 5 represents 5 bitcoins;
  • a geometry for example, a polygon represents a piece of land; the geometry in the token is not limited to polygons, but can be polyhedrons, or any mathematical geometry, such as spheres, surfaces, and so on.
  • a unique value is an identification of an indivisible thing.
  • the token type is identified by a type identifier. For example, if two tokens are both numerical tokens, but have different type identifiers, they are still regarded as different types of tokens, so they Not additive. Similarly, if two tokens are polygon tokens, but have different type identifiers, they are still regarded as different types of tokens, so their polygons cannot be merged.
  • the token also includes a stake set. That is, the token contains three data items: token type identifier, token value and equity set.
  • an input item of a transaction contains a reference to an output item of another transaction. We call the tokens in the referenced outputs input tokens.
  • the account bookkeeping method is adopted, and the input item of the transaction includes a token and an address. We call this token an input token.
  • transactions on the blockchain need to pay miners transaction fees as a reward for processing transactions.
  • Transaction fees may be paid in an express manner or in an implied manner.
  • the so-called explicit method means that an output item paid to the miner is explicitly included in the transaction.
  • the so-called implied method means that the total input value of the transaction is greater than the total output value of the transaction, and the difference is the transaction fee, which is recorded in the currency base transaction.
  • verifying the integrity of the transaction includes verifying that the sum of the input tokens is equal to the sum of the tokens of the output (after accounting for transaction fees).
  • verifying the integrity of the transaction includes verifying that for each token type, the total input and output tokens are equal (after accounting for transaction fees).
  • the total amount is the sum of the numerical values.
  • the total amount is the combined geometry.
  • the total is the number of each unique value.
  • verifying the integrity of the transaction includes verifying that for each token type, splitting and merging input tokens and output tokens separately, verifying the split and combined input token set and output A token group contains the same token.
  • the blockchain uses UTXO bookkeeping.
  • a smart contract S which accepts a value token of type A, and generates a type B token whose value is 10 times the value of the type A token to the caller.
  • the smart contract uses byte data when calculating the value of the B-type token. Therefore, when the result is greater than 256, an overflow will occur and the high-order data will be lost. The faulty smart contract was deployed on the blockchain.
  • the result of contract execution is stored in a data structure inside the contract.
  • this smart contract it is the mapping relationship from address to token, that is, Balance.
  • another programmer could use another data structure to represent and store the results of execution.
  • these data structures are also stored on the blockchain, nodes can only provide data read and write operations, and it is impossible to understand and process these data, so the execution results cannot be verified. In traditional smart contracts, this data can only be understood and processed through smart contracts.
  • the user invokes the smart contract by initiating a transaction.
  • the transaction data includes: user address (ie, sender in the code), input token (ie, parameter in in the code), user signature, and smart contract address (ie, S in the code).
  • user address ie, sender in the code
  • input token ie, parameter in in the code
  • user signature ie, S in the code
  • smart contract address ie, S in the code
  • the smart contract will correctly add 10 times that value of the Class B token to the caller's account. But when the token is a Class A token worth more than 25, the smart contract will add the wrong number of Class B tokens to the caller's account. For example, when the smart contract is called with Token ⁇ type:A, value:26 ⁇ , the balance of the type B token in the user account is not increased by 260, but by 4. Due to the successful return of the contract, the error result, as the internal state of the smart contract, will become an unalterable legal transaction record in the blockchain, and the user therefore loses the value of 256 Class B tokens.
  • the smart contract would have code similar to the following:
  • the smart contract contains the same error and returns success when an error occurs. Therefore, the node does not know that there is a problem with the smart contract itself.
  • the user invokes the smart contract by submitting a transaction.
  • the user X has an unused transaction output Utxo, whose output point (out point, which is a reference to the transaction output) is U, and Utxo contains a type A token with a value of 26.
  • the user wants to exchange the Utxo for a B-type token with a value of 260.
  • This expectation can be reflected by including an output item in the transaction.
  • the output item’s token is a B-type token with a value of 260, and the script is the address. Lockout script for user X.
  • the user can initiate a transaction whose ID is Tx1, and the transaction data includes the following set of inputs and outputs.
  • Output 1 represents the user's expectations.
  • the node After the node receives the transaction, it first verifies that SigScript can unlock the locked script in Utxo. If it passes the verification, the node checks whether the output of the transaction contains a smart contract call, and if so, calls the virtual machine to execute the smart contract call. Because the script address of the transaction output 0 is the smart contract address, the node runs the virtual machine, calls the smart contract S with Token ⁇ type:A,value:25 ⁇ as the parameter, and executes the above smart contract code.
  • the coinage instruction p Mint(Token ⁇ type:B,value:t ⁇ ) is executed
  • the coin base transaction adds an output token as Token ⁇ type:B,value:4 ⁇
  • the lock script is the output item of the smart contract address S
  • the output point of the returned output item is the p value.
  • p ⁇ Coin base transaction ID, 1 ⁇ .
  • the address of the output lock script is the current smart contract address, so the verification is passed. After the verification is passed, the virtual machine adds p to the input of the current transaction, and returns the result of the successful execution of the contract.
  • the new coinbase transaction content is as follows:
  • transaction Tx1 The content of transaction Tx1 becomes:
  • the node further verifies the legitimacy of the current transaction. Including: verifying that the output points in all input items refer to unused transaction outputs, and verifying that the total amount of input and output of various tokens is the same by token type.
  • the tokens they contain are A-type tokens with a value of 26 and B-type tokens with a value of 4 (due to a program error). certificate.
  • There are two output items in Tx1, and the tokens they contain are A-type tokens with a value of 26 and B-type tokens with a value of 260. Because the total amount of input and output of the B-type token is different, the node determines that the transaction is illegal and will not package the transaction into the blockchain, so it will not cause any loss to the user.
  • the smart contract does not store the execution result as the internal state of the contract on the blockchain, but explicitly expresses the execution result by adding input/output to the transaction, and miners can Understand and process transaction input and output data. Therefore, the user can express the desired result by specifying the output item in the transaction initiated by him. In the sense of contract law, this is an expression of meaning. Smart contracts provide the appropriate input to satisfy the user's desired outcome. The miner verifies that the input provided by the smart contract meets the user's desired result. In the sense of contract law, this is equivalent to verifying whether the two parties agree. Only verified transactions will be accepted by the blockchain. Therefore, the smart contract using the method of the present invention is more in line with the legal definition of a contract. Can refuse to accept the result of smart contract execution that does not meet user expectations.
  • Smart contracts can call other smart contracts. We call such calls as secondary smart contract calls, and the smart contract calls in user-submitted smart transactions are called primary smart contract calls. When a smart contract cannot directly meet the user's expectations, another smart contract can be called to meet the user's expectations. No matter the traditional smart contract method or the smart contract method according to the embodiment of the present invention, the secondary smart contract call can be realized.
  • Utxo2 whose output point (out point, which is a reference to the transaction output) is U2, and Utxo2 contains a C-type token with a value of 52.
  • the user wants to exchange the Utxo2 for a B-type token with a value of 260.
  • This expectation can be reflected by including an output item in the transaction.
  • the output item’s token is a B-type token with a value of 260, and the script is the address. Lockout script for user X.
  • the user can initiate a transaction with ID Tx2, which includes a call to smart contract S2.
  • the smart contract S2 itself cannot generate Class B tokens, so it cannot meet the expectations of users. But smart contract S2 can accept C-type tokens and exchange them for A-type tokens at a ratio of 2:1.
  • User transaction Tx2 data includes a set of inputs and a set of outputs as follows. Output 1 represents the user's expectations.
  • Tx2 After all smart contract calls are executed, Tx2 becomes:
  • S2 If S and S2 are developed by different developers, the developers of S2 need not pay too much attention to the security of S, and can focus on improving the quality of the smart contracts (S2) they develop. If S has security risks and cannot correctly meet the user's expectations, the transaction will not be accepted, thus causing no loss to the user.
  • the traditional smart contract developers must also pay attention to the security of S, otherwise it will bring security risks to his users. Since the smart contract program stored on the blockchain is a code similar to machine language, not a program written in a high-level language, it is difficult for developers to understand and find problems. It takes developers a lot of effort to understand and discover the problems, which could have been used to improve the quality of the smart contracts developed by the developers themselves.
  • Smart contracts can call other smart contracts.
  • a smart contract library can be formed, which can effectively reduce the storage space occupied by smart contracts and improve development efficiency. Allowing smart contracts to charge fees when they are called can increase the enthusiasm of smart contract developers, develop more smart contracts that can be called, and enrich the blockchain smart contract ecosystem.
  • the smart contract library has three smart contracts X, Y, and Z that will be called by smart contract S, and X, Y, and Z respectively require tokens of type D, E, and F as compensation.
  • S can choose one of the following two options:
  • S maintains a reserve of D, E, and F types of tokens, and pays them respectively when calling X, Y, and Z.
  • the owner of S needs to supplement S with D, E, and F type tokens. Generally speaking, this requires manual intervention.
  • the smart contract does not need to maintain the reserve of the third-party token
  • the smart contract can call other smart contracts, and the called smart contract called by the secondary smart contract can add an output item to the smart transaction, and the output address of the output item Charge for the called smart contract address.
  • the intelligence calling it does not and need not know about this behavior.
  • the user who initiates the transaction can either provide the required input by himself, or someone else can provide the required input for the payment, or call another smart contract to obtain the required token.
  • the following is an example illustrating a transaction that a user may construct in accordance with the method of the present invention.
  • the user invokes the smart contract S to exchange 26 A tokens for 260 B tokens; S will call X, Y, Z; X, Y, and Z respectively require 3 tokens of type D, E, and F as compensation.
  • the user has 27 A tokens and 3 D tokens.
  • the user's friend G can pay 3 E tokens.
  • Users can exchange 1 A token for 3 F tokens through the smart contract W. Then the user can construct the following transaction Tx3 to complete all the above-mentioned things.
  • the original content of transaction Tx3 is:
  • the transaction output referenced by V contains 27 A tokens.
  • the transaction output referenced by M contains 3 D tokens.
  • the transaction output referenced by N contains 3 E tokens. Therefore, the input tokens of the original transaction are: 27 A tokens, 3 D tokens, and 3 E tokens.
  • executing the smart contract S will execute the coinage instruction, adding an output item containing 260 B tokens to the coin base transaction, and S will spend the newly created token at the same time by adding to the transaction.
  • S also calls X, Y, Z (with parameters), X, Y, Z think that this is using the functions provided by it, and asks for compensation. The way is to execute the delivery order and add output items to the transaction.
  • the smart contract is called without parameters, so when X, Y, and Z are called again, X, Y, and Z do nothing and return a successful result immediately.
  • Smart contract W receives 1 A token and adds input 4 to the transaction.
  • K refers to the output item of the previous transaction
  • the output token of this output item is 3 F tokens
  • the output address is W.
  • the node further verifies the integrity of the transaction. Including: verifying that the output points in all input items are unused transaction outputs, and verifying that the total amount of input and output of each type of token is the same by token type. There are four inputs in the new current transaction, and if any of them are already used, the miner will decide that the transaction is not legal, preventing the smart contract from double spending. If they refer to unused transaction outputs, miners further verify that the total amount of input and output for each type of token is equal. If not, the miner will decide that the transaction is not legal, thus preventing the smart contract from overspending (ie spending more than the owned asset).
  • the input tokens of the new transaction are: 27 A tokens, 3 D tokens, 3 E tokens, 260 B tokens, and 3 F tokens, which are the same as the output tokens of the transaction.
  • the node determines that the transaction is legal.
  • Such complex operations can be performed within one transaction.
  • According to the traditional smart contract method multiple transactions are required to complete. Therefore, the method of the present invention is more user-friendly and convenient.
  • One embodiment of the present invention is a blockchain system.
  • the system includes several nodes and several terminal devices connected in a network.
  • the terminal device sends the smart transaction to the node, and the node sends the block to other nodes.
  • the node After the node receives the smart transaction or block, it executes the aforementioned method to process the smart transaction or block.
  • An embodiment of the present invention is an electronic device including a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the aforementioned method when the program is executed.
  • One embodiment of the present invention is a computer-readable storage medium, characterized in that the computer-readable storage medium stores a program for implementing the aforementioned method.
  • embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention 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, etc.) having computer-usable program code embodied therein.
  • computer-usable storage media including, but not limited to, disk storage, CD-ROM, optical storage, etc.
  • These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory result in an article of manufacture comprising instruction means, the instructions
  • the device implements one or more of the functions specified in the flow description.
  • These computer program instructions can also be loaded on a computer or other programmable data processing device to cause a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process such that Instructions provide steps for implementing one or more of the functions specified in the flow description.
  • the embodiments of the present application may be provided as a method, a system, or a computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present application 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, etc.) having computer-usable program code embodied therein.
  • computer-usable storage media including, but not limited to, disk storage, CD-ROM, optical storage, etc.
  • These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory result in an article of manufacture comprising instruction means, the instructions The device implements the function specified in one or more steps.
  • These computer program instructions can also be loaded on a computer or other programmable data processing device to cause a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process such that Instructions provide steps for implementing the function specified in one or more steps.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Business, Economics & Management (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Accounting & Taxation (AREA)
  • Software Systems (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Finance (AREA)
  • Databases & Information Systems (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Strategic Management (AREA)
  • General Business, Economics & Management (AREA)
  • Signal Processing (AREA)
  • Data Mining & Analysis (AREA)
  • Marketing (AREA)
  • Economics (AREA)
  • Development Economics (AREA)
  • Technology Law (AREA)
  • Computing Systems (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

一种区块链的智能合约方法,包括:S1、节点接收用户提交的智能交易或其它节点传送的区块,区块中包含智能交易;S2、节点执行智能交易中所有智能合约调用,智能合约向该交易添加输入项;S3、节点验证该智能交易的合法性,包括在所有智能合约调用执行结束后验证交易的完整性;S4、若验证结果为交易合法,则接受该智能交易,否则拒绝该智能交易;智能交易是包含智能合约调用的交易,智能交易可在交易的输出项中定义用户期望;能合约以提供恰当的输入来满足用户想要的结果。矿工验证智能合约所提供的输入是否满足用户想要的结果。在合同法的意义上,这相当于验证双方意思是否一致。只有通过验证的交易才会被区块链所接受。

Description

区块链智能合约方法、电子设备、系统及计算机可读存储介质 技术领域
本发明涉及区块链技术领域,具体涉及一种区块链智能合约方法、电子设备、系统及计算机可读存储介质。
背景技术
智能合约是一种旨在以信息化方式传播、验证或执行合同的计算机协议。智能合约允许在没有第三方的情况下进行可信交易,这些交易可追踪且不可逆转。区块链技术不仅可以支持可编程合约,而且具有去中心化、不可篡改、过程透明可追踪等优点,天然适合于智能合约。以太坊是第一个支持智能合约的区块链。
区块链智能合约是部署在区块链上的程序和数据,用户通过向区块链节点(矿工)发送包含调用智能合约的交易触发智能合约程序的执行。
矿工收到交易后,执行所调用智能合约程序,若智能合约程序返回表示成功的执行结果,矿工将该交易打包进区块,将区块添加进区块链。发送交易的用户除了提供智能合约调用参数外,对于智能合约的执行结果没有任何控制。而用户所部署的智能合约可能存在错误,甚至可能是恶意代码。如果由于调用者对智能合约存在理解错误,或者智能合约本身存在错误或恶意,导致执行结果不符合调用者预期,调用者也只能接受,因为一旦智能合约执行成功,调用者无法阻止矿工将交易添加进区块,成为区块链记录的一部分,而区块链记录是不可更改、不可撤销的。
发明内容
本发明提出一种区块链智能合约方法,旨在改善上述问题。
本发明是这样实现的,一种区块链的智能合约方法,所述方法具体包括如下步骤:
S1、节点接收用户提交的智能交易或其它节点传送的区块,区块中包含智能交易;
S2、节点执行智能交易中所有智能合约调用,智能合约向该交易添加输入项;
S3、节点验证该智能交易的合法性,交易的合法性验证包括在所有智能合约调用执行结束后验证交易的完整性;
S4、若验证结果为交易合法,则接受该智能交易,否则拒绝该智能交易;
智能交易是包含智能合约调用的交易,智能交易可在交易的输出项中定义用户期望;
若交易是用户提交的智能交易,接受智能交易即将该交易打包添加进当前区块中;拒绝智能交易即是放弃该智能交易;
若交易是其它节点传送的区块中的交易,拒绝智能交易即是拒绝将所述区块添加进区块链。
进一步的,节点使用虚拟机解释执行该智能合约的程序,该虚拟机的指令集中包括:花费指令,虚拟机解释执行所述花费指令的方法包括以下步骤:向智能交易的输入列表添加输入项。
进一步的,虚拟机的指令集中包括至少以下一种指令:支付指令,造币指令;
虚拟机解释执行所述支付指令的方法包括以下步骤:向智能交易的输出列表中添加一个输出项;
虚拟机解释执行所述造币指令的方法包括以下步骤:向当前区块币基交易的输 出列表中添加一个输出项。
进一步的,所述输出项中的脚本为另一个智能合约调用。
进一步的,虚拟机执行支付指令时,是将包含在支付指令数据中的输出项添加到智能交易的输出列表中。
进一步的,虚拟机执行造币指令时,所述输出项包含在该造币指令数据中的一个新的通证。
进一步的,虚拟机解释执行所述花费指令的方法还包括以下步骤:
输入项是该花费指令中的数据,虚拟机验证该输入项是否为该智能合约所拥有,只有验证结果为是,才向智能交易的输入列表添加该输入项。
本发明是这样实现的,一种区块链系统,所述系统包括若干节点和终端设备,终端设备可以向节点发送智能交易,节点可以向其它节点发送区块,节点接收到智能交易或区块后,执行如上所述的区块链的智能合约方法。
本发明是这样实现的,一种电子设备,包括存储器,处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行所述程序时实现如上所述的区块链的智能合约方法。
本发明是这样实现的,一种计算机可读存储介质,所述计算机可读存储介质存储实现如上所述的区块链的智能合约方法的程序。
智能合约以提供恰当的输入来满足用户想要的结果。矿工验证智能合约所提供的输入是否满足用户想要的结果。在合同法的意义上,这相当于验证双方意思是否一致。只有通过验证的交易才会被区块链所接受。因此采用本发明方法的智能合约更符合法律对于合约的定义。能拒绝接受不满足用户期望的智能合约执行的结果。
附图说明
图1为本发明实施例提供的区块链系统的结构示意图;
图2为本发明实施例提供的区块链的智能合约方法流程图。
具体实施方式
基于本发明的原理可以有多种实施例。下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述。显然,所描述的实施例仅是本发明的一部分实施例,而不是全部实施例。基于本发明中的实施例或原理,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其它实施例,都属于本发明保护的范围。
图1是一个区块链系统,由一个或多个连接到互联网(S101)的网络终端(S102)和一个或多个连接到互联网(S101)的区块链节点(S103)所组成。网络终端(S102)根据用户输入构造交易,将交易信息通过因特网(S101)发送给区块链的节点(S103)。每个区块链节点(S103)都可以接收来自网络终端(S102)的交易信息和来自其它节点(S103)的区块。交易包括一个输入列表和一个输出列表。交易的每个输出包括一个通证。通证是价值的表述。在一些区块链实施方案中,采用UTXO记账方式,交易的每个输入包含对另一个交易输出的引用;在另一些区块链实施方案中,采用账户记账方式,交易的每个输入包含一个通证和地址。节点(S103)收到交易信息后验证所收到的交易是否合法,包括验证交易的输入通证是区块链中未使用的通证;交易有恰当的授权。对于使用未花费交易输出(UTXO)记账方式的区块链来说,未使用的通证指是指是未被任何交易引用为输入的交易输出中的通证;对于使用账户记账方式的区块链来说,未使用的通证指的就是输入地址的账户内的通证。节点(S103)将一段时间内收到的合法交易打包产生一个区块,将该区块作为区块链的最新区块加进本地区块链,并通过网络(S101)向网络中的其它节点(S103)广播。 节点(S103)收到来自其它节点(S103)的新区块后验证所收到的区块中的所有交易都是合法的。如果所有交易都通过验证为合法,将该区块作为区块链的最新区块加进本地区块链末尾。
验证交易的合法性包括验证交易的完整性。
本发明的一个实施例是区块链智能合约方法。区块链上的智能合约包括储存于区块链上的智能合约程序(代码)和描述其状态的数据。用户可以向节点提交包含智能合约调用的交易,称为智能交易。用户提交的智能交易可以是不完整的,即输入总价值和输出总价值可以不相同。如图2所示,该方法包括以下步骤:
S1、矿工(即节点)接收用户提交的智能交易;智能交易是包含智能合约调用的交易;用户包括本地或通过网络与节点相连接的人或电子设备;智能交易的输出项中定义了用户期望;
S2、节点执行智能交易中所有智能合约调用;在执行过程中,智能合约向所属的智能交易添加输入项;
S3、节点验证智能交易的合法性,包括验证智能交易的完整性;
S4、若智能交易合法,矿工接受该智能交易;接受智能交易包括将该智能交易添加进当前区块;若该智能交易不合法,矿工放弃该智能交易。
当前区块是矿工正在进行打包构造的一个新区块。矿工在将一定数量的合法交易(包括不含智能合约调用的普通交易)打包进当前区块后,将当前区块添加进本地区块链,并向全网广播。
本发明的另一个实施例是区块链智能合约方法。其它节点可以向节点传送新区块,新区块中包含智能交易。该方法包括以下步骤:
S21、矿工(即节点)接收其它节点传送的区块,该区块包含智能交易;该区块称为当前区块;
S22、对于当前区块中每个智能交易,节点执行智能交易中所有智能合约调用;智能交易的输出项中定义了用户期望;在执行过程中,智能合约向所属的智能交易添加输入项;
S23、节点验证智能交易的合法性,包括验证智能交易的完整性;
S24、若智能交易不合法,则放弃当前区块;
若所收到的区块中所有交易均合法(包括不含智能合约调用的普通交易),矿工将当前区块添加进本地区块链。
在本发明实施例中,若任何一次智能合约调用执行结果为失败,节点放弃该智能交易;若该智能交易属于其它节点传送来的新区块,节点放弃该新区块。
智能交易合法性的验证包括:对于原始输入项验证签名、双花阻止及验证交易的完整性;原始输入项是指用户提交的智能交易中所包含的输入项,而不是智能合约添加进智能交易的输入项;对于使用UTXO记账方式的实施例,双花阻止包括验证智能交易的所有输入项(包括智能合约执行中添加的输入项)所引用的都是未使用的交易输出;对于使用账户记账方式的实施例,双花阻止包括验证智能交易的所有输入项(包括智能合约执行中添加的输入项)不大于账户余额;合法的交易必须是完整的;验证交易完整性包括在智能交易中所有智能合约调用执行结束后验证智能交易的所有输入通证的价值总量和输出通证的价值总量相等,如有必要将交易费纳入考虑。
交易包括一组输入和一组输出,交易的每项输出包括一个通证和一个脚本,脚本包括一个输出地址,如果输出地址是智能合约地址,则该输出项是对智能合约的调用,脚本还包括调用该智能合约的参数。智能交易是包含智能合约调用输出项的交易。一个智能交易可以包含多个含有智能合约调用的输出项,矿工依次执行智能交易中的智能合约调用。
智能合约调用的执行过程中可以向当前智能交易添加输入或输出项,或者是向当前区块币基交易添加输出项。一般来说,为了避免每次读取交易时都要执行智能合约调用,储存在区块链中的交易包含智能合约所添加的输入和输出项。但在节点之间传送区块时,由于接收的节点会执行交易中的智能合约调用,产生智能合约所添加的输入和输出项,因此为减少数据传输,在传送区块时,传送区块中的交易只包含原始输入和输出项,而不包含智能合约所添加的输入和输出项。如果传送区块包含智能合约所添加的输入和输出项,为避免验证交易完整性时重复计算,需要先将智能合约所添加的输入和输出项予以剥离,然后再执行智能合约。因此需要在智能交易中区别哪些输入/输出项是原始的(即用户提交的),哪些是智能合约所添加的。一个方法是在输入/输出列表中添加隔离项,在首次向智能交易中添加输入/输出项之前先在相应的列表中添加一个隔离项。列表中隔离项之前的输入/输出项为原始输入/输出项,之后为智能所添加的。另一个方法是在输入/输出项中增设一个表示该项是原始的还是智能合约添加的标志。
币基交易是区块的第一个交易,该交易不是用户提交的,而是节点(矿工)产生的。该交易没有输入项,只有输出项。传统上币基交易用于记录给矿工的奖励和矿工收到的手续费。在本发明的实施例中,币基交易还用于记录智能合约创造的新通证。
在本发明的有些实施例中,节点包含可以解释执行智能合约程序的虚拟机。智能合约程序是一个虚拟机指令的序列,矿工执行智能合约程序的方法包括启动虚拟机解释执行被调用智能合约程序。启动虚拟机包括根据所要执行的智能合约调用中智能合约地址从区块链中读取智能合约程序,根据该智能合约调用参数和该智能合约调用所属的交易输出项中的通证设置虚拟机初始状态,读取根据该初始状态所确定的智能合约程序中的一条指令并解释执行该指令。虚拟机是解释执行智能合约指令 的程序。指令包括指令码和数据二部分。指令码定义所要执行的功能。因此每个指令码代表一类指令。虚拟机所能处理的所有指令类型构成虚拟机的指令集。
虚拟机读取智能合约程序中的一条指令,解释执行该指令,根据解释执行后的虚拟机状态再读取智能合约程序的下一条指令,如此循环直至指令执行失败或执行到结束指令。如果指令执行失败,虚拟机返回执行失败的结果给矿工。如果执行到结束指令,虚拟机根据结束时的虚拟机状态或者结束指令的数据返回执行成功或失败的结果给矿工。
虚拟机在解释执行智能合约程序过程中,可以向含引发该程序执行的智能交易添加新的输入项和/或输出项。本发明的一个实施例是区块链智能合约虚拟机,该虚拟机的指令集包括一个花费指令。虚拟机解释执行花费指令时向当前交易添加新输入项。本发明的另一个实施例是区块链智能合约虚拟机,该虚拟机的指令集包括一个交付指令,虚拟机执行交付指令时向当前交易添加新输出项。
花费指令的数据包括输入项的数据。虚拟机解释执行花费指令时,验证该输入项是被调用的智能合约所拥有的。对于使用UTXO记账方式的实施例,输入项是对另一个交易输出项的引用,验证被调用的智能合约拥有该输入项包括验证该输入项所引用的交易输出的脚本中的地址是被调用的智能合约地址。对于使用账户记账方式的实施例,验证被调用的智能合约拥有该输入项包括验证该输入项的地址是被调用的智能合约地址,且该智能合约账户余额不小于输入的价值项。如果验证成功,则将该输入项添加进当前交易的输入列表,指令执行成功。
交付指令的数据包括一个输出项,该输出项包括一个通证和脚本。虚拟机执行交付指令时,验证通证和脚本内容合法,如果验证成功,则将该输出项添加进当前交易的输出列表,指令执行成功。
在有的实施例中,虚拟机指令集还包括一个造币指令。造币指令是凭空创造一个 通证的指令。造币指令的数据包括一个通证。对于使用UTXO交易模型的实施例,虚拟机执行造币指令时将一个包含该通证的输出项添加进区块的币基交易的输出列表中。在有的实施例中,该输出项中脚本地址为被调用智能合约的地址。在另一些的实施例中,造币指令的数据还包括一个地址,该输出项中脚本地址即为该地址。对于使用账户交易模型的实施例,虚拟机执行造币指令时将该通证添加进被调用智能合约的账户余额中。在另一些使用账户交易模型的实施例中,造币指令的数据还包括一个地址,虚拟机执行造币指令时将该通证添加进该地址的账户余额中。
当交易中所有智能合约调用都执行成功后,节点验证交易的合法性。传统的区块链技术中,合法性验证包括验证签名、双花阻止、总输出不大于总输入等条件。在本发明中,因为智能合约可能向交易中添加了输入和输出项,待验证的交易包含所有智能合约程序执行过程中向交易中添加的输入金额输出项,而且交易中的通证可以有多种类型,因此合法性验证包括:对于原始输入项验证签名、双花阻止、在所有智能合约调用执行结束后验证交易的完整性。
合法的交易必须是完整的,即交易输入的通证价值总量和输出的通证价值总量(在将交易费纳入考虑后)相等。节点将合法交易打包添加进区块,将合法区块添加进本地区块链并广播给其它节点。
在有些实施例中,通证是一个数值。
在另一些实施例中,通证数据包括通证类型和通证价值二项。通证的价值项可以是以下三种类型之一:
a)一个数值;例如数值5代表5个比特币;
b)一个几何体;例如一个多边形代表一块土地;通证中的几何体不限于多边形,可以是多面体,或者是任何数学上的几何体,如球体、曲面等等。
c)一个独特值;独特值是不可分割事物的标识。
在另一些实施例中,通证类型通过类型标识符进行标识,例如,如果二个通证都是数值型的通证,但有不同类型标识,他们依然视为不同类的通证,因而他们不可相加。类似的,如果二个通证都是多边形通证,但有不同类型标识,他们依然视为不同类的通证,因而他们的多边形不可合并。
在另一些实施例中,通证还包括一个权益集。即通证包含通证类型标识符、通证价值和权益集三项数据。
在一些实施例中,采用UTXO记账方式,交易的输入项包含对另一个交易的输出项的引用。我们称被引用输出项的中的通证为输入通证。
在另一些实施例中,采用账户记账方式,交易的输入项包含一个通证和地址。我们称该通证为输入通证。
一般地,区块链上的交易需要付给矿工交易费作为处理交易的报酬。交易费可以以一种明示的方式给付,也可以以暗示的方式给付。所谓明示的方式是指在交易中明确地包括一个付给矿工的输出项。所谓暗示的方式是指交易的输入总价值大于交易的输出总价值,差额部分即为交易费,并记录在币基交易中。
如果通证是一个数值,验证交易的完整性包括验证输入通证总和等于输出项的通证总和(在将交易费纳入考虑后)。
如果通证是有类型的,验证交易的完整性包括验证对于每个通证类型,输入通证总量和输出通证总量相等(在将交易费纳入考虑后)。对于数值类型的通证,总量即数值之和。对于几何体类型的通证,总量即合并后的几何体。对于独特值类型的通证,总量即每个独特值的个数。
如果通证还包含权益集,验证交易的完整性包括验证对于每个通证类型,分别对输入通证和输出通证进行分拆和合并,验证分拆和合并后的输入通证组和输出通证组包含相同的通证。
下面以几个具体的例子来说明前述方法,及其与以太坊智能合约的不同之处。在这些例子中,区块链采用UTXO记账方式。设有人部署一个智能合约S,该智能合约接受类型为A的数值通证,并产生一个数值10倍于该A类通证数值的B类通证给调用者。然而由于程序员的疏忽,该智能合约存在一个错误,该智能合约在计算B类通证的数值时使用的是字节类数据,因此当结果大于256时会发生溢出,丢失高位数据。该错误的智能合约被部署到区块链上。
如果该智能合约被部署到以太坊区块链,该智能合约会有类似于以下的代码:
Figure PCTCN2021112991-appb-000001
在传统的智能合约中,合约执行的结果是储存在合约内部的一个数据结构中。具体到该智能合约,是从地址到通证的映射关系,即Balance。但另一个程序员完全可以用另一种数据结构来表示和储存执行的结果。虽然这些数据结构也是储存在区块链上的,但节点只能提供数据读写的操作,不可能理解和处理这些数据,因而无法对执行结果进行验证。在传统的智能合约中,只有通过智能合约才能理解和处理这些数据。
用户以发起一个交易的方式调用该智能合约。交易数据包括:用户地址(即代码中的sender),输入通证(即代码中的参数in),用户签名,智能合约地址(即代码中的S)。节点收到交易后,首先验证交易,包括验证用户签名是该用户地址的签名。通过验证后,节点执行智能合约S,如果智能合约返回成功(true),节点更新智能合约状态(即代码中的Balance),将该交易打包进区块链。
如果输入通证是价值不超过25的A类通证,该智能合约会正确地将10倍于该数值的B类通证添加到调用者的账户上。但当通证是价值超过25的A类通证时,该智能合约会将错误数量的B类通证添加到调用者的账户上。例如当以Token{type:A,value:26}调用该智能合约时,用户账户B类通证余额增加的不是260,而是4。由于该合约成功返回,该错误结果作为智能合约的内部状态会成为区块链不可更改的合法交易记录,用户因此损失了价值为256的B类通证。
如果该智能合约被部署到基于一个本发明实施例的区块链,该智能合约会有类似于以下的代码:
Figure PCTCN2021112991-appb-000002
该智能合约包含同样的错误,在发生错误时也会返回成功。因此节点并不知道智能合约本身有问题。
用户以提交一个交易的方式调用该智能合约。假设该用户X有一个未使用交易 输出Utxo,其输出点(out point,是对交易输出的引用)为U,Utxo包含价值为26的A类型通证。该用户想用该Utxo交换一个价值为260的B类型通证,该期望可以通过在交易中包含一个输出项来体现,该输出项的通证是价值为260的B类型通证,脚本是地址为用户X的锁定脚本。该用户可以发起ID为Tx1的一个交易,交易数据包括如下的一组输入和一组输出。输出项1即代表用户的期望。
Figure PCTCN2021112991-appb-000003
节点收到交易后,首先验证SigScript能够解锁Utxo中的锁定脚本。如果通过验证,节点检查交易的输出是否包含智能合约调用,如有,调用虚拟机执行该智能合约调用。因为该交易输出0的脚本地址是智能合约地址,因此节点运行虚拟机,以Token{type:A,value:25}为参数调用智能合约S,执行上述智能合约代码。
在执行到造币指令p=Mint(Token{type:B,value:t})时,该指令的数据为通证Token{type:B,value:t},t=4,因此虚拟机向当前币基交易添加一个输出通证为Token{type:B,value:4},锁定脚本为该智能合约地址S的输出项,返回该输出项的输出点为p值,本例中,p={币基本交易ID,1}。
在执行到花费指令Spend(p)时,该指令的数据为p,p={币基本交易ID,1},虚拟机验证p所引用的交易输出中锁定脚本的地址是否是当前智能合约地址。如果结果为否,则虚拟机返回智能合约执行失败的结果。在本例中,因为p是刚刚添加进当前币基交易的输出点,该输出的锁定脚本的地址是当前智能合约地址,因此验证 通过。验证通过后,虚拟机将p添加进当前交易的输入,返回合约执行成功的结果。合约执行完毕后,新的币基交易内容如下:
Figure PCTCN2021112991-appb-000004
交易Tx1的内容变为:
Figure PCTCN2021112991-appb-000005
因为智能合约执行成功,节点进一步验证当前交易的合法性。包括:验证所有输入项中的输出点所引用的都是未被使用的交易输出,按通证类型分别验证各类通证的输入和输出总量相同。Tx1中有二个输入项,它们所引用的都是未被使用的交易输出,他们所包含的通证分别为价值为26的A类型通证和价值为4(由于程序错误)的B类型通证。Tx1中有二个输出项,他们所包含的通证分别为价值为26的A类型通证和价值为260的B类型通证。因为B类型通证的输入和输出总量不同,节点判定该交易不合法,不会将该交易打包进区块链,因此不会造成用户的损失。
比较上述二种智能合约执行的方式和结果,可以发现按以太坊类型的智能合约方法,发起智能合约调用的用户无法表达他所期待的结果,智能合约执行的结果是作 为合约的内部状态储存在区块链上,矿工无法理解和处理,因此即使智能合约存在错误,只要智能合约的执行没有失败,用户就只能接受错误的结果。
而采用本发明的方法,智能合约不将执行的结果作为合约的内部状态储存在区块链上,而是通过向交易中添加输入/输出的方式显式地表达执行的结果,而矿工是可以理解并处理交易输入和输出数据的。因此用户可以在其所发起的交易中以指定输出项的方式表达想要达成的结果。在合同法的意义上,这是一种意思的表达。智能合约以提供恰当的输入来满足用户想要的结果。矿工验证智能合约所提供的输入是否满足用户想要的结果。在合同法的意义上,这相当于验证双方意思是否一致。只有通过验证的交易才会被区块链所接受。因此采用本发明方法的智能合约更符合法律对于合约的定义。能拒绝接受不满足用户期望的智能合约执行的结果。
智能合约可以调用其它智能合约。我们将这样的调用称为次级智能合约调用,将用户提交的智能交易中的智能合约调用称为初级智能合约调用。当一个智能合约不能直接满足用户的期望时,可以调用另一个智能合约来满足用户。无论传统的智能合约方法,还是根据本发明实施例的智能合约方法都可以实现次级智能合约调用。
假设该用户X有一个未使用交易输出Utxo2,其输出点(out point,是对交易输出的引用)为U2,Utxo2包含价值为52的C类型通证。该用户想用该Utxo2交换一个价值为260的B类型通证,该期望可以通过在交易中包含一个输出项来体现,该输出项的通证是价值为260的B类型通证,脚本是地址为用户X的锁定脚本。该用户可以发起ID为Tx2的一个交易,其中包括对智能合约S2的调用。智能合约S2本身不能够产生B类通证,因此无法满足用户的期望。但智能合约S2可以接受C类型通证并按2:1的比例交换为A类通证。用户交易Tx2数据包括如下的一组输入和一组输出。输出项1即代表用户的期望。
Figure PCTCN2021112991-appb-000006
Figure PCTCN2021112991-appb-000007
所有智能合约调用都执行后,Tx2变为:
Figure PCTCN2021112991-appb-000008
S2在执行过程中,向交易Tx2添加了输入1和输出2。S在执行过程中,向交易Tx2添加了输入2。如果S中存在与前一例中相同的错误,按本发明所述的方法,节点验证交易完整性时会发现对于B类通证,输入总量为4,输出总量为260,因此判定交易不合法。而传统的智能合约方法会接受该错误交易。此例说明和传统的智能合约方法相比,采用本发明的方法的智能合约开发者可以花费较少的精力就可以达到较高的代码质量,或花费同等的精力而产生更高质量的代码。如果S和S2是不同的开发者所开发,S2的开发者无需过于关注S的安全性,可以将主要精力集中于提高自己所开发的智能合约(S2)的质量。如果S存在安全性隐患,不能正确满足用 户预期,交易就不会被接受,因而不会给用户造成损失。而传统的智能合约开发者则必须也关注S的安全性,否则就会给他的用户带来安全隐患。由于存放在区块链上的智能合约程序是一种类似于机器语言的代码,不是用高级语言所编写的程序,开发者难以理解,更难以发现其中的问题。开发者只有耗费大量精力才有可能理解并发现其中的问题,而这精力本可用于提高开发者自己所开发的智能合约的质量。
智能合约可以调用其它智能合约,通过在区块链上部署可以共享的通用智能合约,形成一个智能合约库,可以有效地减少智能合约所占用的储存空间,提高开发效率。允许智能合约在被调用时收取费用可以提高智能合约开发者的积极性,开发出更多可被调用的智能合约,丰富区块链智能合约生态。假设智能合约库有X、Y、Z三个智能合约会被智能合约S调用,而X、Y、Z分别要求D、E、F类型的通证为报酬。按传统的智能合约方法,S可以选用以下二种方案之一:
1.S维持一个D、E、F类型通证的储备,在调用X、Y、Z分别支付给它们。然而当储备比较低,可能会导致未来合约无法执行时,S的所有者需要向S补充D、E、F类型通证,一般来说,这需要人工干预。
2.S要求用户调用时支付所需要的D、E、F类型通证。因为传统的智能合约只有一个调用者,因此调用者必须拥有D、E、F类型通证,如果缺少所需要的通证,则无法调用S。
因此传统的方法或者给智能合约拥有者带来不便,需要维护第三方通证的储备,并使智能合约程序更复杂;或者给用户带来不便,增加交易难度。
采用本发明的方法,智能合约无需维护第三方通证的储备,智能合约可以调用其它智能合约,次级智能合约调用的被调用智能合约可以向智能交易添加一个输出项,该输出项的输出地址为该被调用的智能合约地址,以此来进行收费。调用它的智能不知道也无需知道这一行为。而发起交易的用户或者可以自己提供所需要的输入, 或者由他人代为支付提供所需要的输入,或者调用另一个智能合约获得所需要的通证。下面是一个实例说明用户按本发明的方法可以构造的一个交易。假设用户调用智能合约S以26个A通证换取260个B通证;S会调用X、Y、Z;X、Y、Z分别要求D、E、F类型通证各3为报酬。而用户有27个A通证,3个D通证。用户的朋友G可以付3个E通证。用户可以通过智能合约W以1个A通证换3个F通证。则用户可以构造如下交易Tx3完成上述所有事情。
交易Tx3的原始内容为:
Figure PCTCN2021112991-appb-000009
V所引用的交易输出包含27个A通证。M所引用的交易输出包含3个D通证。N所引用的交易输出包含3个E通证。因此原始交易的输入通证是:27个A通证,3个D通证,3个E通证。
智能合约S和智能合约W执行成功后,新的交易内容为:
Figure PCTCN2021112991-appb-000010
Figure PCTCN2021112991-appb-000011
和前一实例一样,执行智能合约S会执行造币指令,向币基交易添加一含260个B通证的输出项,S同时花费该新创造的通证,花费的方式是向交易中添加输入3引用该输出项。S还调用了X、Y、Z(带参数的),X、Y、Z认为这是在使用其所提供的功能,要求报酬,其方式是执行交付指令,分别向交易中添加输出项3、4、5。而在3、4、5中,智能合约调用时无参数的,因此当X、Y、Z再次被调用时,X、Y、Z不执行任何操作,立即返回成功结果。
智能合约W接收1个A通证,向交易添加输入项4。其中K所引用的是之前一个交易的输出项,该输出项的输出通证是3个F通证,输出地址是W。
因为所有智能合约都执行成功,节点进一步验证交易的完整性。包括:验证所有 输入项中的输出点是未被使用的交易输出,按通证类型分别验证各类通证的输入和输出总量相同。新的当前交易中有四个输入项,如果它们中任何一个已经被使用,则矿工会判定交易不合法,从而阻止智能合约双花。如果它们所引用的都是未被使用的交易输出,矿工进一步验证各类型通证的输入和输出总量相等。如果不等,则矿工会判定交易不合法,从而阻止智能合约超花(即花费超过所拥有的资产)。本例中,新交易的输入通证是:27个A通证,3个D通证,3个E通证,260个B通证,3个F通证,与交易的输出通证相同,节点判定该交易合法。
像这样复杂的操作,按本发明的方法可以在一个交易内完成。而按传统的智能合约方法,需要进行多次交易才可能完成。因此本发明的方法对于用户更友好,更便捷。
本发明的一个实施例是一个区块链系统。如图1所示,该系统包括连接在一个网络中的若干节点和若干终端设备。终端设备向节点发送智能交易,节点向其它节点发送区块,节点收到智能交易或区块后,执行前述方法处理智能交易或区块。
本发明的一个实施例是一种电子设备,包括存储器,处理器及存储在存储器上并可在处理器上运行的计算机程序,其特征在于,该处理器执行该程序时实现前述方法。
本发明的一个实施例是一种计算机可读存储介质,其特征在于,该计算机可读存储介质存储实现前述方法的程序。
本领域内的技术人员应明白,本发明的实施例可提供为方法、系统、或计算机程序产品。因此,本发明可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。
本发明是参照根据本发明实施例的方法、设备(系统)、和计算机程序产品的流程说明(包括流程图、方框图、文字说明)来描述的。应理解可由计算机程序指令实现流程说明中的每一流程。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程中一项或多项指定的功能的装置。这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程说明中的一项或多项指定的功能。
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程说明中一项或多项指定的功能的步骤。
以上所述仅为本发明的优选实施例而已,并不用于限制本发明,对于本领域的技术人员来说,本发明实施例可以有各种更改和变化。凡在本发明的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。
本领域内的技术人员应明白,本申请的实施例可提供为方法、系统、或计算机程序产品。因此,本申请可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。
本申请是参照根据本申请实施例的方法、设备(系统)、和计算机程序产品的步骤来描述的。应理解可由计算机程序指令实现的每一步骤。可提供这些计算机程序 指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在一个或多个步骤中指定的功能的装置。
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在一个或多个步骤中指定的功能。
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在一个或多个步骤中指定的功能的步骤。
最后应当说明的是:以上实施例仅用以说明本发明的技术方案而非对其限制,尽管参照上述实施例对本发明进行了详细的说明,所属领域的普通技术人员应当理解:依然可以对本发明的具体实施方式进行修改或者等同替换,而未脱离本发明精神和范围的任何修改或者等同替换,其均应涵盖在本发明的权利要求保护范围之内。

Claims (10)

  1. 一种区块链的智能合约方法,其特征在于,所述方法具体包括如下步骤:
    S1、节点接收用户提交的智能交易或其它节点传送的区块,区块中包含智能交易;
    S2、节点执行智能交易中所有智能合约调用,智能合约向该交易添加输入项;
    S3、节点验证该智能交易的合法性,交易的合法性验证包括在所有智能合约调用执行结束后验证交易的完整性;
    S4、若验证结果为交易合法,则接受该智能交易,否则拒绝该智能交易;
    智能交易是包含智能合约调用的交易,智能交易可在交易的输出项中定义用户期望;
    若交易是用户提交的智能交易,接受智能交易即将该交易打包添加进当前区块中;拒绝智能交易即是放弃该智能交易;
    若交易是其它节点传送的区块中的交易,拒绝智能交易即是拒绝将所述区块添加进区块链。
  2. 如权利要求1所述区块链的智能合约方法,其特征在于,节点使用虚拟机解释执行该智能合约的程序,该虚拟机的指令集中包括:花费指令,虚拟机解释执行所述花费指令的方法包括以下步骤:向智能交易的输入列表添加输入项。
  3. 如权利要求2所述区块链的智能合约方法,其特征在于,虚拟机的指令集中包括至少以下一种指令:支付指令,造币指令;
    虚拟机解释执行所述支付指令的方法包括以下步骤:向智能交易的输出列表中添加一个输出项;
    虚拟机解释执行所述造币指令的方法包括以下步骤:向当前区块币基交易的输出列表中添加一个输出项。
  4. 如权利要求3所述区块链的智能合约方法,其特征在于,所述输出项中的脚本为另一个智能合约调用。
  5. 如权利要求3所述区块链的智能合约方法,其特征在于,虚拟机执行支付指令时,是将包含在支付指令数据中的输出项添加到智能交易的输出列表中。
  6. 如权利要求3所述区块链的智能合约方法,其特征在于,虚拟机执行造币指令时,所述输出项包含在该造币指令数据中的一个新的通证。
  7. 如权利要求2所述区块链的智能合约方法,其特征在于,虚拟机解释执行所述花费指令的方法还包括以下步骤:
    输入项是该花费指令中的数据,虚拟机验证该输入项是否为该智能合约所拥有,只有验证结果为是,才向智能交易的输入列表添加该输入项。
  8. 一种区块链系统,其特征在于,所述系统包括若干节点和终端设备,终端设备可以向节点发送智能交易,节点可以向其它节点发送区块,节点接收到智能交易或区块后,执行如权利要求1-7任意一项所述的区块链的智能合约方法。
  9. 一种电子设备,包括存储器,处理器及存储在存储器上并可在处理器上运行的计算机程序,其特征在于,所述处理器执行所述程序时实现如权利要求1-7任意一项所述的区块链的智能合约方法。
  10. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质存储实现如权利要求1至7所述的区块链的智能合约方法的程序。
PCT/CN2021/112991 2020-09-04 2021-08-17 区块链智能合约方法、电子设备、系统及计算机可读存储介质 WO2022048436A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
EP21863503.5A EP4209982A4 (en) 2020-09-04 2021-08-17 INTELLIGENT CONTRACT METHOD FOR BLOCKCHAIN AND ELECTRONIC DEVICE, SYSTEM AND COMPUTER-READABLE STORAGE MEDIUM
US18/178,524 US20230205764A1 (en) 2020-09-04 2023-03-05 Blockchain smart contract method, electronic device, blockchain system, and computer-readable storage medium

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010920884.8A CN112085600A (zh) 2020-09-04 2020-09-04 区块链智能合约方法、电子设备、计算机可读存储介质及区块链系统
CN202010920884.8 2020-09-04

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US18/178,524 Continuation-In-Part US20230205764A1 (en) 2020-09-04 2023-03-05 Blockchain smart contract method, electronic device, blockchain system, and computer-readable storage medium

Publications (1)

Publication Number Publication Date
WO2022048436A1 true WO2022048436A1 (zh) 2022-03-10

Family

ID=73731944

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/112991 WO2022048436A1 (zh) 2020-09-04 2021-08-17 区块链智能合约方法、电子设备、系统及计算机可读存储介质

Country Status (4)

Country Link
US (1) US20230205764A1 (zh)
EP (1) EP4209982A4 (zh)
CN (1) CN112085600A (zh)
WO (1) WO2022048436A1 (zh)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112085600A (zh) * 2020-09-04 2020-12-15 芜湖明轩科技有限公司 区块链智能合约方法、电子设备、计算机可读存储介质及区块链系统
CN112287034B (zh) * 2020-12-24 2021-04-02 腾讯科技(深圳)有限公司 一种数据同步方法、设备以及计算机可读存储介质
CN112288415B (zh) * 2020-12-24 2021-06-11 南京可信区块链与算法经济研究院有限公司 一种用于utxo架构的币龄机制实现方法

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108885745A (zh) * 2016-02-23 2018-11-23 区块链控股有限公司 具有令牌化的基于区块链的交换
US20190311359A1 (en) * 2018-04-06 2019-10-10 Nicholas Fett Method for Tokenization of Financial Contracts on Decentralized Computing Networks
CN111028077A (zh) * 2019-11-20 2020-04-17 华中科技大学 一种基于输入过滤器的智能合约防护方法及系统
CN111275555A (zh) * 2020-02-24 2020-06-12 中国工商银行股份有限公司 区块链交易处理方法、交易节点以及区块链系统
CN112085600A (zh) * 2020-09-04 2020-12-15 芜湖明轩科技有限公司 区块链智能合约方法、电子设备、计算机可读存储介质及区块链系统

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6940182B2 (ja) * 2017-03-03 2021-09-22 日本電気株式会社 ブロックチェーン管理装置、ブロックチェーン管理方法及びプログラム
CN109064334B (zh) * 2018-08-27 2021-12-24 深圳前海益链网络科技有限公司 一种智能合约记账方法、计算机装置及可读存储介质
CN110060160A (zh) * 2019-03-20 2019-07-26 湖南天河国云科技有限公司 一种区块奖励分配方法、系统及计算机可读存储介质

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108885745A (zh) * 2016-02-23 2018-11-23 区块链控股有限公司 具有令牌化的基于区块链的交换
US20190311359A1 (en) * 2018-04-06 2019-10-10 Nicholas Fett Method for Tokenization of Financial Contracts on Decentralized Computing Networks
CN111028077A (zh) * 2019-11-20 2020-04-17 华中科技大学 一种基于输入过滤器的智能合约防护方法及系统
CN111275555A (zh) * 2020-02-24 2020-06-12 中国工商银行股份有限公司 区块链交易处理方法、交易节点以及区块链系统
CN112085600A (zh) * 2020-09-04 2020-12-15 芜湖明轩科技有限公司 区块链智能合约方法、电子设备、计算机可读存储介质及区块链系统

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP4209982A4 *

Also Published As

Publication number Publication date
US20230205764A1 (en) 2023-06-29
EP4209982A1 (en) 2023-07-12
CN112085600A (zh) 2020-12-15
EP4209982A4 (en) 2024-01-31

Similar Documents

Publication Publication Date Title
WO2022048436A1 (zh) 区块链智能合约方法、电子设备、系统及计算机可读存储介质
JP7250771B2 (ja) ブロックチェーンを用いる並行状態機械処理
WO2020220760A1 (zh) 基于区块链的缴费代扣方法及装置、电子设备、存储介质
Wang et al. Blockchain-enabled smart contracts: architecture, applications, and future trends
US10986177B2 (en) Systems and methods of self-forking blockchain protocol
Zakhary et al. Atomic commitment across blockchains
CN111480162B (zh) 用于并发字节码解释的区块链实施的系统和方法
CN108492180B (zh) 资产管理方法及装置、电子设备
WO2020107919A1 (zh) 基于创新性的信誉证明共识协议的分布式网络及生态系统
CN110147990B (zh) 基于区块链的缴费代扣签约方法及装置、电子设备
CN113836227A (zh) 一种基于区块链的资产申购方法、装置及电子设备
US20220391895A1 (en) Data Access Management with Non-Fungible Tokens
Zakhary et al. Towards global asset management in blockchain systems
CN110738566A (zh) 一种基于区块链的资产筛选方法、装置及电子设备
US20200313896A1 (en) Declarative smart contracts
Cao et al. Flashot: a snapshot of flash loan attack on DeFi ecosystem
CN109523380A (zh) 跨链交易方法及装置
EP3907644B1 (en) Blockchain
CN116210200A (zh) 区块链通证
WO2021073096A1 (zh) 资源数据的转移方法、装置和区块链系统
CN113419736B (zh) 一种在Tangle区块链系统上支持智能合约协议的方法
Osterland et al. On the implementation of business process logic in DLT nodes
CN115170312A (zh) 区块链上资产状态信息变更方法及装置
Antal et al. Distributed Ledger Technology Review and Decentralized Applications Development Guidelines. Future Internet 2021, 13, 62
Painter et al. Descriptor based consensus for blockchain transactions

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21863503

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

ENP Entry into the national phase

Ref document number: 2021863503

Country of ref document: EP

Effective date: 20230404