# US 2022/0066756 A1 · Method for executing smart contract, blockchain node, and storage medium

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2022/0066756 A1
- Document ID: US20220066756A1
- Status: Published application
- Kind: A1
- Application number: 17/351,991
- Filed: 2021-06-18
- Published: 2022-03-03
- Earliest claimed: 2020-08-31
- Assignees: Alipay (Hangzhou) Information Technology Co., Ltd.
- Applicants: Alipay (Hangzhou) Information Technology Co., Ltd.
- Inventors: Ying YAN; Changzheng WEI; Xuepeng GUO
- Web page: https://patentgrep.com/patent/US20220066756A1

## CPC

- G06F 8/44: {Encoding}
- G06F 21/125: {by manipulating the program code, e.g. source code, compiled code, interpreted code, machine code}
- G06F 8/60: Software deployment
- G06F 9/45508: {Runtime interpretation or emulation, e g. emulator loops, bytecode interpretation}
- G06F 9/4843: {by program, e.g. task dispatcher, supervisor, operating system}
- G06F 16/245: Query processing
- G06Q 20/02: involving a neutral party, e.g. certification authority, notary or trusted third party [TTP]
- G06Q 10/10: Office automation; Time management
- G06Q 20/389: {Keeping log of transactions for guaranteeing non-repudiation of a transaction}
- G06Q 2220/00: Business processing using cryptography
- H04L 9/3236: {using cryptographic hash functions}
- H04L 9/50: {using hash chains, e.g. blockchains or hash trees}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- G06Q: INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- H04L: TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION (arrangements common to telegraphic and telephonic communication H04M)

## Abstract

The present specification provides a method for executing a smart contract, a blockchain node, and a storage medium. An implementation of a method for executing a smart contract includes: receiving, by a blockchain node, a request for creating a smart contract, the request including a bytecode of the smart contract; starting, by the blockchain node after completing deployment of the smart contract, to compile the bytecode of the smart contract into a machine code by using ahead of time (AoT) compilation and storing the machine code; and during execution of a smart contract that has been deployed, interpreting and executing, by the blockchain node, a bytecode of the smart contract in response to that a machine code of the smart contract is not locally stored.

## Claims

### Claim 1

A method for executing a smart contract, comprising:
starting, by a blockchain node of a blockchain network after a smart contract of bytecodes has been deployed in the blockchain network, to compile a bytecode of the bytecodes of the smart contract into a machine code by using ahead of time (AoT) compilation and storing the machine code; and
interpreting and executing, by the blockchain node in executing the smart contract that has been deployed, a bytecode of the smart contract in response to a machine code of the smart contract not being locally stored.

### Claim 2 (depends on 1)

The method according to claim 1, wherein the starting to compile the bytecode of the smart contract into the machine code by using AoT compilation includes:
starting, by the blockchain node right after the smart contract has been deployed in the blockchain network, AoT compilation on the bytecode of the smart contract; or
performing, by the blockchain node after the smart contract has been deployed in the blockchain network, AoT compilation on the bytecode of the smart contract within a determined idle time period.

### Claim 3 (depends on 1)

The method according to claim 1, wherein the interpreting and executing, by the blockchain node, the bytecode of the smart contract includes:
interpreting and executing, by the blockchain node, the bytecode corresponding to an invoked function in the smart contract.

### Claim 4 (depends on 1)

The method according to claim 1, wherein the interpreting and executing, by the blockchain node in executing the smart contract that has been deployed, the bytecode of the smart contract in response to the machine code of the smart contract not being locally stored includes:
querying, by the blockchain node in executing the smart contract, a current AoT compilation status of the bytecode of the smart contract in response to the machine code of the smart contract not being locally stored;
in response to that the bytecode is in AoT compilation, interpreting and executing the bytecode of the smart contract; and
in response to that the bytecode is not in AoT compilation, starting AoT compilation to interpret and execute the bytecode of the smart contract.

### Claim 5 (depends on 1)

The method according to claim 1, comprising:
in the executing the smart contract that has been deployed, executing, by the blockchain node, a machine code of the smart contract in response to the machine code being locally stored.

### Claim 6 (depends on 5)

The method according to claim 5, wherein the executing, by the blockchain node, the machine code includes:
executing, by the blockchain node, a stored machine code corresponding to an invoked function in the smart contract.

### Claim 7 (depends on 1)

The method according to claim 1, wherein the storing is caching.

### Claim 8 (depends on 1)

The method according to claim 1, comprising:
receiving, by the blockchain node, a request for deploying the smart contract in the blockchain network, the request including the bytecodes of the smart contract; and
causing, by the blockchain node, deployment of the smart contract in the blockchain network.

### Claim 9

A blockchain node for executing a smart contract, comprising:
a processor; and
a memory coupled to the processor and having executable instructions stored thereon that are executable by the processor to perform acts including:
starting, after a smart contract of bytecodes has been deployed in a blockchain network, to compile a bytecode of the bytecodes of the smart contract into a machine code by using ahead of time (AoT) compilation and storing the machine code; and
interpreting and executing, in executing the smart contract that has been deployed, a bytecode of the smart contract in response to a machine code of the smart contract not being locally stored.

### Claim 10 (depends on 9)

The blockchain node according to claim 9, wherein the starting to compile the bytecode of the smart contract into the machine code by using AoT compilation includes:
starting, right after the smart contract has been deployed in the blockchain network, AoT compilation on the bytecode of the smart contract; or
performing, after the smart contract has been deployed in the blockchain network, AoT compilation on the bytecode of the smart contract within a determined idle time period.

### Claim 11 (depends on 9)

The blockchain node according to claim 9, wherein the interpreting and executing, by the blockchain node, the bytecode of the smart contract includes:
interpreting and executing the bytecode corresponding to an invoked function in the smart contract.

### Claim 12 (depends on 9)

The blockchain node according to claim 9, wherein the interpreting and executing, in executing the smart contract that has been deployed, the bytecode of the smart contract in response to the machine code of the smart contract not being locally stored includes:
querying, in executing the smart contract, a current AoT compilation status of the bytecode of the smart contract in response to the machine code of the smart contract not being locally stored;
in response to that the bytecode is in AoT compilation, interpreting and executing the bytecode of the smart contract; and
in response to that the bytecode is not in AoT compilation, starting AoT compilation to interpret and execute the bytecode of the smart contract.

### Claim 13 (depends on 9)

The blockchain node according to claim 9, wherein the acts include:
in the executing the smart contract that has been deployed, executing a machine code of the smart contract in response to the machine code being locally stored.

### Claim 14 (depends on 13)

The blockchain node according to claim 13, wherein the executing, by the blockchain node, the machine code includes:
executing, by the blockchain node, a stored machine code corresponding to an invoked function in the smart contract.

### Claim 15 (depends on 9)

The blockchain node according to claim 9, wherein the storing is caching.

### Claim 16 (depends on 9)

The blockchain node according to claim 9, wherein the acts include:
receiving, by the blockchain node, a request for deploying the smart contract in the blockchain network, the request including the bytecodes of the smart contract; and
causing, by the blockchain node, deployment of the smart contract in the blockchain network.

### Claim 17

A non-transitory storage medium, the storage medium having executable instructions stored thereon that are executable by one or more processors to perform acts including:
starting, after a smart contract of bytecodes has been deployed in a blockchain network, to compile a bytecode of the bytecodes of the smart contract into a machine code by using ahead of time (AoT) compilation and storing the machine code; and
interpreting and executing, in executing the smart contract that has been deployed, a bytecode of the smart contract in response to a machine code of the smart contract not being locally stored.

### Claim 18 (depends on 17)

The storage medium according to claim 17, wherein the interpreting and executing, in executing the smart contract that has been deployed, the bytecode of the smart contract in response to the machine code of the smart contract not being locally stored includes:
querying, in executing the smart contract, a current AoT compilation status of the bytecode of the smart contract in response to the machine code of the smart contract not being locally stored;
in response to that the bytecode is in AoT compilation, interpreting and executing the bytecode of the smart contract; and
in response to that the bytecode is not in AoT compilation, starting AoT compilation to interpret and execute the bytecode of the smart contract.

### Claim 19 (depends on 17)

The storage medium according to claim 17, wherein the acts include:
in the executing the smart contract that has been deployed, executing a machine code of the smart contract in response to the machine code being locally stored.

### Claim 20 (depends on 17)

The storage medium according to claim 17, wherein the acts include:
receiving, by the blockchain node, a request for deploying the smart contract in the blockchain network, the request including the bytecodes of the smart contract; and
causing, by the blockchain node, deployment of the smart contract in the blockchain network.
