# US 12,008,556 B2 · Method and apparatus for executing smart contract

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

- Number: US 12,008,556 B2
- Document ID: US12008556B2
- Status: Granted
- Kind: B2
- Application number: 17/630,647
- Filed: 2020-03-03
- Published: 2022-08-18
- Granted: 2024-06-11
- Earliest claimed: 2019-09-24
- Assignees: Jingdong Technology Information Technology Co., Ltd.
- Applicants: Jingdong Technology Information Technology Co., Ltd.
- Inventors: Zhuguang Shao
- Web page: https://patentgrep.com/patent/US12008556B2

## CPC

- G06F 16/178: Techniques for file synchronisation in file systems
- G06Q 20/3825: {Use of electronic signatures}
- G06Q 20/065: {using e-cash}
- G06Q 20/401: {Transaction verification}
- G06Q 30/06: Buying, selling or leasing transactions
- G06Q 40/04: Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
- H04L 9/3236: {using cryptographic hash functions}
- H04L 9/50: {using hash chains, e.g. blockchains or hash trees}
- G06Q 2220/00: Business processing using cryptography
- H04L 2209/463: Electronic voting
- H04L 2209/56: Financial cryptography, e.g. electronic payment or e-cash
- 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

A method and apparatus for executing a smart contract are provided. The method includes: in response to determining that a preset execution moment for executing a smart contract is reached, determining whether a transaction to be executed sent by another node in a blockchain system and used for executing the smart contract has been received; in response to determining that said transaction submitted by the another node has not been received, generating a transaction to be executed corresponding to the current node, and sending said generated transaction to the blockchain system; performing consensus with the another node on said transaction corresponding to the smart contract; and obtaining and executing the smart contract according to said transaction on which the consensus is performed.

## Claims

### Claim 1

A method for executing a smart contract, wherein the method is performed by a node in a blockchain system and the method comprises:
determining whether the node belongs to a preset permission node of the smart contract;
determining, in response to determining that the node belongs to the preset permission node of the smart contract, whether a preset executing moment for executing the smart contract is reached;
determining, in response to determining that the preset executing moment for executing the smart contract is reached, whether a to-be-executed transaction sent by another node in the blockchain system and used for executing the smart contract has been received;
in response to determining that the to-be-executed transaction submitted by the another node has not been received, generating a to-be-executed transaction corresponding to the node, and sending the generated to-be-executed transaction to the blockchain system;
performing consensus with the another node on the to-be-executed transaction corresponding to the smart contract; and
obtaining and executing the smart contract according to the to-be-executed transaction on which the consensus is performed.

### Claim 2 (depends on 1)

The method according to claim 1, wherein the sending the generated to-be-executed transaction to the blockchain system, comprises:
sending the generated to-be-executed transaction to a non-permission node in the blockchain system, to cause the non-permission node to execute following operations:
determining whether the node sending the to-be-executed transaction belongs to the preset permission node of the smart contract;
in response to determining that the node sending the to-be-executed transaction belongs to the preset permission node of the smart contract, determining whether the to-be-executed transaction sent by the another node in the blockchain system has been received, and/or whether the consensus has been performed with the another node on the to-be-executed transaction corresponding to the smart contract;
sending, in response to determining that the to-be-executed transaction submitted by the another node has not been received, and/or determining that the consensus has not been performed with the another node on the to-be-executed transaction corresponding to the smart contract, the received to-be-executed transaction to the blockchain system; and
performing consensus with the another node on the to-be-executed transaction corresponding to the smart contract.

### Claim 3 (depends on 1)

The method according to claim 1, wherein the method further comprises:
performing the to-be-executed transaction on which the consensus is performed to record the to-be-executed transaction on which the consensus is performed.

### Claim 4 (depends on 3)

The method according to claim 3, wherein the to-be-executed transaction comprises signature information of the node that generates the to-be-executed transaction; and
the performing the to-be-executed transaction on which the consensus is performed to record the to-be-executed transaction on which the consensus is performed, comprises:
deleting the signature information in the to-be-executed transaction on which the consensus is performed, and executing the to-be-executed transaction on which the consensus is performed with the signature information deleted, to record the to-be-executed transaction on which the consensus is performed with the signature information deleted.

### Claim 5 (depends on 1)

The method according to claim 1, wherein the method further comprises:
receiving a submission transaction for submitting the smart contract, wherein the submission transaction comprises the preset executing moment for executing the smart contract;
determining whether the submission transaction is an abnormal submission transaction;
sending, in response to determining that the submission transaction is not an abnormal submission transaction, the submission transaction to the blockchain system;
performing consensus with the another node on the submission transaction corresponding to the smart contract; and
performing the submission transaction on which the consensus is performed to record the submission transaction on which the consensus is performed.

### Claim 6 (depends on 5)

The method according to claim 5, wherein the submission transaction further comprises at least one of: the smart contract, a contract identifier for identifying the smart contract, preset permission node information, a preset number of times of execution, or a preset execution time interval.

### Claim 7

An apparatus for executing a smart contract, the apparatus comprising:
one or more processors; and
a storage apparatus storing one or more programs thereon;
wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to perform operations, comprising:
determining whether a current node belongs to a preset permission node of the smart contract;
determining, in response to determining that the current node belongs to the preset permission node of the smart contract, whether a preset executing moment for executing the smart contract is reached;
determining, in response to determining that the preset executing moment for executing the smart contract is reached, whether a to-be-executed transaction sent by another node in a blockchain system where the current node is located and used for executing the smart contract has been received;
in response to determining that the to-be-executed transaction submitted by the another node has not been received, generating a to-be-executed transaction corresponding to the current node, and sending the generated to-be-executed transaction to the blockchain system;
performing consensus with the another node on the to-be-executed transaction corresponding to the smart contract; and
obtaining and execute the smart contract according to the to-be-executed transaction on which the consensus is performed.

### Claim 8 (depends on 7)

The apparatus according to claim 7, wherein the sending the generated to-be-executed transaction to the blockchain system, comprises:
sending the generated to-be-executed transaction to a non-permission node in the blockchain system, to cause the non-permission node to execute following operations:
determining whether the node sending the to-be-executed transaction belongs to the preset permission node of the smart contract;
in response to determining that the node sending the to-be-executed transaction belongs to the preset permission node of the smart contract, determining whether the to-be-executed transaction sent by the another node in the blockchain system has been received, and/or whether the consensus has been performed with the another node on the to-be-executed transaction corresponding to the smart contract;
sending, in response to determining that the to-be-executed transaction submitted by the another node has not been received, and/or determining that the consensus has not been performed with the another node on the to-be-executed transaction corresponding to the smart contract, the received to-be-executed transaction to the blockchain system; and
performing consensus with the another node on the to-be-executed transaction corresponding to the smart contract.

### Claim 9 (depends on 7)

The apparatus according to claim 7, wherein the operations further comprise: performing the to-be-executed transaction on which the consensus is performed to record the to-be-executed transaction on which the consensus is performed.

### Claim 10 (depends on 9)

The apparatus according to claim 9, wherein the to-be-executed transaction comprises signature information of the node that generates the to-be-executed transaction; and
the performing the to-be-executed transaction on which the consensus is performed to record the to-be-executed transaction on which the consensus is performed, comprises: deleting the signature information in the to-be-executed transaction on which the consensus is performed, and executing the to-be-executed transaction on which the consensus is performed with the signature information deleted, to record the to-be-executed transaction on which the consensus is performed with the signature information deleted.

### Claim 11 (depends on 7)

The apparatus according to claim 7, wherein the operations further comprise: receiving a submission transaction for submitting the smart contract, wherein the submission transaction comprises the preset executing moment for executing the smart contract;
determining whether the submission transaction is an abnormal submission transaction;
sending, in response to determining that the submission transaction is not an abnormal submission transaction, the submission transaction to the blockchain system;
performing consensus with the another node on the submission transaction corresponding to the smart contract; and
performing the submission transaction on which the consensus is performed to record the submission transaction on which the consensus is performed.

### Claim 12 (depends on 11)

The apparatus according to claim 11, wherein the submission transaction further comprises at least one of: the smart contract, a contract identifier for identifying the smart contract, preset permission node information, a preset number of times of execution, or a preset execution time interval.

### Claim 13

A non-transitory computer-readable medium storing a computer program thereon, wherein the program, when executed by a processor, causes the processor to perform operations, comprising:
determining whether a current node belongs to a preset permission node of the smart contract;
determining, in response to determining that the current node belongs to the preset permission node of the smart contract, whether a preset executing moment for executing the smart contract is reached;
determining, in response to determining that the preset executing moment for executing the smart contract is reached, whether a to-be-executed transaction sent by another node in a blockchain system where the current node is located and used for executing the smart contract has been received;
in response to determining that the to-be-executed transaction submitted by the another node has not been received, generating a to-be-executed transaction corresponding to the current node, and sending the generated to-be-executed transaction to the blockchain system;
performing consensus with the another node on the to-be-executed transaction corresponding to the smart contract; and
obtaining and execute the smart contract according to the to-be-executed transaction on which the consensus is performed.
