Method for executing smart contract in block chain system, node and computing device
By deploying the first smart contract and the interpreter contract in the blockchain system, and using the interpreter contract to convert and execute the smart contract code, the compatibility problem of smart contract deployment and execution between different blockchain systems is solved, and the block efficiency is improved. Scalability of the chain system.
Patent Information
- Application Number
- CN202411386122.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-29
- Publication Date
- 2025-01-21
AI Technical Summary
Due to different execution environments of different blockchain systems, the same smart contract cannot be directly deployed and run in multiple blockchain systems.
By deploying the first smart contract and the interpreter contract in the blockchain system, the contract status of the first smart contract contains the contract code and status of the target smart contract. The executable byte code is executed and the byte code is executed to achieve the implementation of the target smart contract.
The deployment and execution of smart contracts in different types of blockchain systems are realized, and the scalability of the blockchain system is improved.
Smart Images

Figure CN119336843A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of this specification belong to the field of blockchain technology, and in particular, relate to a method for executing a smart contract in a blockchain system, a blockchain node, and a computing device. Background Art
[0002] The blockchain system is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, and encryption algorithm. In the blockchain system, data blocks are combined into a chain data structure in a sequential manner according to time order, and a distributed ledger that cannot be tampered with or forged is guaranteed by cryptography. Due to the characteristics of decentralization, information cannot be tampered with, and autonomy, the blockchain system has received more and more attention and application.
[0003] In the process of developing smart contracts, developers may be accustomed to using a development environment adapted to a certain blockchain system, creating contract code for a smart contract that can be executed by the blockchain system, and using the created contract code to deploy the smart contract to the blockchain system. However, for any two blockchain systems of different types, due to the different execution environments of smart contracts, the same smart contract cannot usually be directly deployed and run in multiple blockchain systems of different types. Summary of the invention
[0004] The object of the present invention is to provide a method, a blockchain node and a computing device for executing a smart contract in a blockchain system.
[0005] In a first aspect, a method for executing a smart contract in a blockchain system is provided, wherein a first smart contract and an interpreter contract are deployed in the blockchain system, the contract state of the first smart contract includes a first contract code of a target smart contract and a target contract state, the first contract code is a bytecode that can be executed by the target blockchain system, and the method comprises: in the process of executing the first smart contract, executing the interpreter contract according to the call of the first smart contract to the interpreter contract; obtaining the first contract code according to the execution of the interpreter contract, and converting the first contract code into a second contract code that can be executed by the blockchain system; executing the second contract code, and updating the target contract state according to the execution result.
[0006] In a second aspect, a method for executing a smart contract in a blockchain system is provided, wherein a first smart contract and an interpreter contract are deployed in the blockchain system, wherein the contract state of the first smart contract includes a first contract code of a target smart contract and a target contract state, wherein the first contract code is a bytecode that can be executed by the target blockchain system, and the method includes: generating a first transaction; sending the first transaction to the blockchain system, so that the blockchain system, in the process of executing the first smart contract according to the first transaction, uses the interpreter contract to convert the first contract code into a second contract code that can be executed by the blockchain system, executes the second contract code, and updates the target contract state according to the execution result.
[0007] According to a third aspect, a blockchain node in a blockchain system is provided, wherein a first smart contract and an interpreter contract are deployed in the blockchain system, wherein the contract state of the first smart contract includes a first contract code of a target smart contract and a target contract state, wherein the first contract code is a bytecode that can be executed by the target blockchain system, and the blockchain node is configured to: in the process of executing the first smart contract, execute the interpreter contract according to the call of the interpreter contract by the first smart contract; obtain the first contract code according to the execution of the interpreter contract, and convert the first contract code into a second contract code that can be executed by the blockchain system; execute the second contract code, and update the target contract state according to the execution result.
[0008] In a fourth aspect, a computing device is provided, wherein a first smart contract and an interpreter contract are deployed in a blockchain system to which the computing device is connected, wherein the contract state of the first smart contract includes a first contract code of a target smart contract and a target contract state, wherein the first contract code is a bytecode that can be executed by the target blockchain system, and the computing device includes: a transaction generation unit, configured to generate a first transaction; and a communication processing unit, configured to send the first transaction to the blockchain system, so that the blockchain system, in the process of executing the first smart contract according to the first transaction, uses the interpreter contract to convert the first contract code into a second contract code that can be executed by the blockchain system, executes the second contract code, and updates the target contract state according to the execution result.
[0009] In a fifth aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed in a computing device, the computing device executes the method described in the first aspect or the second aspect.
[0010] In the technical solution provided by the embodiments of this specification, by utilizing the first contract code developed by the developer for the target smart contract and capable of being executed in the target blockchain system, the first smart contract corresponding to the target smart contract is deployed in other blockchain systems of a type different from the target blockchain system, and the contract state of the first smart contract includes the first contract code and the target contract state of the target smart contract; when the target smart contract needs to be executed, the blockchain system can execute the first smart contract, and in the process of executing the first smart contract, the first contract code is converted into a second contract code that can be executed by the blockchain system by utilizing the interpreter contract, and the second contract code is executed to realize the execution of the target smart contract, thereby improving the scalability of the blockchain system. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] In order to more clearly illustrate the technical solutions of the embodiments of this specification, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0012] Figure 1 This is an architectural diagram of a blockchain system exemplarily provided in the embodiments of this specification;
[0013] Figure 2 This is one of the flow charts of a data management method provided in the embodiments of this specification;
[0014] Figure 3 A schematic diagram of various smart contracts deployed in the blockchain system provided in the embodiments of this specification;
[0015] Figure 4 A flowchart of a method for processing a transfer transaction in a blockchain system provided in an embodiment of this specification;
[0016] Figure 5 One of the schematic diagrams of the process of executing a target transaction by managing a contract is provided as an example;
[0017] Figure 6 A flowchart of a method for deploying a smart contract provided in an embodiment of this specification;
[0018] Figure 7 The second schematic diagram of the process of executing the target transaction through the management contract is provided as an example;
[0019] Figure 8 A flowchart of a method for executing a smart contract in a blockchain system provided in an embodiment of this specification;
[0020] Fig. 9 A schematic diagram of the structure of a computing device provided in an embodiment of this specification. DETAILED DESCRIPTION
[0021] In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this specification.
[0022] Figure 1 This is an architectural diagram of a blockchain system provided exemplarily in the embodiments of this specification. The blockchain system may include N blockchain nodes, where Figure 1 8 blockchain nodes, i.e., node 1 to node 8, are shown as examples. The lines between the nodes schematically represent the connection between the nodes, and the aforementioned connection is used to support data transmission between different nodes.
[0023] A transaction in a blockchain system can refer to a task unit that is executed in the blockchain system and recorded in the blockchain. A transaction usually includes a send field (From), a receive field (To), and a data field (Data). Among them, in the case where the transaction is a transfer transaction, the From field indicates the account address that initiates the transaction (i.e., initiates a transfer task to another account), and the To field indicates the account address that receives the transaction (i.e., receives the transfer), and the Data field includes the transfer amount.
[0024] The blockchain system can provide the function of smart contracts. Smart contracts in the blockchain system are contracts that can be triggered and executed by transactions. Smart contracts can be defined in the form of contract code. Calling a smart contract in the blockchain system is to initiate a transaction pointing to the contract address of the smart contract, so that each node in the blockchain system can run the corresponding contract code in a distributed manner.
[0025] In the scenario of deploying a contract, for example, Bob sends a transaction containing information about creating a smart contract (i.e. deploying a contract) to Figure 1In the blockchain system shown, the data field of the transaction includes the contract code (such as bytecode or machine code) of the smart contract to be created, and the to field of the transaction is empty to indicate that the transaction is used to deploy the smart contract. After the nodes reach an agreement through the consensus mechanism, the contract address "0x6f8ae93..." of the smart contract is determined, and each node adds a contract account corresponding to the contract address of the smart contract in the state database, allocates the state storage corresponding to the contract account, and stores the contract code, and saves the hash value of the contract code in the state storage of the smart contract, so that the smart contract is successfully created.
[0026] In the scenario of calling a smart contract, for example, Bob sends a transaction for calling a smart contract to Figure 1 In the blockchain system shown, the from field of the transaction is the account address of the transaction initiator (i.e., Bob), the to field is the address of the smart contract being called, for example, the contract address "0x6f8ae93...", and the data field of the transaction includes the method and parameters for calling the smart contract. After the blockchain system reaches a consensus on the transaction, each node in the blockchain system can execute the transaction separately, thereby executing the smart contract separately, and updating the status database based on the execution of the smart contract.
[0027] In various blockchain systems that introduce smart contracts, accounts can generally be divided into two types:
[0028] Contract account (CA): mainly used to store the contract code of the corresponding smart contract and the value of the state variable in the smart contract. It can usually only be activated by calling an external account.
[0029] Externally owned account (EOA): An account registered by an external user in the blockchain system.
[0030] The design of external accounts and contract accounts is actually a mapping from account addresses to account states. The account state of any account usually includes fields such as nonce, balance, storageRoot, code, and / or codeHash. Nonce and balance exist in both external accounts and contract accounts, while code, codeHash, and storageRoot attributes are generally only valid on contract accounts.
[0031] nonce: Counter. For external accounts, this number represents the number of transactions sent from the account address of the relevant external account; for contract accounts, it is the number of contracts created by the contract account.
[0032] Balance: The amount of a certain virtual resource owned by this address.
[0033] storageRoot: The hash of the root node of the MPT tree, which organizes the storage of the state variables of the contract account.
[0034] code: used to store contract code.
[0035] codeHash: The hash value of the contract code. For contract accounts, this is the code of the smart contract that is hashed and stored; for external accounts, since they do not include smart contracts, the codeHash field can be an empty string / all-0 string.
[0036] MPT stands for Merkle Patricia Tree, which is a tree structure that combines Merkle Tree and PatriciaTree (a compressed prefix tree, a more space-saving Trie tree, dictionary tree). Merkle Tree, the Merkle tree algorithm calculates a Hash value for each transaction, and then connects two by two to calculate the Hash again, all the way to the top Merkle root.
[0037] The data structure of the MPT tree includes a state trie. The state trie contains key-value pairs (key and value pairs) corresponding to the storage content of each account in the blockchain system. The "key" in the state trie can be an identifier of a predetermined length (i.e., an account address), which is distributed in the storage from the root node of the state tree to the leaf node. The "value" in the state trie is obtained by encoding the account information, for example, using the Recursive-Length Prefix encoding (RLP) method. As mentioned above, for external accounts, the values include nonce and balance; for contract accounts, the values can include nonce, balance, codehash, and storageroot.
[0038] The contract account is used to store the contract status of the smart contract. After the smart contract is deployed in the blockchain system, a corresponding contract account will be generated. This contract account generally has some states, which are defined by the state variables in the smart contract and generate new values when the smart contract is created and executed. The smart contract generally refers to a contract that can automatically execute clauses in a digital form in a blockchain environment. Once an event triggers the clauses in the contract (meets the execution conditions), the code can be automatically executed. In the blockchain system, the relevant state of the contract is saved in the storagetrie, and the hash value of the storage trie root node is stored in the above storageroot, so that all the states of the contract are locked to the contract account through hash. The storage trie is also an MPT tree structure that stores the key-value mapping from the state address to the state value. From the root node to the leaf node of the storage trie tree, the address of a state is stored, and a leaf node stores the value of a state.
[0039] For different types of blockchain systems, the data structure of the account address and the execution environment of the smart contract may be different, and the different data structures of the account address may also lead to different data structures of transactions and receipts. For example, in a typical blockchain system, the length of the external account and the contract account is a 20-bit string, and the contract code of the deployed smart contract is required to be EVM (Ethereum Virtual Machine) bytecode; while in another typical blockchain system, the length of the external account and the contract account is a 42-bit string, and the contract code of the deployed smart contract is required to be WASM (WebAssembly) bytecode.
[0040] Figure 2 This is a technical scenario diagram of the technical solution provided in the embodiments of this specification. Figure 2As shown, the user may develop a contract code that can be executed by the blockchain system 10 for the target smart contract to be deployed by the development environment adapted to the blockchain system 10. The contract code may be, for example, EVM bytecode, and the target smart contract may be deployed in the blockchain system 10 using the contract code. In addition, the user may also develop an off-chain business system that can interact with the blockchain system 10 by adapting to the development environment adapted to the blockchain system 10. The off-chain business system may generate a transaction that conforms to the data structure required by the blockchain system and send it to the blockchain system 10. The transaction may be, for example, a contract call transaction for calling the target smart contract or a transfer transaction for transferring resources between different accounts; accordingly, the off-chain business system may also receive a receipt of the transaction from the blockchain system 10, and perform subsequent business processing on the receipt to implement related transactions.
[0041] If the types of blockchain system 10 and blockchain system 20 are different, then due to the different execution environments of smart contracts in blockchain system 10 and blockchain system 20, for example, the contract code that can be executed by blockchain system 10 is EVM bytecode and the contract code that can be executed by blockchain system 20 is WASM bytecode, it is impossible to use the contract code originally developed for the target smart contract that can be executed by blockchain system 10 to successfully deploy the target smart contract in blockchain system 20 and ensure that the target smart contract is successfully executed. In addition, due to the different data structures required for transactions in blockchain system 10 and blockchain system 20, the off-chain business system may not be able to accurately exchange information with blockchain system 20.
[0042] In view of this, at least one method and blockchain node for executing smart contracts in a blockchain system is provided in the embodiments of this specification. By utilizing the first contract code developed by the developer for the target smart contract and executable in the target blockchain system, the first smart contract corresponding to the target smart contract is deployed in other blockchain systems of a type different from the target blockchain system, and the contract state of the first smart contract includes the first contract code and the target contract state of the target smart contract; when the target smart contract needs to be executed, the blockchain system can execute the first smart contract, and in the process of executing the first smart contract, the first contract code is converted into the second contract code that can be executed by the blockchain system by using the interpreter contract, and the second contract code is executed to realize the execution of the target smart contract, thereby improving the scalability of the blockchain system.
[0043] Figure 3 This is a schematic diagram of various smart contracts deployed by the blockchain system provided in the embodiments of this specification. Figure 3As shown, the blockchain system provided in the embodiment of this specification (hereinafter referred to as blockchain system 20) at least deploys an interpreter contract corresponding to the target blockchain system (hereinafter referred to as blockchain system 10). It should be noted that the types of blockchain system 10 and blockchain system 20 are different. More specifically, the execution environment of smart contracts in blockchain system 10 and blockchain system 20 is different. For example, the contract code of smart contracts is executed by EVM in blockchain system 10, while the contract code of smart contracts is executed by other virtual machines different from EVM in blockchain system 20; in addition, as mentioned above, the accounts and account addresses in blockchain system 10 and blockchain system 20 may also have different data structures, and correspondingly, the transactions and receipts corresponding to the transactions in blockchain system 10 and blockchain system 20 may also have different data structures.
[0044] The blockchain system 20 may also deploy management contracts and status contracts corresponding to the blockchain system 10, wherein the management contract, the status contract and the interpreter contract may all be native contracts in the blockchain system 20. In addition, the blockchain system 20 may also deploy one or more EOA contracts corresponding to the blockchain system 10 and one or more CA contracts corresponding to the blockchain system 10 according to the actual needs of the specific technical scenario, wherein the aforementioned first smart contract belongs to the CA contract.
[0045] The specific functions of the management contract, status contract, EOA contract and CA contract will be described in detail below.
[0046] The management contract can be used to support users in registering EOAs that conform to the data structure required by the blockchain system 10 in the blockchain system 20, and deploying EOA contracts corresponding to the registered EOAs in the blockchain system 20.
[0047] Exemplarily, a transaction for calling the account registration function F1 included in the management contract can be sent to the blockchain system 20 by a computing device deployed with a client corresponding to the blockchain system 20. In the process of executing the account registration function F1 according to the transaction, the blockchain system 20 can achieve: registering an EOA such as A1 that meets the requirements of the blockchain system 10 in the EOA list included in the contract state of the management contract, deploying an EOA contract such as Contract A1 corresponding to A1 in the blockchain system 20 according to the pre-set EOA contract code, recording the association between the account address of A1 and the contract address of Contract A1 in the contract state of the management contract, and prompting the state contract to initialize the account state of A1 in its contract state by calling the state contract. Among them, for any EOA contract such as the aforementioned Contract A1, the EOA contract code of Contract A1 can be directly stored in the contract state of Contract A1; or, the EOA contract code can also exist in other locations such as the contract state of the management contract, and the contract state of Contract A1 can only store the storage path of the EOA contract code. When Contract A1 needs to be executed, the corresponding EOA contract code is obtained and executed according to the storage path.
[0048] It should be noted that the aforementioned EOA contract code is a bytecode that can be executed by the blockchain system 20.
[0049] The management contract can also be used to support transfers between different EOAs that meet the requirements of the blockchain system 10.
[0050] Reference Figure 4 As shown, the transfer process between different EOAs in the blockchain system 20 that meets the requirements of the blockchain system 10 may include but is not limited to part or all of the following steps S401 and S403.
[0051] When a user wishes to transfer a target resource of a target share from A1 (i.e., the second account) to A2 (i.e., the third account), a transaction Tx1 (i.e., the second transaction) that conforms to the data structure required by the blockchain system 10 can be generated first. The From field (i.e., the sender's account address) of the transaction Tx1 includes an EOA that conforms to the data structure required by the blockchain system 10, such as the account address of A1. The To field (i.e., the receiver's account address) of the transaction Tx1 includes an EOA that conforms to the data structure required by the blockchain system 10, such as the account address of A2. The Data field of the transaction Tx1 may include the target share of the target resource that is expected to be transferred. It should be noted that the transaction Tx1 may be generated, for example, by an off-chain business system that can interact with the blockchain system 10, or may be generated by a computing device that is deployed with a client corresponding to the blockchain system 20.
[0052] After obtaining the transaction Tx1 that meets the data structure required by the blockchain system 10, the following step S401 can be performed through the computing device deployed with the client corresponding to the blockchain system 20: send transaction Tx2 to the blockchain system 20, transaction Tx2 is used to call the management contract corresponding to the blockchain system 10, transaction Tx2 includes transaction Tx1, transaction Tx1 meets the data structure required by the blockchain system 10, transaction Tx1 is used to request the transfer of the target resource of the target share from A1 to A2, and the account addresses of A1 and A2 meet the data structure required by the blockchain system 10. Transaction Tx2 is the first transaction.
[0053] In step S403, the blockchain system 20 executes the management contract according to the transaction Tx2 to realize the target transaction, which includes calling the state contract corresponding to the blockchain system 10 to transfer the target resource of the target share from A1 to A2.
[0054] Transaction Tx2 is used, for example, to call the parsing function F2 included in the management contract. The blockchain system 20 can execute the parsing function F2 according to the transaction Tx2 and realize the target transaction in the process of executing the parsing function F2.
[0055] Reference Figure 5 As shown, the target transaction may include but is not limited to part or all of the following steps S4031 to S4037.
[0056] Step S4031, determine the transaction type of transaction Tx1.
[0057] Transaction types can include transfer transactions, contract deployment transactions, and contract call transactions.
[0058] The EOA list and CA list can be maintained in the contract status of the management contract. If the recipient account address of transaction Tx1 is not empty, and the recipient account address of transaction Tx1 does not exist in the CA list, the transaction type of transaction Tx1 is a transfer transaction; if the recipient account address of transaction Tx1 is empty, the transaction type of transaction Tx1 is a contract deployment transaction; if the recipient account address of transaction Tx1 is not empty, and the recipient account address of transaction Tx1 exists in the CA list, the transaction type of transaction Tx1 is a contract call transaction. It should be noted that the processing of contract deployment transactions and contract call transactions will be described in detail below, and the processing of transfer transactions will be described in detail here.
[0059] If the transaction type of transaction Tx1 is a transfer transaction, the following step S4033 or step S4035 is executed.
[0060] Step S4033, determine whether the EOA corresponding to the recipient account address of transaction Tx1 has been registered in the blockchain system 20.
[0061] Continuing with the previous example, when the recipient account address of transaction Tx1 is the account address of A2, it is possible to check whether A2 exists in the EOA list included in the contract status of the management contract. If so, it means that A2 has been registered in the blockchain system 20; or it is possible to check in the contract status of the management contract whether the association between A2's account address and the contract address of a certain EOA contract has been recorded. If so, it means that A2 has been registered in the blockchain system 20.
[0062] If yes, then the following step S4035 may be executed; otherwise, the following step S4037 may be executed directly.
[0063] Step S4035, register A2 in the blockchain system 20, deploy the EOA contract corresponding to A2 in the blockchain system 20, and call the status contract corresponding to the blockchain system 10 to enable the status contract to initialize the account status of A2.
[0064] Referring to the registration process of A1 described above, A2 can be registered in the EOA list included in the contract state of the management contract; according to the pre-set EOA contract code, an EOA contract corresponding to A2, such as Contract A2, is deployed in the blockchain system 20, and the association between the account address of A2 and the contract address of Contract A2 is recorded in the contract state of the management contract, and by calling the state contract, the state contract is prompted to initialize the account state of A2 in its contract state.
[0065] Step S4037, calling the state contract to transfer the target resource of the target share from A1 to A2.
[0066] Exemplarily, the status contract can deduct the target resource of the target share from the balance field in the account status of A1 according to the target share included in the data field of transaction Tx1, and add 1 to the value of the nonce field; correspondingly, the status contract can also increase the target resource of the target share to the balance field in the account status of A2.
[0067] In a possible implementation, when executing the management contract, a receipt corresponding to the transaction Tx1 may be generated according to the execution result of the target transaction, that is, according to the execution result of part or all of the aforementioned steps S4031 to S4037.
[0068] When transaction Tx2 is successfully executed by the blockchain system 20, the blockchain system 20 will generate a receipt corresponding to transaction Tx2 and return the receipt to the computing device; the receipt may include the receipt corresponding to transaction Tx1. When the computing device receives the receipt corresponding to transaction Tx2, it can also parse the receipt to obtain the receipt corresponding to transaction Tx1 and return the receipt corresponding to transaction Tx1 to the corresponding off-chain business system so that the off-chain business system can execute subsequent transactions.
[0069] The management contract can be used to support the deployment of a CA contract corresponding to the target smart contract in the blockchain system 20 using a first contract code developed for the target smart contract that can be executed in the blockchain system 10.
[0070] Figure 6 This is a flow chart of a method for deploying a smart contract provided in an embodiment of this specification. The method exemplarily describes the process of deploying a CA contract corresponding to a target smart contract, such as Contract B1, in the blockchain system using a first contract code created by a developer for the target smart contract and executable by the blockchain system 10.
[0071] Reference Figure 6 As shown, the method may include but is not limited to part or all of the following steps S601 and S603.
[0072] When the user wishes to deploy the target smart contract in the blockchain system 20, the transaction Tx3 (i.e., the second transaction) that conforms to the data structure required by the blockchain system 10 can be generated first. The From field (i.e., the sender's account address) of the transaction Tx3 includes the EOA that conforms to the data structure required by the blockchain system 10, such as the account address of A1, the To field (i.e., the receiver's account address) of the transaction Tx1 is null, and the Data field of the transaction Tx3 may include the first contract code of the target smart contract. With reference to the foregoing, the transaction Tx3 described herein can be generated, for example, by an off-chain business system that can interact with the blockchain system 10, or can also be generated by a computing device that is deployed with a client corresponding to the blockchain system 20.
[0073] After obtaining the transaction Tx3 that meets the data structure required by the blockchain system 10, the following step S601 can be performed based on the transaction Tx3 through a computing device deployed with the client corresponding to the blockchain system 20.
[0074] Step S601, sending transaction Tx4 to the blockchain system 20, transaction Tx4 is used to call the management contract corresponding to the blockchain system 10, transaction Tx4 includes transaction Tx3, transaction Tx3 conforms to the data structure required by the blockchain system 10, and transaction Tx3 includes the first contract code created for the target smart contract and capable of being executed in the blockchain system 10.
[0075] It can be understood that transaction Tx4 including transaction Tx3 is the first transaction.
[0076] In step S603, the blockchain system 20 executes the management contract according to transaction Tx4 to implement the target transaction, which includes: deploying a CA contract corresponding to the target smart contract, the contract state of the CA contract includes the first contract code of the target smart contract and the target contract state, and using the first account address that conforms to the data structure required by the blockchain system 10 as the contract address of the target smart contract, and recording the association between the contract address of the CA contract and the first account address in the contract state of the management contract.
[0077] Transaction Tx4, for example, is used to call the parsing function F2 included in the management contract. The blockchain system 20 can execute the parsing function F2 according to the transaction Tx4, and the target transaction can be specifically implemented in the process of executing the parsing function F2.
[0078] Reference Figure 7 As shown, the target transaction may include but is not limited to part or all of the following steps S6031 to S6040.
[0079] Step S6031, determine the transaction type of transaction Tx3.
[0080] Referring to the previous text, transaction types can include transfer transactions, contract deployment transactions, and contract call transactions.
[0081] The EOA list and CA list can be maintained in the contract status of the management contract. If the recipient account address of transaction Tx1 is not empty, and the recipient account address of transaction Tx3 does not exist in the CA list, the transaction type of transaction Tx1 is a transfer transaction; if the recipient account address of transaction Tx3 is empty, the transaction type of transaction Tx3 is a contract deployment transaction; if the recipient account address of transaction Tx3 is not empty, and the recipient account address of transaction Tx3 exists in the CA list, the transaction type of transaction Tx3 is a contract call transaction. The processing process of transfer transactions has been described in detail in the previous article, and the processing process of contract call transactions will be described in detail below. Here, only the processing process of contract deployment transactions is described.
[0082] If transaction Tx3 is a contract deployment transaction, execute the following step S6032.
[0083] Step S6032, create a CA contract corresponding to the target smart contract, the contract state of the CA contract includes the first contract code of the target smart contract, and use the first account address that conforms to the data structure required by the blockchain system 10 as the contract address of the target smart contract, and record the association between the contract address of the CA contract and the first account address in the contract state of the management contract.
[0084] Exemplarily, a CA contract such as Contract B1 corresponding to the target smart contract can be created in the blockchain system 20 according to the preset CA contract code, and the contract state of Contract B1 includes the first contract code of the target smart contract; in addition, a CA such as B1 that conforms to the data structure required by the blockchain system 10 can be registered in the CA list included in the contract state of the management contract, and B1 can be used as the CA corresponding to the target smart contract; the account address of B1 that conforms to the data structure required by the blockchain system 10 is used as the contract address of the target smart contract, and the association between the account address of B1 and the contract address of Contract B1 is recorded in the contract state of the management contract.
[0085] Step S6033, determine the EOA contract address corresponding to the sender account address of transaction Tx3.
[0086] Continuing with the previous example, assuming that the sender account address of transaction Tx3 is the account address of A1, the contract address of Contract A1 can be obtained based on the recorded association between the account address of A1 and the contract address of Contract A1.
[0087] Step S6034, calling the corresponding EOA contract according to the EOA contract address.
[0088] Continuing with the previous example, the EOA contract Contract A1 can be called according to the determined contract address of Contract A1.
[0089] Step S6035, executing the EOA contract based on the call to the EOA contract.
[0090] Continuing with the previous example, the EOA contract Contract A1 can be executed based on the call of Contract A1 by the management contract.
[0091] Step S6036, calling the CA contract according to the execution of the EOA contract.
[0092] Continuing with the previous example, the CA contract, such as Contract B1, can be called based on the execution of the EOA contract Contract A1.
[0093] Step S6037, calling the interpreter contract based on the execution of the CA contract.
[0094] Step S6038, execute the interpreter contract based on the call to the interpreter contract.
[0095] Step S6039, based on the execution of the interpreter contract, obtain the first contract code of the target smart contract from the contract state of the CA contract, and convert the first contract code into a second contract code that can be executed by the blockchain system 20.
[0096] Continuing with the previous example, the first contract code of the target smart contract can be obtained from the CA contract, such as Contract B1, and the first contract code can be converted into a second contract code that can be executed by the blockchain system 20.
[0097] Step S6040, execute the second contract code to complete initializing the target contract state of the target smart contract in the contract state of the CA contract.
[0098] That is, after completing the execution of step S6040, the contract state of the CA contract, such as Contract B1, will store the first contract code of the target smart contract and the target contract state of the target smart contract. The target contract state may include, but is not limited to, the state values corresponding to several state parameters defined in the first contract code.
[0099] The target transaction may also include calling a status contract corresponding to the blockchain system 10 according to the sender account address of transaction Tx3, such as the account address of A1, so that the status contract adds 1 to the field value of the nonce field in the account status of A1.
[0100] When executing the management contract, a receipt corresponding to transaction Tx3 may also be generated according to the execution result of the target transaction, that is, according to the execution results of some or all of the steps in the aforementioned steps S6031 to S6040. The receipt corresponding to transaction Tx3 may include, for example, but is not limited to, the contract account corresponding to the target smart contract, such as B1 and / or the account address of B1.
[0101] When transaction Tx4 is successfully executed by blockchain system 20, blockchain system 20 will generate a receipt corresponding to transaction Tx4 and return the receipt to the computing device; the receipt may include the receipt corresponding to transaction Tx3. When the computing device receives the receipt corresponding to transaction Tx4, it can also parse the receipt to obtain the receipt corresponding to transaction Tx3 and return the receipt corresponding to transaction Tx3 to the corresponding off-chain business system so that the off-chain business system can execute subsequent transactions.
[0102] The aforementioned process of deploying a CA contract is exemplary. For example, in a specific technical scenario, a transaction for deploying a CA contract such as Contract B2 may also be sent directly to the blockchain system 20 to complete the deployment of Contract B2.
[0103] The management contract can be used to support users to use the contract address of the CA contract to call the corresponding CA contract, thereby executing the corresponding target smart contract by executing the CA contract in the blockchain system 20.
[0104] Figure 8 The flowchart of a method for executing a smart contract in a blockchain system provided in an embodiment of this specification. The method exemplarily describes the process of executing a target smart contract corresponding to Contract B1 by executing Contract B1 in the blockchain system 20, by calling Contract B1 through the contract address of a CA contract such as Contract B1.
[0105] It should be noted that the aforementioned CA contract code is a bytecode that can be executed by the blockchain system 20.
[0106] Reference Figure 8 As shown, the method may include but is not limited to part or all of the following steps S801 to S813.
[0107] When the user expects to execute the target smart contract in the blockchain system 20, the transaction Tx5 (i.e., the second transaction) that conforms to the data structure required by the blockchain system 10 can be generated first. The From field (i.e., the sender's account address) of the transaction Tx5 includes the EOA that conforms to the data structure required by the blockchain system 10, such as the account address of A1, and the To field (i.e., the receiver's account address) of the transaction Tx5 can include the contract address of the target smart contract with the corresponding CA contract, such as Contract B1. The Data field of the transaction Tx5 may include the method and parameters required to call the target smart contract. With reference to the foregoing, the transaction Tx5 described herein can be generated, for example, by an off-chain business system that can interact with the blockchain system 10, or can also be generated by a computing device that is deployed with a client corresponding to the blockchain system 20.
[0108] After obtaining the transaction Tx5 that meets the data structure required by the blockchain system 10, the following step S801 can be performed based on the transaction Tx5 through a computing device deployed with the client corresponding to the blockchain system 20.
[0109] Step S801, sending transaction Tx6 to the blockchain system 20, transaction Tx6 is used to call the management contract corresponding to the blockchain system 10, transaction Tx6 includes transaction Tx5, transaction Tx5 conforms to the data structure required by the blockchain system 10, and the recipient account address of transaction Tx5 includes the contract address of the CA contract corresponding to the target smart contract.
[0110] It can be understood that transaction Tx6 including transaction Tx5 is the first transaction.
[0111] Step S803, execute the management contract according to transaction Tx6 to implement the target transaction, which at least includes: calling the CA contract according to the contract address of the CA contract.
[0112] The target transaction may also include determining the transaction type of transaction Tx5. When the transaction type of transaction Tx5 is a contract call transaction, Contract B1 may be directly called according to the recipient account address of transaction Tx5, such as the contract address of Contract B1; or, the EOA contract associated with the account address of A1, such as the contract address of Contract A1, may be determined according to the sender account address of transaction Tx5, such as the account address of A1, and then Contract A1 may be called according to the contract address of Contract A1, and Contract A1 may be executed according to the call to Contract A1, and Contract B1 may be called according to the recipient account address of transaction Tx5, such as the contract address of Contract B1, according to the execution of Contract A1.
[0113] Step S805, executing the CA contract according to the call to the CA contract.
[0114] Continuing with the previous example, Contract B1 can be executed based on the call to Contract B1 by Contract A1.
[0115] Step S807, calling the interpreter contract according to the execution of the CA contract.
[0116] Continuing with the previous example, the interpreter contract can be called based on the execution of Contract B1.
[0117] Step S809, execute the interpreter contract according to the call to the interpreter contract.
[0118] Analyzing the previous example, the interpreter contract can be executed based on the call to the interpreter contract by Contract B1.
[0119] Step S8011, according to the execution of the interpreter contract, obtain the first contract code of the target smart contract from the contract state of the CA contract, and convert the first contract code into a second contract code that can be executed by the blockchain system 20.
[0120] Continuing with the previous example, based on the execution of the interpreter contract, the first contract code of the target smart contract can be obtained from the contract state of Contract B1, and the first contract code can be converted into a second contract code that can be executed by the blockchain system 20.
[0121] Step S813, execute the second contract code, and update the target contract state of the target smart contract in the contract state of the CA contract according to the execution result.
[0122] Continuing with the previous example, the target contract state of the target smart contract can be updated in the contract state of Contract B1 according to the execution result of the second contract code.
[0123] The target transaction may also include calling the status contract corresponding to the blockchain system 10 according to the sender account address of the transaction Tx5, such as A1, and prompting the status contract to add 1 to the field value under the nonce field in the account status of A1.
[0124] When executing the management contract, a receipt corresponding to transaction Tx5 can also be generated according to the execution result of the target transaction, that is, according to the execution results of some or all of the steps in the aforementioned steps S803 to S813. When transaction Tx6 is successfully executed by the blockchain system 20, the blockchain system 20 will generate a receipt corresponding to transaction Tx6 and return the receipt to the computing device; wherein the receipt may include a receipt corresponding to transaction Tx5. When the computing device receives the receipt corresponding to transaction Tx6, it can also parse the receipt to obtain the receipt corresponding to transaction Tx5, and return the receipt corresponding to transaction Tx5 to the corresponding off-chain business system so that the off-chain business system can execute subsequent transactions.
[0125] Based on the same concept as the aforementioned method embodiment, the embodiment of this specification also provides a blockchain node in a blockchain system, wherein a first smart contract and an interpreter contract are deployed in the blockchain system, and the contract state of the first smart contract includes a first contract code and a target contract state of a target smart contract, and the first contract code is a bytecode that can be executed by the target blockchain system. The blockchain node is configured to: in the process of executing the first smart contract, execute the interpreter contract according to the call of the interpreter contract by the first smart contract; obtain the first contract code according to the execution of the interpreter contract, and convert the first contract code into a second contract code that can be executed by the blockchain system; execute the second contract code, and update the target contract state according to the execution result.
[0126] Based on the same concept as the aforementioned method embodiment, this specification embodiment also provides a computing device 900, in which a first smart contract and an interpreter contract are deployed in the blockchain system connected to the computing device 900, and the contract state of the first smart contract includes the first contract code of the target smart contract and the target contract state, and the first contract code is a bytecode that can be executed by the target blockchain system. Fig. 9 As shown, the computing device 900 includes: a transaction generation unit 901, configured to generate a first transaction; a communication processing unit 903, configured to send the first transaction to the blockchain system, so that the blockchain system, in the process of executing the first smart contract according to the first transaction, uses the interpreter contract to convert the first contract code into a second contract code that can be executed by the blockchain system, executes the second contract code, and updates the target contract state according to the execution result.
[0127] A computer-readable storage medium is also provided in an embodiment of the present specification, on which a computer program / instruction is stored. When the computer program / instruction is executed in a computer, the computer is caused to execute the method steps performed by the computing device or blockchain system in the aforementioned embodiments.
[0128] A computing device is also provided in an embodiment of the present specification, including a memory and a processor, wherein the memory stores a computer program / instruction, and when the processor executes the computer program / instruction, the method steps performed by the computing device or the blockchain system in the aforementioned embodiments are implemented.
[0129] In the 1990s, improvements to a technology could be clearly distinguished as hardware improvements (for example, improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the method flow). However, with the development of technology, many improvements to the method flow today can be regarded as direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that an improvement in a method flow cannot be implemented using a hardware entity module. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to ask a chip manufacturer to design and produce a dedicated integrated circuit chip. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.
[0130] The controller can be implemented in any appropriate manner, for example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (such as software or firmware) that can be executed by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that in addition to implementing the controller in a purely computer-readable program code manner, the controller can be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, this controller can be considered as a hardware component, and the devices included therein for implementing various functions can also be regarded as structures within the hardware component. Or even, the devices for implementing various functions can be regarded as both software modules for implementing the method and structures within the hardware component.
[0131] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a server system. Of course, the present application does not exclude that with the development of computer technology in the future, the computer that implements the functions of the above embodiments may be, for example, a personal computer, a laptop computer, a vehicle-mounted human-computer interaction device, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0132] Although one or more embodiments of the present specification provide method transaction steps as described in the embodiments or flow charts, more or less transaction steps may be included based on conventional or non-creative means. The order of steps listed in the embodiments is only one way of executing the order of many steps, and does not represent the only execution order. When the device or terminal product in practice is executed, it can be executed in sequence or in parallel according to the method shown in the embodiments or the drawings (for example, a parallel processor or a multi-threaded processing environment, or even a distributed data processing environment). The term "include", "include" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, product or equipment including a series of elements includes not only those elements, but also includes other elements that are not explicitly listed, or also includes elements inherent to such a process, method, product or equipment. In the absence of more restrictions, it is not excluded that there are other identical or equivalent elements in the process, method, product or equipment including the elements. For example, if the words first, second, etc. are used to represent the name, they do not represent any specific order.
[0133] For the convenience of description, the above devices are described in various modules according to their functions. Of course, when implementing one or more of the present specification, the functions of each module can be implemented in the same or more software and / or hardware, or the module implementing the same function can be implemented by a combination of multiple sub-modules or sub-units, etc. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0134] The present invention is described with reference to flowcharts and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0135] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0136] These computer program instructions may also be loaded onto a computer or other programmable data processing device so that a series of transaction steps are executed on the computer or other programmable device to produce a computer-implemented process, whereby the instructions executed on the computer or other programmable device provide for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0137] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0138] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0139] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules 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 disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic disk storage, graphene storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0140] It should be understood by those skilled in the art that one or more embodiments of the present specification may be provided as a method, system or computer program product. Therefore, one or more embodiments of the present specification may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, one or more embodiments of the present specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0141] One or more embodiments of the present specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. One or more embodiments of the present specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0142] Each embodiment in this specification is described in a progressive manner, and the same and similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. In the description of this specification, the description of the reference terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of this specification. In this specification, the schematic representation of the above terms does not necessarily target the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner. In addition, in the absence of mutual contradiction, a person skilled in the art can combine and combine the different embodiments or examples described in this specification and the features of different embodiments or examples.
[0143] The above description is only an example of one or more embodiments of the present specification and is not intended to limit one or more embodiments of the present specification. For those skilled in the art, one or more embodiments of the present specification may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present specification shall be included in the scope of the claims.
Claims
1. A method for executing a smart contract in a blockchain system, wherein a first smart contract and an interpreter contract are deployed in the blockchain system, wherein the contract state of the first smart contract includes a first contract code of a target smart contract and a target contract state, wherein the first contract code is a bytecode that can be executed by the target blockchain system, and wherein the method comprises: In the process of executing the first smart contract, executing the interpreter contract according to the call of the first smart contract to the interpreter contract; According to the execution of the interpreter contract, the first contract code is obtained, and the first contract code is converted into a second contract code that can be executed by the blockchain system; Execute the second contract code and update the target contract state according to the execution result.
2. According to the method of claim 1, a management contract corresponding to the target blockchain system is also deployed in the blockchain system, and the contract state of the management contract records a first association relationship between the contract address of the first smart contract and the first account address, and the first account address conforms to the data structure required by the target blockchain system; in, The method further comprises: Receiving a first transaction for invoking the management contract, wherein the first transaction includes a second transaction, and the second transaction complies with a data structure required by the target blockchain system; Execute the management contract according to the first transaction to achieve a target transaction, wherein the target transaction includes: When the recipient account address of the second transaction includes the first account address, calling the first smart contract according to the first account address and the first association relationship; Execute the first smart contract according to the call of the first smart contract.
3. According to the method of claim 2, a second smart contract is also deployed in the blockchain system, and the contract state of the management contract records a second association relationship between the contract address of the second smart contract and the second account address, the second account address conforms to the data structure required by the target blockchain system, and the sender account address of the second transaction is the second account address; wherein, The calling the first smart contract according to the first account address includes: calling the second smart contract according to the second account address and the second association relationship, so that the second smart contract calls the first smart contract according to the first account address.
4. According to the method of claim 2, a state contract corresponding to the target blockchain system is also deployed in the blockchain system, and the contract state of the state contract includes the account states of the second account and the third account, and the second account address of the second account and the third account address of the third account conform to the data structure required by the target blockchain system; in, The target transaction also includes: when the second transaction is used to request to transfer a target share of target resources from the second account to the third account, calling the state contract so that the state contract transfers the target share of target resources from the second account to the third account.
5. The method according to claim 4, wherein the target transaction further comprises: Determine whether a third smart contract corresponding to the third account has been deployed; if not, deploy the third smart contract corresponding to the third account, and record a third association relationship between the contract address of the third smart contract and the third account address in the contract state of the management contract.
6. The method according to claim 4, wherein deploying a third smart contract corresponding to the third account comprises: According to the third contract code pre-set in the blockchain system, the third smart contract is deployed, and the contract state of the third smart contract includes the third contract code or the storage path of the third contract code.
7. The method according to claim 2, wherein the target transaction further comprises: When the second transaction is used to request deployment of the target smart contract, the first smart contract is deployed, the first account address is used as the contract address of the target smart contract, and the first association relationship is recorded in the contract state of the management contract.
8. The method according to claim 7, wherein deploying the first smart contract comprises: According to the fourth contract code pre-set in the blockchain system, the first smart contract is deployed, and the contract state of the first smart contract includes the storage path of the fourth contract code or the third contract code.
9. The method according to claim 2, wherein executing the management contract according to the first transaction further implements: generating a second receipt corresponding to the second transaction according to the execution result of the target transaction, wherein the second receipt conforms to the data structure required by the target blockchain system; wherein, The method further includes generating a first receipt corresponding to the first transaction, wherein the first receipt includes the second receipt.
10. The method according to any one of claims 1 to 9, further comprising: Receiving a first transaction for invoking the first smart contract, where the recipient account address of the first transaction is the contract address of the first smart contract; Execute the first smart contract according to the first transaction.
11. A method for executing a smart contract in a blockchain system, wherein a first smart contract and an interpreter contract are deployed in the blockchain system, the contract state of the first smart contract includes a first contract code of a target smart contract and a target contract state, the first contract code is a bytecode that can be executed by the target blockchain system, and the method comprises: generating a first transaction; The first transaction is sent to the blockchain system, so that the blockchain system, in the process of executing the first smart contract according to the first transaction, uses the interpreter contract to convert the first contract code into a second contract code that can be executed by the blockchain system, executes the second contract code, and updates the target contract state according to the execution result.
12. According to the method of claim 11, a management contract corresponding to the target blockchain system is also deployed in the blockchain system, and the contract state of the management contract records a first association relationship between the contract address of the first smart contract and the first account address, and the first account address conforms to the data structure required by the target blockchain system; in, The method also includes: generating a second transaction, the second transaction conforming to the data structure required by the target blockchain system, the second transaction being included in the first transaction, and the first transaction being used to call the management contract.
13. According to the method of claim 12, a second smart contract is also deployed in the blockchain system, and the contract state of the management contract records the association between the contract address of the second smart contract and the second account address, and the second account address conforms to the data structure required by the target blockchain system; wherein, The sender account address of the second transaction is the second account address.
14. According to the method of claim 12, a status contract corresponding to the target blockchain system is also deployed in the blockchain system, and the contract state of the status contract includes the account status of the second account and the third account, and the second account address of the second account and the third account address of the third account both conform to the data structure required by the target blockchain system; wherein the second transaction is used to request the transfer of a target share of target resources from the second account to the third account.
15. The method according to claim 12, wherein the second transaction is used to request deployment of the target smart contract.
16. A blockchain node in a blockchain system, wherein a first smart contract and an interpreter contract are deployed in the blockchain system, wherein the contract state of the first smart contract includes a first contract code of a target smart contract and a target contract state, wherein the first contract code is a bytecode that can be executed by a target blockchain system, and wherein the blockchain node is configured to: in the process of executing the first smart contract, execute the interpreter contract according to a call to the interpreter contract by the first smart contract; obtain the first contract code according to the execution of the interpreter contract, and convert the first contract code into a second contract code that can be executed by the blockchain system; execute the second contract code, and update the target contract state according to the execution result.
17. A computing device, wherein a first smart contract and an interpreter contract are deployed in a blockchain system to which the computing device is connected, wherein the contract state of the first smart contract includes a first contract code of a target smart contract and a target contract state, wherein the first contract code is a bytecode that can be executed by the target blockchain system, and wherein the computing device comprises: a transaction generating unit, configured to generate a first transaction; The communication processing unit is configured to send the first transaction to the blockchain system, so that the blockchain system, in the process of executing the first smart contract according to the first transaction, uses the interpreter contract to convert the first contract code into a second contract code that can be executed by the blockchain system, executes the second contract code, and updates the target contract state according to the execution result.
18. A computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed in a computing device, the computing device executes the method according to any one of claims 1 to 10.