IP Library Granted Patent US 11,354,727
Granted Patent B2
US 11,354,727 · App. 16/342,513 · Granted Jun 7, 2022

System and method for improving security of smart contract on blockchain

Inventor: Zhongxiao Yao (Hangzhou, CN)
Assignee: Advanced New Technologies Co., Ltd.
G06Q30/0637G06Q20/388G06Q20/405H04L9/0618H04L2209/38
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 11,354,727
App. No.
16/342,513
Granted
Jun 7, 2022
Kind
B2
Abstract

A computer-implemented method for improving security of smart contract comprises: obtaining a first and a second transactions both invoking a smart contract, wherein the first transaction is associated with a protection condition; executing the second transaction and updating a current state of the smart contract; determining whether the updated current state of the smart contract satisfies the protection condition; in response to determining that the updated current state satisfies the protection condition, executing the first transaction, and recording the second and the first transactions into a data block for adding to a blockchain; and in response to determining that the updated current state does not satisfy the protection condition, recording the second transaction into another data block for adding to the blockchain, without executing the first transaction.

Claims (62)

1. A computer-implemented method for improving security of smart contract, comprising:

obtaining a first transaction and a second transaction both invoking a smart contract without a specified order of execution and both for adding to a blockchain and an execution condition that protects execution of the first transaction from execution of the second transaction, wherein the first transaction and the second transaction are among a plurality of unconfirmed transactions to be added into a new data block for adding to the blockchain through a consensus network;

adding the execution condition to the first transaction to avoid unintended outcome due to Transaction-Ordering Dependence (TOD) of the unconfirmed transactions to be added in the new data block through the consensus network;

executing the second transaction and updating a current state of the smart contract according at least to the execution of the second transaction;

when the first transaction calls the updated current state of the smart contract, determining whether the updated current state of the smart contract satisfies the execution condition;

when determining that the updated current state satisfies the execution condition, determining that the unintended outcome due to TOD is avoided, executing the first transaction after the execution of the second transaction, and recording the executions of the second and the first transactions into the new data block for adding to the blockchain; and

when determining that the updated current state does not satisfy the execution condition, recording the executions of the second transaction into the new data block for adding to the blockchain and discarding the first transaction.

2. The method of claim 1 , further comprising:

when determining that the updated current state does not satisfy the execution condition, returning an execution exception to a computing device that submitted the first transaction.

3. The method of claim 1 , wherein:

the current state comprises a current price of a transactional item of the smart contract; and

the execution condition is associated with a price range, an amount range, or a time range of the transactional item.

4. The method of claim 3 , wherein:

the first transaction is associated with a purchase order of the transactional item at the price range; and

the second transaction is associated with a sales order of selling the transactional item.

5. The method of claim 1 , wherein:

the execution condition is auto-generated based on the first transaction.

6. The method of claim 1 , wherein:

the execution condition is submitted by a computing device that submitted the first transaction.

7. The method of claim 1 , wherein:

obtaining the first transaction and the second transaction comprises obtaining the first transaction and the second transaction from a pool database.

8. The method of claim 1 , wherein:

a plurality of nodes each comprise a memory for storing a copy of the blockchain as a ledger; and

the nodes are configured to update the ledger when the data block is added to the blockchain.

9. A system for improving security of smart contract, 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:

obtaining a first transaction and a second transaction both invoking a smart contract without a specified order of execution and both for adding to a blockchain and an execution condition that protects execution of the first transaction from execution of the second transaction, wherein the first transaction and the second transaction are among a plurality of unconfirmed transactions to be added into a new data block for adding to the blockchain through a consensus network;

adding the execution condition to the first transaction to avoid unintended outcome due to Transaction-Ordering Dependence (TOD) of the unconfirmed transactions to be added in the new data block through the consensus network;

executing the second transaction and updating a current state of the smart contract according at least to the execution of the second transaction;

when the first transaction calls the updated current state of the smart contract, determining whether the updated current state of the smart contract satisfies the execution condition;

when determining that the updated current state satisfies the execution condition, determining that the unintended outcome due to TOD is avoided, executing the first transaction after the execution of the second transaction, and recording the executions of the second and the first transactions into the new data block for adding to the blockchain; and

when determining that the updated current state does not satisfy the execution condition, recording the executions of the second transaction into the new data block for adding to the blockchain and discarding the first transaction.

10. The system of claim 9 , wherein the system is further caused to perform:

when determining that the updated current state does not satisfy the execution condition, returning an execution exception to a computing device that submitted the first transaction.

11. The system of claim 9 , wherein:

the current state comprises a current price of a transactional item of the smart contract; and

the execution condition is associated with a price range, an amount range, or a time range of the transactional item.

12. The system of claim 11 , wherein:

the first transaction is associated with a purchase order of the transactional item at the price range; and

the second transaction is associated with a sales order of selling the transactional item.

13. The system of claim 9 , wherein:

the execution condition is auto-generated based on the first transaction.

14. The system of claim 9 , wherein:

the execution condition is submitted by a computing device that submitted the first transaction.

15. A non-transitory computer-readable storage medium configured with instructions executable by one or more processors to cause the one or more processors to perform operations comprising:

obtaining a first transaction and a second transaction both invoking a smart contract without a specified order of execution and both for adding to a blockchain and an execution condition that protects execution of the first transaction from execution of the second transaction, wherein the first transaction and the second transaction are among a plurality of unconfirmed transactions to be added into a new data block for adding to the blockchain through a consensus network;

adding the execution condition to the first transaction to avoid unintended outcome due to Transaction-Ordering Dependence (TOD) of the unconfirmed transactions to be added in the new data block through the consensus network;

executing the second transaction and updating a current state of the smart contract according at least to the execution of the second transaction;

when the first transaction calls the updated current state of the smart contract, determining whether the updated current state of the smart contract satisfies the execution condition;

when determining that the updated current state satisfies the execution condition, determining that the unintended outcome due to TOD is avoided, executing the first transaction after the execution of the second transaction, and recording the executions of the second and the first transactions into the new data block for adding to the blockchain; and

when determining that the updated current state does not satisfy the execution condition, recording the executions of the second transaction into the new data block for adding to the blockchain and discarding the first transaction.

16. The storage medium of claim 15 , the processor is caused to further perform:

when determining that the updated current state does not satisfy the execution condition, returning an execution exception to a computing device that submitted the first transaction.

17. The storage medium of claim 15 , wherein:

the current state comprises a current price of a transactional item of the smart contract; and

the execution condition is associated with a price range, an amount range, or a time range of the transactional item.

18. The storage medium of claim 17 , wherein:

the first transaction is associated with a purchase order of the transactional item at the price range; and

the second transaction is associated with a sales order of selling the transactional item.

19. The storage medium of claim 15 , wherein:

the execution condition is auto-generated based on the first transaction.

20. The storage medium of claim 15 , wherein:

the execution condition is submitted by a computing device that submitted the first transaction.

Assignments (3)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Sep 16, 2020
From: ADVANTAGEOUS NEW TECHNOLOGIES CO., LTD.
To: ADVANCED NEW TECHNOLOGIES CO., LTD.
Reel/Frame 053796/0281 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Sep 3, 2020
From: ALIBABA GROUP HOLDING LIMITED
To: ADVANTAGEOUS NEW TECHNOLOGIES CO., LTD.
Reel/Frame 053702/0392 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Apr 16, 2019
From: YAO, ZHONGXIAO
To: ALIBABA GROUP HOLDING LIMITED
Reel/Frame 048901/0118 →