Method and apparatus for processing non-deterministic transactions in a blockchain

By utilizing consensus mechanisms and multiple consensus mechanisms in the blockchain to handle non-deterministic transactions, the problem of inconsistent node states is solved, a lightweight transaction processing solution is achieved, and the consistency of node states is ensured.

CN116319814BActive Publication Date: 2025-12-12TSINGHUA UNIVERSITY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310219885.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-07
Publication Date
2025-12-12
Estimated Expiration
2043-03-07

AI Technical Summary

Technical Problem

In blockchain, non-deterministic transactions lead to inconsistent node states, and there is a lack of an effective processing system.

Method used

The consensus mechanism of any blockchain is used to reach a consensus on the execution order of blocks. Each node executes transactions according to the execution order of blocks and calculates the global state hash value. The multi-consensus mechanism is used to propose inputs and make output judgments to achieve consensus on the global state.

Benefits of technology

It provides a lightweight solution for handling nondeterministic transactions with almost no impact on performance, ensuring the consistency of node states.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116319814B_ABST
    Figure CN116319814B_ABST
Patent Text Reader

Abstract

The application discloses a method and device for processing non-deterministic transactions in a blockchain, the method comprising: reaching a consensus on the execution order of blocks through a consensus mechanism of any blockchain; each node executes each block according to the execution order of the blocks, after the transactions in the block are executed, obtaining the local global state of the node, calculating the hash value of the local global state of the node, and starting the multi-element consensus corresponding to the block, and taking the hash value as the input of the multi-element consensus for proposal; each node waits for the output of the multi-element consensus corresponding to each block; if the output of the multi-element consensus is not a specific value, the node determines whether the hash value of the local global state is the output, if yes, it is determined that the consensus of the local global state of the block is reached, if not, the node synchronizes with other nodes, and it is determined that the consensus of the local global state of the block is reached. The application can process non-deterministic transactions in a blockchain.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of blockchain, and in particular to a method and device for processing non-deterministic transactions in a blockchain. BACKGROUND

[0002] This section is intended to provide background or context to the embodiments of the application recited in the claims. The description herein does not constitute admission that the prior publication 2,000,000 patent applications, and / or anything else in this section is prior art.

[0003] The Byzantine consensus protocol is the basis of the blockchain and is the core technology to ensure the security of the blockchain. In the traditional distributed system, the Byzantine consensus protocol assumes that the execution of transactions is in a deterministic order, and at the same time, the transactions do not contain non-deterministic operations, so as to ensure the consistency of the node state. However, there are many non-deterministic situations in the blockchain, which leads to inconsistent node states. Therefore, there is currently a lack of a system for processing non-deterministic transactions in a blockchain. SUMMARY

[0004] Embodiments of the present application provide a system for processing non-deterministic transactions in a blockchain, which is used to process non-deterministic transactions in a blockchain. The method comprises:

[0005] reaching a consensus on the execution order of the blocks through the consensus mechanism of any blockchain;

[0006] when each node executes each block according to the execution order of the blocks, obtaining the local global state of the node after the execution of the transactions in the block is completed, calculating a hash value of the local global state of the node, and starting a multi-element consensus corresponding to the block, and proposing the hash value as an input of the multi-element consensus;

[0007] each node waits for the output of the multi-element consensus corresponding to each block;

[0008] if the output of the multi-element consensus is not a specific value, the node determines whether the hash value of the local global state is the output, if yes, it is determined that the consensus of the local global state of the block is reached, and if no, the node synchronizes with other nodes to determine that the consensus of the local global state of the block is reached.

[0009] Embodiments of the present application also provide a device for processing non-deterministic transactions in a blockchain, which is used to process non-deterministic transactions in a blockchain. The device comprises:

[0010] a block order consensus module, configured to reach a consensus on the execution order of the blocks through the consensus mechanism of any blockchain;

[0011] The transaction execution module is configured to, when each node executes each block according to the execution order of the block, after the execution of the transaction in the block is completed, obtain the local global state of the node, calculate a hash value of the local global state of the node, and start the multi-element consensus corresponding to the block, and propose the hash value as an input of the multi-element consensus.

[0012] The multi-element consensus module is configured to wait for the output of the multi-element consensus corresponding to each block by each node; if the output of the multi-element consensus is not a specific value, the node determines whether the hash value of the local global state is the output, if yes, it is determined that the consensus of the local global state of the block is reached, and if no, the node synchronizes with other nodes to determine that the consensus of the local global state of the block is reached.

[0013] The embodiment of the application further provides a computer device, including a memory, a processor and a computer program stored in the memory and capable of running on the processor, and the processor implements the method for processing the non-deterministic transaction in the blockchain when the computer program is executed.

[0014] The embodiment of the application further provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the method for processing the non-deterministic transaction in the blockchain.

[0015] The embodiment of the application further provides a computer program product, which includes a computer program, and the computer program is executed by a processor to implement the method for processing the non-deterministic transaction in the blockchain.

[0016] In the embodiment of the application, the execution order of the blocks is agreed through the consensus mechanism of any blockchain; when each node executes each block according to the execution order of the block, after the execution of the transaction in the block m1 is completed, the local global state (including the state of each transaction) of the node is obtained, a hash value h of the local global state (such as the global state of the smart contract) of the node is calculated, and the multi-element consensus corresponding to the block is started, and the hash value h is proposed as an input of the multi-element consensus; each node waits for the output of the multi-element consensus corresponding to each block; if the output of the multi-element consensus is not a specific value, the node determines whether the hash value h of the local global state is the output v, if yes, it is determined that the consensus of the local global state of the block m1 is reached, and if no, the node synchronizes with other nodes to determine that the consensus of the local global state of the block m1 is reached. Through the above process, a lightweight scheme for processing the non-deterministic transaction with little influence on performance is provided. BRIEF DESCRIPTION OF DRAWINGS

[0017] In order to more clearly illustrate the technical solutions of the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained from these drawings without creative labor. In the drawings:

[0018] Figure 1 One of the flowcharts of the method for processing non-deterministic transactions in the blockchain in the embodiments of the present application;

[0019] Figure 2 The second flowchart of the method for processing non-deterministic transactions in the blockchain in the embodiments of the present application;

[0020] Figure 3 The execution schematic diagram of the method for the embodiments of the present application aiming at Figure 1 and Figure 2 ;

[0021] Figure 4 The pseudo code corresponding to Figure 3 in the embodiments of the present application;

[0022] Figure 5 The execution schematic diagram of the node rolling back the global state locally in the embodiments of the present application;

[0023] Figure 6 The execution schematic diagram of sequentially executing transactions and sequentially executing multi-element consensus in the embodiments of the present application;

[0024] Figure 7 The execution schematic diagram of parallel executing transactions and sequentially executing multi-element consensus in the embodiments of the present application;

[0025] Figure 8 The execution schematic diagram of sequentially executing transactions and periodically executing multi-element consensus in the embodiments of the present application;

[0026] Figure 9 The schematic diagram of the device for processing non-deterministic transactions in the blockchain in the embodiments of the present application;

[0027] Figure 10 The schematic diagram of the computer device in the embodiments of the present application. DETAILED DESCRIPTION

[0028] In order to make the purpose, technical solutions and advantages of the embodiments of the present application more clear, the following will further describe the embodiments of the present application in combination with the drawings. Herein, the schematic embodiments of the present application and the descriptions thereof are used to explain the present application, but not as the limitation of the present application.

[0029] Firstly, the concepts involved in the embodiments of the present application are explained.

[0030] Assume that the total number of nodes is n, the number of faulty nodes is f, and n≥3f+1.

[0031] (1) Multi-valued Byzantine agreement (MBA)

[0032] Multi-valued consensus, each node proposes a value v∈{0,1}*, all correct nodes agree on the same value. MBA has the following properties:

[0033] Validity: If all nodes (correct or faulty) propose the same value v, then all correct nodes agree on v.

[0034] Consensus: If a correct node agrees on v, then any correct node eventually agrees on v

[0035] Termination: All correct nodes eventually agree on a value.

[0036] Integrity: All nodes agree on only one value.

[0037] In addition, there is a stronger definition of validity.

[0038] Strong validity: If all correct nodes propose the same value v, then all correct nodes agree on v.

[0039] MBA with only validity, consensus, termination, and integrity is a basic multi-valued consensus. It can be seen that the definition of validity in it is assumed to be strong. However, MBA can be directly converted into multi-valued verifiable consensus, so it can be directly used to build a blockchain protocol, and therefore it also has certain significance.

[0040] MBA with strong validity, consensus, termination, and integrity is referred to as strong validity multi-valued consensus in this paper, which is the definition of traditional MBA. This paper describes both MBA and strong validity MBA.

[0041] Figure 1 One of the flowcharts of the method for processing non-deterministic transactions in the blockchain in the embodiments of the present application comprises:

[0042] Step 101, consensus on the execution order of blocks is reached through the consensus mechanism of any blockchain;

[0043] Step 102, each node executes each block in the execution order of the block, after the transaction in the block m1 is executed, the local global state of the node (including the state of each transaction and the global state of the smart contract) is obtained, the hash value h of the local global state of the node is calculated, and the corresponding multi-element consensus of the block is started, and the hash value h is taken as the input of the multi-element consensus for proposal;

[0044] Step 103, each node waits for the output of the multi-element consensus corresponding to each block;

[0045] Step 104, if the output of the multi-element consensus is not a specific value, the node judges whether the hash value h of the local global state is the output v, if yes, it is determined that the consensus of the local global state of the block m1 is reached, if not, the node synchronizes with other nodes, and it is determined that the consensus of the local global state of the block m1 is reached.

[0046] Figure 2 For the flowchart two of the method for processing non-deterministic transactions in the blockchain in the embodiment of the application, the method further comprises:

[0047] Step 201, if the output of the multi-element consensus is a specific value, the node rolls back the local global state to before the execution of the block m1, and determines that the transaction in the block m1 is invalid.

[0048] Figure 3 For the execution schematic diagram of the method for Figure 1 and Figure 2 in the embodiment of the application, wherein p1, p2, p3 and p4 are nodes, m1, m2, m3 and m4 are blocks, execute() is the execution transaction, δ1 and δ1' are the local global state, h and h' are hash values, and MBA1 is a multi-element consensus. Figure 3 It can be seen that the local global states of different nodes can be converted. Figure 4 For the pseudo code corresponding to Figure 3 in the embodiment of the application.

[0049] Figure 5 For the execution schematic diagram of the node rolling back the local global state in the embodiment of the application, see Figure 5 , the multi-element consensus is run on the state delta after each block executed by the node, for example, the hash of the state delta_1 after the execution of m1 is proposed in a multi-element consensus, and the hash of the state delta_2 after the execution of m2 is proposed in another multi-element consensus. Here, the running is stopped after the multi-element consensus with the first output specific value is reached, for example, MBA2 outputs the specific value, then the node rolls back the state to before the block m2, marks the block m2 as invalid, and re-executes MBA3 using the rolled-back state, and thereafter the foregoing method continues until all blocks are processed.

[0050] For the deployment in the blockchain, the embodiment of the application proposes several modes for processing non-deterministic transactions, which can support different execution of transactions.

[0051] The first case: sequentially executing transactions and sequentially executing multi-consensus.

[0052] In this case, the default mode of sequential execution is the most secure and has low memory requirements. Specifically, the execution order of the block is sequential execution, the execution order of the transaction in the block m1 is sequential execution, and the execution order of the multi-consensus is sequential execution. Figure 6 For the execution diagram of sequentially executing transactions and sequentially executing multi-consensus in the embodiment of the application, after the blockchain reaches consensus on any block, the transactions are executed in sequence, and after each execution, the multi-consensus is run to reach consensus on the local global state. Then, the consensus of the next block and the corresponding multi-consensus are started.

[0053] The second case: parallel execution of transactions and sequential execution of multi-consensus.

[0054] In this case, the contract transaction parallel execution mode is supported, and the performance is higher. Specifically, the execution order of the block is parallel execution, the execution order of the transaction in the block m1 is parallel execution, and the execution order of the multi-consensus is sequential execution.

[0055] The execution order of the block is parallel execution, the execution order of the transaction in the block m1 is parallel execution, and the execution order of the multi-consensus is sequential execution.

[0056] Each node executes the transactions in the block m1 according to the execution order of the block m1, and after the execution is completed, the hash value h of the local global state of the node is calculated, including:

[0057] For each block m1, before the transactions in the block are executed, the local global state is recorded as the first copy delta_0, before the transactions satisfying the preset execution condition in any other block are executed, the local global state is recorded as the second copy delta_1', and after all the transactions in the block m1 are executed, the local global state is recorded as the third copy delta_1"; wherein the preset execution condition is the execution order after any transaction in the block m1; (each copy includes the state of multiple transactions)

[0058] After all the transactions in the block m1 are executed, the node trims all the local global states to obtain the trimmed local global state.

[0059] The hash value of the trimmed local global state is calculated.

[0060] Figure 7Figure 2 is a schematic diagram of the execution of transactions and multi-consensus in parallel in an embodiment of the present application, wherein the transactions are executed in parallel, including the parallel execution of multiple blocks, and the transactions in each block are also executed in parallel, then the multi-consensus corresponding to the block that is executed first is executed.

[0061] In an embodiment, the node trims all local global states, including:

[0062] The state of all transactions in the second copy delta_1' is superimposed on the state of the transactions related to the block m1 in the third copy, and the state of the transactions in any other block in the third copy delta_1" that meet the preset execution condition is removed.

[0063] The third case: sequentially execute transactions and periodically execute multi-consensus.

[0064] In this case, the multi-consensus is executed periodically, and the performance loss is low. The processing method after the multi-consensus outputs a specific value is a provably secure method. Specifically, it includes:

[0065] The execution order of the blocks is sequential, the execution order of the transactions in the block m1 is sequential, and the execution order of the multi-consensus is periodic;

[0066] The method further includes:

[0067] After each node executes the transactions in a preset number of blocks, the node obtains the local global state of the last block that has executed transactions in the blocks that have executed transactions;

[0068] The node calculates the hash value h of the local global state of the last block that has executed transactions, and starts the multi-consensus corresponding to the block;

[0069] Each node waits for the output of the multi-consensus corresponding to the last block that has executed transactions;

[0070] If the output of the multi-consensus is a specific value, the node rolls back the local global state to before the execution of the block m1, and determines that the transactions in the blocks that have executed transactions are invalid.

[0071] If the output of the multi-consensus is not a specific value, the node determines whether the hash value h of the local global state is the output v, if yes, it is determined that the consensus of the local global state of the blocks that have executed transactions is reached, if not, the node synchronizes with other nodes to determine that the consensus of the local global state of the blocks that have executed transactions is reached.

[0072] Figure 8For the execution schematic diagram of sequentially executing transactions and periodically executing multi-party consensus in the embodiment of the application, after the blockchain reaches consensus on the series of blocks m1, m2,..., the execution of the transactions can be performed, here, the multi-party consensus is not run on the execution result of any block, but waits until a certain number of blocks are executed, and then runs the multi-party consensus, for example, if m1, m2 and m3 are all executed, and the last block in which the transaction is executed is m3, then the multi-party consensus MBA0 is executed, and the input is the local global state of m3, if the multi-party consensus reaches consensus on the node state h, then the protocol proceeds normally, and the result is determined in the same way as described above.

[0073] The embodiment of the application also provides a device for processing non-deterministic transactions in a blockchain, which has a principle similar to that of the method for processing non-deterministic transactions in a blockchain, and will not be described here.

[0074] Figure 9 The schematic diagram of the device for processing non-deterministic transactions in a blockchain in the embodiment of the application comprises:

[0075] The block sequential consensus module 901 is configured to reach consensus on the execution order of the blocks through a consensus mechanism of any blockchain.

[0076] The transaction execution module 902 is configured to, when each node executes each block according to the execution order of the blocks, obtain the local global state of the node after the transactions in the block are executed, calculate a hash value of the local global state of the node, and start the multi-party consensus corresponding to the block, and propose the hash value as an input of the multi-party consensus.

[0077] The multi-party consensus module 903 is configured to wait for the output of the multi-party consensus corresponding to each block by each node, if the output of the multi-party consensus is not a specific value, the node determines whether the hash value of the local global state is the output v, if yes, it is determined that consensus of the local global state of the block is reached, if no, the node synchronizes with other nodes to determine that consensus of the local global state of the block is reached.

[0078] In an embodiment, the multi-party consensus module 903 is further configured to:

[0079] If the output of the multi-party consensus is a specific value, then the node rolls back the local global state to before the execution of the block m1, and determines that the transactions in the block m1 are invalid.

[0080] In an embodiment, the execution order of the blocks is sequential execution, the execution order of the transactions in the block m1 is sequential execution, and the execution order of the multi-party consensus is sequential execution.

[0081] In an embodiment, the execution order of the blocks is parallel execution, the execution order of the transactions in the block m1 is parallel execution, and the execution order of the multi-party consensus is sequential execution.

[0082] The transaction execution module 902 is specifically configured to:

[0083] For each block m1, record the local global state as a first copy delta_0 before the transactions in the block are executed, record the local global state as a second copy delta_1’ before the transactions satisfying the preset execution condition in any other block are executed, and record the local global state as a third copy delta_1” after all the transactions in the block m1 are executed; wherein the preset execution condition is that the execution sequence is after any transaction in the block m1; (each copy includes the states of multiple transactions)

[0084] After all the transactions in the block m1 are executed, the node trims all the local global states to obtain trimmed local global states;

[0085] Calculate the hash value of the trimmed local global state.

[0086] In an embodiment, the transaction execution module 902 is specifically configured to:

[0087] Add the states of all the transactions in the second copy delta_1’ to the states of the transactions related to the block m1 in the third copy, and remove the states of the transactions satisfying the preset execution condition in any other block in the third copy delta_1”.

[0088] In an embodiment, the execution sequence of the block is sequential execution, the execution sequence of the transactions in the block m1 is sequential execution, and the execution sequence of the multi-element consensus is periodic execution.

[0089] The transaction execution module 902 is specifically configured to:

[0090] After the transactions in a preset number of blocks are executed by each node, the local global state of the last executed block in the blocks in which the transactions have been executed is obtained;

[0091] Calculate the hash value h of the local global state of the last executed block, and start the multi-element consensus corresponding to the block;

[0092] Each node waits for the output of the multi-element consensus corresponding to the last executed block;

[0093] If the output of the multi-element consensus is a specific value, the node rolls back the local global state to before the block m1 is executed, and determines that the transactions in the blocks in which the transactions have been executed are invalid.

[0094] If the output of the multi-element consensus is not a specific value, the node determines whether the hash value h of the local global state is the output v, if yes, it is determined that the consensus of the local global state of the block in which the transaction has been executed is reached, if not, the node synchronizes with other nodes to determine that the consensus of the local global state of the block in which the transaction has been executed is reached.

[0095] In summary, in the method and device provided by the embodiment of the application, the execution order of the blocks is agreed by the consensus mechanism of the arbitrary blockchain; when each node executes each block according to the execution order of the blocks, after the transaction in the block m1 is executed, the local global state of the node is obtained, the hash value h of the local global state of the node is calculated, the multi-element consensus corresponding to the block is started, and the hash value h is taken as the input of the multi-element consensus for proposal; each node waits for the output of the multi-element consensus corresponding to each block; if the output of the multi-element consensus is not a specific value, the node determines whether the hash value h of the local global state is the output v, if yes, it is determined that the consensus of the local global state of the block m1 is reached, if not, the node synchronizes with other nodes to determine that the consensus of the local global state of the block m1 is reached. Through the above process, a lightweight scheme for processing non-deterministic transactions with little influence on performance is provided.

[0096] The embodiment of the application further provides a computer device, Figure 10 The computer device 1000 includes a memory 1010, a processor 1020 and a computer program 1030 stored in the memory 1010 and executable on the processor 1020, and the processor 1020 implements the method for processing non-deterministic transactions in the blockchain when the computer program 1030 is executed.

[0097] The embodiment of the application further provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the method for processing non-deterministic transactions in the blockchain.

[0098] The embodiment of the application further provides a computer program product, which includes a computer program, and the computer program is executed by a processor to implement the method for processing non-deterministic transactions in the blockchain.

[0099] Those skilled in the art will appreciate that embodiments of the application can be devised for a method, a system, or a computer program product. Accordingly, the present application can be embodied in the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present application can take the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROMs, optical storage devices, etc.) embodying computer readable program code.

[0100] The present application is described in reference to the flowchart and / or block diagrams of the method, apparatus (system) and computer program product according to embodiments of the application. It will be understood that each block of the flowchart and / or block diagrams, and combinations of blocks in the flowchart and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general purpose computer, special purpose computer, embedded processing device or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart and / or block diagram block or blocks. Figure 1 one or more functions specified in the flowchart and / or block diagram block or blocks. Figure 1 one or more functions specified in the flowchart and / or block diagram block or blocks.

[0101] These computer program instructions can also be stored in a computer- readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instructions which implement the function specified in the flowchart and / or block diagram block or blocks. Figure 1 one or more functions specified in the flowchart and / or block diagram block or blocks. Figure 1 one or more functions specified in the flowchart and / or block diagram block or blocks.

[0102] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart and / or block diagram block or blocks. Figure 1 one or more functions specified in the flowchart and / or block diagram block or blocks. Figure 1 one or more functions specified in the flowchart and / or block diagram block or blocks.

[0103] The specific embodiments described above are illustrative for purposes of the present application. The particular embodiments are not intended to limit the scope of the present application, which is defined by the appended claims. Numerous other embodiments can be implemented which do not depart from the spirit and scope of the present application.

Claims

1. A method for processing non-deterministic transactions in a blockchain, characterized in that, include: Consensus is reached on the execution order of blocks through the consensus mechanism of any blockchain; When each node executes each block in the order of block execution, after the transactions in the block are completed, it obtains the local global state of the node, calculates the hash value of the local global state of the node, starts the multi-party consensus corresponding to the block, and uses the hash value as the input of the multi-party consensus to make proposals. Each node waits for the output of the multi-party consensus corresponding to each block; If the output of the multi-party consensus is not a specific value ⊥, then the node determines whether the hash value of its local global state is the output. If yes, it determines that the consensus of the local global state of the block has been reached. If no, the node synchronizes with other nodes to determine that the consensus of the local global state of the block has been reached. If the output of the multi-party consensus is a specific value ⊥, then the node rolls back its local global state to before the execution of the block, determines that the transactions in the block are invalid, and records it on the blockchain.

2. The method as described in claim 1, characterized in that, The execution order of blocks is sequential, the execution order of transactions within a block is sequential, and the execution order of multi-party consensus is sequential.

3. The method as described in claim 1, characterized in that, The blocks are executed in parallel, the transactions within a block are executed in parallel, and the multi-party consensus is executed sequentially. Each node executes the transactions in a block locally according to the block execution order. After execution, it calculates the hash value of its local global state, including: For each block, before the transactions in that block are executed, the local global state is recorded as a first copy. Before any transaction in any other block that meets the preset execution conditions is executed, the local global state is recorded as a second copy. After all transactions in that block are executed, the local global state is recorded as a third copy. The preset execution condition is that the execution order is after any transaction in that block. After all transactions in the block have been executed, the node prunes all local global states to obtain the pruned local global state. Calculate the hash value of the local global state after clipping.

4. The method as described in claim 3, characterized in that, This node prunes all local global states, including: The states of all transactions in the second copy are superimposed onto the states of the relevant transactions in the third copy for that block, and the states of transactions in any other block in the third copy that meet the preset execution conditions are removed.

5. The method as described in claim 1, characterized in that, The execution order of blocks is sequential, the execution order of transactions in block m1 is sequential, and the execution order of multi-party consensus is periodic. The method further includes: After each node has completed the execution of transactions in a preset number of blocks, it obtains the local global state of the last block that has been executed among the blocks in which transactions have been completed. Calculate the hash value of the local global state of the last executed block and initiate the multi-party consensus corresponding to that block; Each node waits for the output of the multi-party consensus corresponding to the last block that has been executed; If the output of the multi-party consensus is a specific value, the node rolls back its local global state to before the block was executed, determines that the transactions in the block that have already been executed are invalid, and records this on the blockchain. If the output of the multi-party consensus is not a specific value, the node determines whether the hash value of its local global state is the output. If yes, it determines that the consensus of the local global state of the block that has completed the transaction has been reached. If no, the node synchronizes with other nodes to determine that the consensus of the local global state of the block that has completed the transaction has been reached.

6. An apparatus for processing non-deterministic transactions in a blockchain, characterized in that, include: The block order consensus module is used to reach a consensus on the execution order of blocks through the consensus mechanism of any blockchain. The transaction execution module is used to obtain the local global state of each node after the transactions in a block are completed, calculate the hash value of the local global state of the node, start the multi-party consensus corresponding to the block, and use the hash value as the input of the multi-party consensus to make proposals. The multi-consensus module is used by each node to wait for the multi-consensus output corresponding to each block. If the multi-consensus output is not a specific value ⊥, the node determines whether the hash value of its local global state is the output. If yes, it determines that the consensus of the local global state of the block has been reached. If no, the node synchronizes with other nodes to determine that the consensus of the local global state of the block has been reached. If the multi-consensus output is a specific value ⊥, the node rolls back its local global state to before the execution of the block, determines that the transactions in the block are invalid, and records them on the blockchain.

7. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method of any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method of any one of claims 1 to 5.

9. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the method of any one of claims 1 to 5.

Citation Information

Patent Citations

  • Block chain consensus method, device and system based on Byzantine fault-tolerant algorithm

    CN111523901A

  • Consensus method, consensus node and blockchain system of assembly line mode

    CN112887436A