System and method for implementing different types of blockchain contracts
AssigneeAdvanced New Technologies Co., Ltd.
InventorHe Sun
Life of this patent
Estimating the term…
Abstract
Methods, systems, and apparatus, including computer programs encoded on computer storage media, for implementing blockchain contracts are provided. One of the methods includes: obtaining bytecode of a blockchain contract, wherein the bytecode comprises an indicator indicating a type of the blockchain contract; determining a virtual machine corresponding to the type based at least on the indicator; and triggering the determined virtual machine to execute the blockchain contract.
Claims20
A computer-implemented method, comprising:
- detecting, by a client, (1) user-input first raw source code of a first blockchain contract written in a high-level programming language other than Solidity and (2) user-input second raw source code of a second blockchain contract written in Solidity;
- generating, by the client, first raw bytecode by compiling the first raw source code, and generating, by the client, second raw bytecode by compiling the second raw source code;
- adding, by the client, (1) a first indicator into the first raw bytecode to obtain first bytecode and (2) a second indicator into the second raw bytecode to obtain second bytecode, the first indicator indicating that the first blockchain contract is a native contract, the second indicator indicating that the second blockchain contract is a Solidity contract;
- and
- transmitting, by the client, the first bytecode and the second bytecode to a blockchain node for the blockchain node to (1) trigger a first language-specific virtual machine corresponding to the first indicator to execute the first blockchain contract and (2) trigger a second language-specific virtual machine corresponding to the second indicator to execute the second blockchain contract, wherein the blockchain node comprises a plurality of language-specific virtual machines configured to respectively execute bytecode of a plurality of blockchain contracts written in different high-level programming languages.
A non-transitory computer-readable storage medium storing instructions that, when executed by one or more processors, cause the one or more processors to perform operations comprising, comprising:
- detecting (1) user-input first raw source code of a first blockchain contract written in a high-level programming language other than Solidity and (2) user-input second raw source code of a second blockchain contract written in Solidity;
- generating first raw bytecode by compiling the first raw source code, and generating second raw bytecode by compiling the second raw source code;
- adding (1) a first indicator into the first raw bytecode to obtain first bytecode and (2) a second indicator into the second raw bytecode to obtain second bytecode, the first indicator indicating that the first blockchain contract is a native contract, the second indicator indicating that the second blockchain contract is a Solidity contract;
- and
- transmitting the first bytecode and the second bytecode to a blockchain node for the blockchain node to (1) trigger a first language-specific virtual machine corresponding to the first indicator to execute the first blockchain contract and (2) trigger a second language-specific virtual machine corresponding to the second indicator to execute the second blockchain contract, wherein the blockchain node comprises a plurality of language-specific virtual machines configured to respectively execute bytecode of a plurality of blockchain contracts written in different high-level programming languages.
A system comprising one or more processors and one or more non-transitory computer-readable memories coupled to the one or more processors and configured with instructions executable by the one or more processors to cause the system to perform operations comprising:
- detecting (1) user-input first raw source code of a first blockchain contract written in a high-level programming language other than Solidity and (2) user-input second raw source code of a second blockchain contract written in Solidity;
- generating first raw bytecode by compiling the first raw source code, and generating second raw bytecode by compiling the second raw source code;
- adding (1) a first indicator into the first raw bytecode to obtain first bytecode and (2) a second indicator into the second raw bytecode to obtain second bytecode, the first indicator indicating that the first blockchain contract is a native contract, the second indicator indicating that the second blockchain contract is a Solidity contract;
- and
- transmitting the first bytecode and the second bytecode to a blockchain node for the blockchain node to (1) trigger a first language-specific virtual machine corresponding to the first indicator to execute the first blockchain contract and (2) trigger a second language-specific virtual machine corresponding to the second indicator to execute the second blockchain contract, wherein the blockchain node comprises a plurality of language-specific virtual machines configured to respectively execute bytecode of a plurality of blockchain contracts written in different high-level programming languages.
Dependencies are inferred from the claim text.