CN114529414A - Transaction processing method of block chain, block chain node and electronic equipment - Google Patents

Transaction processing method of block chain, block chain node and electronic equipment Download PDF

Info

Publication number
CN114529414A
CN114529414A CN202210178246.2A CN202210178246A CN114529414A CN 114529414 A CN114529414 A CN 114529414A CN 202210178246 A CN202210178246 A CN 202210178246A CN 114529414 A CN114529414 A CN 114529414A
Authority
CN
China
Prior art keywords
consensus
transaction
node
round
proposal
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210178246.2A
Other languages
Chinese (zh)
Inventor
徐文博
林鹏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ant Blockchain Technology Shanghai Co Ltd
Original Assignee
Ant Blockchain Technology Shanghai Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ant Blockchain Technology Shanghai Co Ltd filed Critical Ant Blockchain Technology Shanghai Co Ltd
Priority to CN202210178246.2A priority Critical patent/CN114529414A/en
Publication of CN114529414A publication Critical patent/CN114529414A/en
Priority to PCT/CN2022/135403 priority patent/WO2023160086A1/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION 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
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION 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
    • G06Q10/00Administration; Management
    • G06Q10/06Resources, workflows, human or project management; Enterprise or organisation planning; Enterprise or organisation modelling
    • G06Q10/063Operations research, analysis or management
    • G06Q10/0631Resource planning, allocation, distributing or scheduling for enterprises or organisations
    • G06Q10/06311Scheduling, planning or task assignment for a person or group
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION 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
    • G06Q10/00Administration; Management
    • G06Q10/06Resources, workflows, human or project management; Enterprise or organisation planning; Enterprise or organisation modelling
    • G06Q10/063Operations research, analysis or management
    • G06Q10/0633Workflow analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION 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
    • G06Q10/00Administration; Management
    • G06Q10/10Office automation; Time management
    • G06Q10/103Workflow collaboration or project management

Abstract

The embodiment of the specification provides a transaction processing method of a block chain, a block chain node and an electronic device. The method comprises the following steps: and the consensus node of the block chain executes the consensus operation of the first transaction set in the Nth round of consensus proposition, wherein N is a positive integer. The consensus node performs a transaction execution operation for the first set of transactions. And the consensus node initiates a transaction execution determination operation on the first transaction set after the transaction execution operation is completed. And after the consensus node agrees with all transaction sets of the N-th consensus proposal and completes the transaction execution confirmation operation, executing a block writing operation on all transaction sets of the N-th consensus proposal.

Description

Transaction processing method of block chain, block chain node and electronic equipment
Technical Field
The present disclosure relates to a blockchain, and more particularly, to a method for processing a blockchain transaction, a blockchain node, and an electronic device.
Background
Block chains are increasingly favored by various industries due to their advantages of openness, non-tamper-ability, decentralization, etc. The processing flow of the current blockchain transaction mainly comprises: transaction consensus, transaction execution confirmation and transaction writing. In the prior art, the four stages are executed in sequence and in series, that is, after a blockchain client initiates a transaction, an execution result of the transaction cannot be known immediately (the transaction needs to be executed after consensus is completed first), thereby affecting user experience.
In the future, the blockchain traffic will grow explosively, and the delay problem of the confirmation of the transaction execution result by the client will also be highlighted. Therefore, it is necessary to provide a technical solution that can improve the efficiency of confirming the execution result of the blockchain transaction.
Disclosure of Invention
Embodiments of the present disclosure provide a processing method for blockchain transactions, a blockchain node, and an electronic device, which can improve the efficiency of confirming the execution result of blockchain transactions.
In order to achieve the above object, the embodiments of the present specification are implemented as follows:
in a first aspect, a method for processing transactions of a blockchain is provided, including:
executing transaction execution operation of a first transaction set in an Nth round of consensus proposition by a consensus node of the block chain, wherein N is a positive integer;
the consensus node executes consensus operation of a first transaction set in the Nth round of consensus proposition;
after the transaction execution operation is completed, the consensus node initiates a transaction execution determination operation on the first transaction set;
and after the consensus node agrees with all transaction sets of the N-th consensus proposal and completes the transaction execution confirmation operation, executing a block writing operation on all transaction sets of the N-th consensus proposal.
In a second aspect, a blockchain transaction processing apparatus is provided, including:
the transaction consensus module executes consensus operation of the first transaction set in the Nth round of consensus proposition, wherein N is a positive integer;
a transaction execution module to execute transaction execution operations of the first set of transactions;
the transaction execution confirmation module initiates a transaction execution determination operation on the first transaction set after the transaction execution operation is executed;
and the block writing module is used for performing block writing operation on all transaction sets of the N-th round consensus suggestion after all transaction sets of the N-th round consensus suggestion are agreed and the transaction execution confirmation operation is completed.
In a third aspect, an electronic device is provided that includes: a memory, a processor, and a computer program stored on the memory and executable on the processor, the computer program being executed by the processor to:
executing consensus operation of a first transaction set in the Nth round of consensus proposition, wherein N is a positive integer;
executing a transaction execution operation of the first transaction set;
after the transaction execution operation is finished, initiating a transaction execution determination operation on the first transaction set;
after all transaction sets of the N round consensus proposal are agreed and the transaction execution confirmation operation is completed, the writing block operation is executed on all transaction sets of the N round consensus proposal.
In a fourth aspect, a computer-readable storage medium is presented, the computer-readable storage medium storing one or more programs that, when executed by an electronic device that includes a plurality of application programs, cause the electronic device to:
executing consensus operation of a first transaction set in the Nth round of consensus proposition, wherein N is a positive integer;
performing a transaction performance operation of the first set of transactions;
after the transaction execution operation is executed, initiating a transaction execution determination operation on the first transaction set;
after all transaction sets of the N round consensus proposal are agreed and the transaction execution confirmation operation is completed, the writing block operation is executed on all transaction sets of the N round consensus proposal.
Based on the scheme of the embodiment of the description, the block chain common knowledge node can execute transaction execution operation on the transaction in advance before completing the common knowledge operation of the transaction, and initiates transaction execution determination operation after the transaction execution operation is completed, so that the transaction finalization confirmation efficiency is improved, a client user can know the transaction execution result as soon as possible, and the user experience is improved to a certain extent. In addition, the write block operation can be executed earlier in advance of transaction execution confirmation, so that the transaction uplink efficiency of the block chain is improved, the service throughput of the block chain is further improved, and the block chain transaction processing method and the block chain transaction processing system meet the high-concurrency development trend of block chain services in the future.
Drawings
In order to more clearly illustrate the embodiments of the present specification or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, it is obvious that the drawings in the following description are only some embodiments described in the embodiments of the present specification, and for those skilled in the art, other drawings can be obtained according to the drawings without any creative efforts.
Fig. 1 is a flow chart illustrating a transaction processing method according to an embodiment of the present disclosure.
Fig. 2 is a flow diagram of a conventional PBFT protocol.
Fig. 3 is a first flowchart illustrating a transaction processing method according to an embodiment of the present disclosure executing PBFT protocol uplink transaction.
Fig. 4 is a second flowchart illustrating a transaction processing method according to an embodiment of the present disclosure executing PBFT protocol uplink transaction.
Fig. 5 is a third flow chart illustrating a transaction processing method according to an embodiment of the present disclosure executing PBFT protocol uplink transaction.
Fig. 6 is a fourth flowchart illustrating a transaction processing method according to an embodiment of the present disclosure executing PBFT protocol uplink transaction.
Fig. 7 is a fifth flowchart illustrating a transaction processing method according to an embodiment of the present disclosure executing PBFT protocol uplink transaction.
Fig. 8 is a schematic structural diagram of a blockchain node according to an embodiment of the present specification.
Fig. 9 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure.
Detailed Description
In order to make those skilled in the art better understand the technical solutions in the present specification, the technical solutions in the embodiments of the present specification will be clearly and completely described below with reference to the drawings in the embodiments of the present specification, and it is obvious that the described embodiments are only a part of the embodiments of the present specification, and not all of the embodiments. All other embodiments obtained by a person skilled in the art based on the embodiments in the present specification without any inventive step should fall within the scope of protection of the present specification.
As mentioned above, the processing flow of the blockchain transaction mainly includes: transaction consensus, transaction execution confirmation and transaction writing. In the prior art, the four phases are executed serially in sequence, that is, after a client of the block chain initiates a transaction, the transaction is executed after the client completes consensus. As such, the client cannot immediately know the execution result of the transaction, and this delay problem is perceived by the client user, and if the delay is serious, the user experience is affected. In view of this problem, this document aims to provide a technical solution for improving the efficiency of confirming the execution result of the blockchain transaction.
Fig. 1 is a flowchart illustrating a processing method of blockchain transactions according to an embodiment of the present disclosure. The method shown in fig. 1 may be performed by the following corresponding block link points, comprising the steps of:
s102, the consensus node of the block chain executes the consensus operation of the first transaction set in the Nth round of consensus proposition, wherein N is a positive integer.
The first transaction set may include all the transactions requiring consensus in the nth round of consensus proposition, or may include some of the transactions requiring consensus in the nth round of consensus proposition, which is not specifically limited herein.
In this step, if the consensus node is used as the consensus master node of the block chain, the nth consensus proposal needs to be created and sent to the consensus backup node of the block chain. After the consensus backup node obtains the Nth round of consensus proposal, the consensus nodes (including the consensus main node and the consensus backup node) of the blockchain start to perform consensus operation on the first transaction set. Similarly, if the consensus node is a consensus backup node of the blockchain, after receiving the nth round of consensus offer sent by the consensus master node of the blockchain, performing consensus operation on the first transaction set.
And S104, the consensus node executes the transaction execution operation of the first transaction set.
It should be understood that in the embodiments of the present specification, the consensus node does not need the first transaction set to achieve consensus, and can perform the transaction execution operation on the first transaction set.
Specifically, the consensus node may perform the transaction execution operation of the first transaction set in parallel when performing the consensus operation of the first transaction set after the initiation of the nth round of consensus offer. It should be understood that the consensus node performs the consensus operation mainly including: and (4) consensus checking and receiving and sending consensus messages. That is, in parallel, the consensus node can perform the transaction execution operation at least by using the time waiting for receiving the consensus message sent by other consensus nodes, thereby improving the processing efficiency of the blockchain transaction.
And S106, after the execution of the transaction execution operation is finished, the consensus node initiates a transaction execution determination operation on the first transaction set.
It should be understood that the transaction execution determination operation refers to an operation of confirming the transaction execution result. In the process, after the transaction execution operation of the first transaction set is completed, the consensus node sends a transaction execution confirmation message of the first transaction set to other consensus nodes of the block chain, wherein the transaction execution confirmation message carries the hash information of the first transaction set; similarly, when the other consensus nodes complete the transaction execution operation of the first transaction set, the other consensus nodes send a transaction execution confirmation message of the first transaction set to the consensus node in this step.
When the consensus node in this step receives a transaction execution confirmation message carrying the hash information of the same first transaction set sent by 2f other consensus nodes, the transaction execution of the first transaction set can be confirmed (f is the Byzantine fault-tolerant number set for the block chain). It should be understood that after the transaction execution of the first transaction set is confirmed, the transaction execution result in the first transaction set can be fed back to the corresponding client and perceived by the client user in advance.
And S108, after the consensus node agrees on all transaction sets of the N-th consensus proposal and completes the transaction execution confirmation operation, executing block writing operation on all transaction sets of the N-th consensus proposal.
It should be understood that the block writing operation in the conventional serial manner needs to be executed after the confirmation of the transaction execution results of all transaction sets of the nth consensus proposal, and the above steps according to the embodiments of the present invention can complete the transaction execution operation and the transaction execution confirmation operation in advance, so that the block writing operation is executed in advance, thereby reducing the time consumption for chaining the blockchain transaction and improving the transaction processing efficiency of the blockchain.
In addition, in order to further improve the processing efficiency of the blockchain transaction, the consensus node can generate a temporary block of the N-th consensus proposal after the confirmation operation is performed on all transaction sets of the N-th consensus proposal; at this time, if the consensus is not achieved on all transaction sets of the Nth round of consensus proposition, the consensus node waits; if all transaction sets of the N round consensus proposition are agreed upon, the consensus node directly writes the temporary blocks of the N round consensus proposition into the block chain, thereby saving time consumption of the block writing operation.
Therefore, based on the method of the embodiment of the present specification, the consensus node of the block chain can execute the transaction execution operation on the transaction in advance before the consensus operation of the transaction is completed, and initiate the transaction execution determination operation after the transaction execution operation is completed, so that the validation efficiency of transaction finalization is improved, the client user can know the transaction execution result as soon as possible, and the user experience is improved to a certain extent. In addition, the write block operation can be executed earlier in advance of transaction execution confirmation, so that the transaction uplink efficiency of the block chain is improved, the service throughput of the block chain is further improved, and the block chain transaction processing method and the block chain transaction processing system meet the high-concurrency development trend of block chain services in the future.
The method of the embodiments of the present disclosure is described in detail below with reference to practical application scenarios.
In the application scenario, the consensus node of the block chain executes the consensus operation based on a Practical Byzantine Fault Tolerance (PBFT) protocol.
The consensus process of the traditional PBFT protocol mainly comprises the following steps:
pre-preparation stage:
the main consensus node receives a request from a Client and assigns a number to the request, and the consensus main node broadcasts a pre-prepare message to the consensus backup node, wherein the pre-prepare message mainly comprises a view (view) of the current consensus, an abstract (digest) of the consensus main node, block-hash information and the like.
And each consensus backup node checks the information in the pre-preamble message after receiving the pre-preamble message. If the check is successful, the prepare phase is entered directly. If the check fails, the consensus process ends.
The prepare stage:
each of all the consensus backup nodes participating in the consensus checks whether the pre-preamble message is legal or not after receiving the pre-preamble message. If the pre-preparation message is legal, the consensus proposal is determined to be prepared in the replica, the consensus backup node adds the pre-preparation message to the local Log, and sends the preparation message to other consensus backup nodes participating in the consensus.
And a commit stage:
after entering a prepared state, each of all the consensus nodes sends a commit message to other consensus nodes, and adds the commit message sent by the consensus node to a local Log (representing the approval of the consensus node). When a consensus node discovers that there is a quorum (quorum is a set of a certain number of replicas needed to ensure the consistency and fault tolerance requirements of all replica data) grant number assignment, it broadcasts a commit message to all other nodes. And meanwhile, the commit messages from other nodes are received successively, if each node receives 2f commit messages which do not contain the commit messages sent by the node (f is the number of the nodes doing the bad in the alliance chain, and the 2f commit messages do not contain the commit messages sent by the node), the node is named to have a certificate named committed certificate, and the committed state is requested to be reached on the node. Now, only by this one consensus node, it can be concluded that the request has reached the prepended state in one quorum, i.e. all consensus nodes of the same quotum have agreed on the assignment of the number n. When the request initiated by the Client reaches the committed state, the situation that the whole network consensus is achieved is shown.
The above is a flow introduction of the conventional PBFT protocol. In the application scenario, in a consensus stage of executing the PBFT protocol on a certain transaction set, transaction execution operation and transaction execution determination operation on the transaction set are introduced.
Taking the N-th round consensus proposal as an example, on the basis, the consensus master node of the application scenario needs to select the first transaction set from the own transaction pool to initiate the N-th round consensus proposal, and sends the transaction data of the first transaction set to the consensus backup node of the block chain through a Pre-preparation message in a Pre-preparation stage.
It should be noted that, after determining the transaction data of the first transaction set, the consensus node may perform a transaction execution operation on the first transaction set. That is, in the application scenario, the consensus master node may perform the transaction execution operation on the first transaction set at the earliest stage in the Pre-Prepare stage, and the consensus backup node needs to perform the transaction execution operation on the first transaction set at the Prepare stage after obtaining the transaction data of the first transaction set through the Pre-Prepare message.
By the design, each consensus node of the block chain can generate a temporary block of the first transaction set before the Commit stage. In this way, the Commit message may be multiplexed to complete the transaction execution confirmation operation. That is, each consensus node of the block chain sends the hash information of the temporary blocks of the first transaction set to other block chain nodes of the block chain through a Commit message in the Commit phase. And then, if receiving a Commit message which is sent by 2f other consensus nodes and carries the hash information of the temporary block of the same first transaction set, the arbitrary consensus node confirms the transaction execution of the first transaction set.
Here, for convenience of understanding, it is assumed that there are 4 consensus nodes of the blockchain: p1, P2, P3 and P4, wherein P1 is a consensus main node of the N-th consensus proposal, P2, P3 and P4 are consensus backup nodes of the N-th consensus proposal, and only the first transaction set is included in the N-th consensus proposal initiated by P1. As shown in fig. 2, the conventional PBFT-based transaction uplink process may sequentially perform a pre-prepare stage consensus operation, a Commit stage consensus operation, a transaction execution operation/transaction execution confirmation operation (indicated by shaded blocks), and a block write operation (indicated by unfilled blocks) on a first transaction set in a serial manner.
An application scenario of the embodiment of the present disclosure is shown in fig. 3, which is a PBFT protocol-based uplink transaction process. That is, the P1 directly generates a temporary area of the N-th round consensus proposal before performing the consensus operation in the Commit stage of the PBFT protocol, and sends a hash information Commit message carrying the temporary blocks of the N-th round consensus proposal to other consensus nodes in the Commit stage. It should be understood that, since the N-th consensus proposal only includes the first transaction set, the hash information of the temporary block of the N-th consensus proposal is the hash information of the first transaction set, and if the consensus node receives a Commit message carrying the hash information of the temporary block of the same N-th consensus proposal sent by 2f other consensus nodes in the Commit stage, it can confirm the final execution of all transactions in the N-th consensus proposal and directly write the temporary block of the N-th consensus proposal into the block chain.
As can be seen from comparing fig. 2 and fig. 3, the application scenario of the embodiment of the present disclosure can complete the transaction execution operation and the subsequent transaction execution confirmation operation in the consensus phase without introducing additional message overhead.
Of course, the above is an example of how the consensus node performs the transaction execution operation and the transaction execution confirmation operation when only one transaction set is included in the consensus proposition. In addition to fig. 2, the method according to the embodiment of the present invention may also be as shown in fig. 4, where the consensus primary node performs a transaction execution operation with the consensus backup node in the Prepare phase; or as shown in fig. 5, the consensus primary node and the consensus backup node execute the transaction execution operation after the Prepare phase and enter the Commit phase after the transaction execution operation is completed. It should be understood that, regardless of the variations, it is within the scope of the present document to perform transaction execution operations and transaction execution confirmations in parallel on a transaction set, all within the consensus phase of the transaction set.
When the above principle is extended to the nth round of consensus proposing a plurality of transaction sets including the first transaction set, the consensus node may complete the consensus operation, the transaction execution operation and the transaction execution confirmation operation on a plurality of intersections of the nth round of consensus proposing in batches as shown in fig. 6.
Fig. 6 exemplifies that the nth round consensus proposal includes a first intersection, a second transaction set, and a third transaction set. The common identification node is provided with a first CPU thread (which may also be a CPU core, which is not described herein by way of example again) responsible for executing the common identification operation, a second CPU thread responsible for executing the transaction execution operation and the transaction execution confirmation operation, and a third CPU thread responsible for executing the block writing operation, where the first CPU thread, the second CPU thread, and the third CPU thread are parallel to each other.
First, the consensus node executes the consensus operation of the first transaction set through the first CPU thread, and simultaneously executes the transaction execution operation and the transaction execution confirmation operation of the first transaction set through the second CPU thread. After the first transaction set completes consensus and the transaction execution result is confirmed, the consensus node starts to execute the consensus operation of the second transaction set through the first CPU thread, and simultaneously execute the transaction execution operation and the transaction execution confirmation operation of the second transaction set through the second CPU thread. After the second transaction set completes consensus and the transaction execution result is confirmed, the consensus node starts to execute the consensus operation of the third transaction set through the first CPU thread, and simultaneously executes the transaction execution operation and the transaction execution confirmation operation of the third transaction set through the second CPU thread. After the third transaction set completes consensus and the transaction execution result is confirmed, the consensus node starts to execute block writing operation on the first transaction set, the second transaction set and the third transaction set through the third CPU thread regeneration.
Furthermore, if the N-th round consensus proposition includes multiple transaction sets including the first transaction set (still taking the N-th round consensus proposition including the first intersection, the second transaction set and the third transaction set as an example), the consensus node may further set more CPU threads to implement, on the basis that the consensus operation, the transaction execution operation and the transaction execution confirmation operation are completed on multiple intersections of the N-th round consensus proposition in batches, as shown in fig. 7: when the transaction execution operation is executed on the first transaction set, if a second transaction set which is not completed with consensus exists in the Nth round of consensus proposition, the consensus operation is executed on the second transaction set in parallel. Similarly, when executing the transaction execution operation on the second transaction set, if a third transaction set which does not complete consensus exists in the Nth round of consensus proposition, executing the consensus operation on the third transaction set in parallel. It can be seen that, compared with the transaction processing method shown in fig. 6, the transaction processing method shown in fig. 7 further utilizes the advantages of multi-core and multi-thread of the CPU to improve the uplink efficiency of the blockchain transaction in a parallel manner. Here, if the order of execution of the blockchain transactions needs to be ensured, the transaction execution operations of the second transaction set should be executed after the transaction execution operations of the first transaction set are completed, and similarly, the transaction execution operations of the third transaction set should be executed after the transaction execution operations of the second transaction set are completed.
In summary, when the method of the application scenario performs the consensus operation on the first transaction set of the nth consensus proposal, the method also performs the transaction execution operation on the first transaction set in parallel, thereby improving the efficiency of transaction execution confirmation of the first transaction set, enabling the client user to know the transaction execution result as early as possible, and improving the user experience to a certain extent. On the other hand, the concurrence of the consensus operation and the transaction execution operation also shortens the uplink time consumption of the blockchain transaction, which means that the traffic throughput of the blockchain is improved.
In addition, even if the consensus proposal is timed out to trigger the view switching of the block chain (replacing the consensus master node), the consensus node does not waste time to execute the transaction execution operation. This is because the consensus proposed timeout period set by the existing blockchain is typically several seconds to several tens of seconds, and the consensus node has enough time to complete the transaction execution operation during the timeout period.
Of course, if the consensus suggestion timeout ends, the consensus node may also cache the generated temporary block for use in subsequent rounds of consensus suggestions. Here, taking the N-th consensus suggestion timeout as an example, after the N-th consensus suggestion timeout is generated, if the N-th consensus suggestion timeout ends, the consensus node may buffer the temporary block of the first transaction set, and when performing the consensus operation on the transaction set of the N + 1-th consensus suggestion, if the N + 1-th consensus suggestion is consistent with the transaction set of the N-th consensus suggestion (i.e., the consensus node of the N + 1-th consensus suggestion initiates the consensus suggestion of the same transaction set), skip performing the transaction execution operation on the second transaction set, and use the buffered temporary block of the first transaction set as the temporary block of the second transaction set. That is, if the (N + 1) th round of consensus offers to agree, the temporary blocks previously cached in the first transaction set are written into the block chain. Of course, if the N +1 th consensus proposal does not match the transaction set of the nth consensus proposal, the consensus node may choose to delete the temporary block of the cached first transaction set to clear the cache space. The process is suitable for a scene that the consensus proposal is recovered and restarted after the failure occurs in the consensus period by the consensus proposal main node, or the consensus proposal overtime triggers the view switching of the block chain, and the new consensus proposal main node restarts the scene of the consensus proposal for the transaction set of the original consensus proposal.
Corresponding to the transaction processing method shown in fig. 1, an embodiment of the present invention further provides a blockchain node. Fig. 8 is a schematic structural diagram of a block link point 800 according to an embodiment of the present invention, including:
a transaction consensus module 810, which performs consensus operations of the first transaction set in the nth round of consensus offers, where N is a positive integer;
a transaction execution module 820 that executes transaction execution operations of the first set of transactions;
the transaction execution confirmation module 830, after the transaction execution operation is completed, initiates a transaction execution determination operation on the first transaction set;
and a block writing module 840 for performing a block writing operation on all transaction sets of the N-th consensus proposal after all transaction sets of the N-th consensus proposal have been agreed and the transaction execution confirmation operation is completed.
Based on the device of the embodiment of the description, the common identification node of the block chain can execute transaction execution operation on the transaction in advance before the common identification operation of the transaction is completed, and initiates the transaction execution determination operation after the transaction execution operation is completed, so that the transaction finalization confirmation efficiency is improved, a client user can know the transaction execution result as soon as possible, and the user experience is improved to a certain extent. In addition, the write block operation can be executed earlier in advance of transaction execution confirmation, so that the transaction uplink efficiency of the block chain is improved, the service throughput of the block chain is further improved, and the block chain transaction processing method and the block chain transaction processing system meet the high-concurrency development trend of block chain services in the future.
Optionally, the transaction execution confirmation module 830 is specifically configured to: sending a transaction execution confirmation message of the first transaction set to other common identification nodes of the block chain, wherein the transaction execution confirmation message carries hash information of the first transaction set; and receiving transaction execution confirmation messages which are sent by other consensus nodes and carry the hash information of the first transaction set, and confirming the transaction execution of the first transaction set after receiving the transaction execution confirmation messages which are sent by 2f other consensus nodes and carry the same hash information of the first transaction set, wherein f is the Byzantine fault-tolerant quantity set by the block chain.
Optionally, the write block module 840 is specifically configured to: generating a temporary block of the N round consensus proposition after the confirmation operation is performed on all transaction sets of the N round consensus proposition; if no consensus has been reached for all transaction sets of the Nth consensus proposal, the consensus node waits; if consensus has been reached for all transaction sets of the N-th consensus proposal, the consensus node writes the temporary blocks of the N-th consensus proposal into the block chain.
Optionally, the transaction consensus module 810 performs the transaction execution operations of the first transaction set in parallel by the transaction execution module 820 at the same colleague performing the consensus operations of the first transaction set in the N-th round of consensus offers.
By way of exemplary presentation:
the consensus node executes consensus operation based on a practical Byzantine fault-tolerant PBFT protocol; if the consensus node is the consensus master node of the block chain, the transaction execution module 820 executes the transaction execution operation of the first transaction set in parallel when the transaction consensus module 810 executes the consensus operation of the Pre-preparation stage of the PBFT protocol on the first transaction set; if the consensus node is the consensus backup node of the block chain, the transaction executing module 820 executes the transaction executing operation of the first transaction set in parallel when the transaction consensus module 810 executes the consensus operation of the preparation Prepare stage of the PBFT protocol on the first transaction set.
Optionally, the transaction executing module 820 completes the transaction executing operation executed on the first transaction set before the transaction consensus module 810 executes the consensus operation of the guaranteed Commit stage of the PBFT protocol on the first transaction set; the transaction execution confirming module 830, when executing the Commit operation of the Commit stage of the PBFT on the first transaction set, uses a Commit message as a transaction execution confirming message of the first transaction set to send to other consensus nodes of the block chain, where the Commit message sent by the consensus nodes carries hash information of the first transaction set generated by the consensus nodes.
Optionally, if the N-th round consensus suggestion only includes the first transaction set, the consensus node generates a temporary block of the N-th round consensus suggestion before performing a consensus operation in a Commit phase of the PBFT protocol on the first transaction set, where a Commit message sent by the consensus node carries hash information of the temporary block of the N-th round consensus suggestion generated by the consensus node, and the hash information of the temporary block of the N-th round consensus suggestion serves as hash information of the first transaction set.
Optionally, if the N-th round consensus is proposing a plurality of transaction sets including the first transaction set, the consensus node performs consensus operations on the second transaction set in parallel if a second transaction set exists while performing transaction execution operations on the first transaction set, wherein the second transaction set is a transaction set of the N-th round consensus proposition for which consensus has not been completed.
In addition, the block chain node according to the embodiment of the present invention further includes:
a buffer module, configured to buffer the temporary block of the N-th consensus suggestion if the N-th consensus suggestion is over time after the transaction execution module 820 generates the temporary block of the N-th consensus suggestion; correspondingly, when the N +1 th consensus offer is performed, if the N +1 th consensus offer matches the transaction set of the N th consensus offer, the transaction execution module 820 skips the process of performing the transaction execution on the transaction set of the N +1 th consensus offer and uses the temporary block of the N +1 th consensus offer as the temporary block of the N +1 th consensus offer. Of course, if the N +1 th consensus suggestion is inconsistent with the transaction set of the nth consensus suggestion, the buffer module deletes the temporary block that can be removed from the temporary block of the nth consensus suggestion.
Obviously, the block link point of the embodiment of the present specification may be used as the execution subject of the transaction processing method shown in fig. 1, and thus the functions of the transaction processing method realized in fig. 1 can be realized. Since the principle is the same, it is not described herein in detail.
Fig. 9 is a schematic structural diagram of an electronic device according to an embodiment of the present specification. Referring to fig. 9, at a hardware level, the electronic device includes a processor, and optionally further includes an internal bus, a network interface, and a memory. The Memory may include a Memory, such as a Random-Access Memory (RAM), and may further include a non-volatile Memory, such as at least 1 disk Memory. Of course, the electronic device may also include hardware required for other services.
The processor, the network interface, and the memory may be connected to each other by an internal bus, which may be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, an EISA (Extended Industry Standard Architecture) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one double-headed arrow is shown in FIG. 9, but this does not indicate only one bus or one type of bus.
And the memory is used for storing programs. In particular, the program may include program code comprising computer operating instructions. The memory may include both memory and non-volatile storage and provides instructions and data to the processor.
The processor reads a corresponding computer program from the nonvolatile memory into the memory and then runs the computer program to form a transaction processing device of the block chain on a logic level, wherein the transaction processing device can refer to a block chain node and also refer to a component in the block chain node. The processor is used for executing the program stored in the memory and is specifically used for executing the following operations:
and executing the consensus operation of the first transaction set in the Nth round of consensus proposition, wherein N is a positive integer.
And executing the transaction execution operation of the first transaction set.
And after the transaction execution operation is finished, initiating a transaction execution determination operation on the first transaction set.
After all transaction sets of the N round consensus proposal are agreed and the transaction execution confirmation operation is completed, the writing block operation is executed on all transaction sets of the N round consensus proposal.
Based on the electronic device in the embodiment of the description, the common identification node of the block chain can execute transaction execution operation on the transaction in advance before the common identification operation of the transaction is completed, and initiate the transaction execution determination operation after the transaction execution operation is completed, so that the transaction finalization determination efficiency is improved, a client user can know the transaction execution result as soon as possible, and the user experience is improved to a certain extent. In addition, the write block operation can be executed earlier in advance of transaction execution confirmation, so that the transaction uplink efficiency of the block chain is improved, the service throughput of the block chain is further improved, and the block chain transaction processing method and the block chain transaction processing system meet the high-concurrency development trend of block chain services in the future.
The transaction processing method disclosed in the embodiment shown in fig. 1 of the present specification can be applied to a processor, or can be implemented by a processor. The processor may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware in a processor or instructions in the form of software. The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components. The various methods, steps, and logic blocks disclosed in the embodiments of this specification may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of a method disclosed in connection with the embodiments of the present specification may be embodied directly in a hardware decoding processor, or in a combination of hardware and software modules in the decoding processor. The software module may be located in ram, flash memory, rom, prom, or eprom, registers, etc. storage media as is well known in the art. The storage medium is located in a memory, and a processor reads information in the memory and completes the steps of the method in combination with hardware of the processor.
It should be understood that the electronic device of the embodiment of the present specification can implement the functions of the embodiment of the above-mentioned consensus method shown in fig. 1. Since the principle is the same, the detailed description is omitted here.
Of course, besides the software implementation, the electronic device in this specification does not exclude other implementations, such as logic devices or a combination of software and hardware, and the like, that is, the execution subject of the following processing flow is not limited to each logic unit, and may also be hardware or logic devices.
Furthermore, embodiments of the present specification also propose a computer-readable storage medium storing one or more programs, the one or more programs comprising instructions, which when executed by a portable electronic device comprising a plurality of application programs, enable the portable electronic device to perform the method of the embodiment shown in fig. 1, and in particular to perform the following steps:
and executing the consensus operation of the first transaction set in the Nth round of consensus proposition, wherein N is a positive integer.
Performing a transaction performance operation of the first set of transactions.
And after the transaction execution operation is completed, initiating a transaction execution determination operation on the first transaction set.
After all transaction sets of the N round consensus proposal are agreed and the transaction execution confirmation operation is completed, the writing block operation is executed on all transaction sets of the N round consensus proposal.
As will be appreciated by one skilled in the art, embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, the description may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the description may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The foregoing description of specific embodiments has been presented for purposes of illustration and description. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
The above description is only an example of the present specification, and is not intended to limit the present specification. Various modifications and alterations to this description will become apparent to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present specification should be included in the scope of the claims of the present specification. Moreover, all other embodiments obtained by a person skilled in the art without making any inventive step shall fall within the scope of protection of this document.

Claims (14)

1. A blockchain transaction processing method, comprising:
a consensus node of the block chain executes consensus operation of a first transaction set in the Nth round of consensus proposition, wherein N is a positive integer;
the consensus node performs a transaction execution operation of the first set of transactions;
after the transaction execution operation is completed, the consensus node initiates a transaction execution determination operation on the first transaction set;
and after the consensus node agrees with all transaction sets of the N-th consensus proposal and completes the transaction execution confirmation operation, executing a block writing operation on all transaction sets of the N-th consensus proposal.
2. The method of claim 1, wherein the first and second light sources are selected from the group consisting of a red light source, a green light source, and a blue light source,
the consensus node initiates a determination of transactions of the first set of transactions comprising:
the common identification node sends a transaction execution confirmation message of the first transaction set to other common identification nodes of a block chain, wherein the transaction execution confirmation message carries hash information of the first transaction set;
and after receiving a transaction execution confirmation message which is sent by 2f other consensus nodes and carries the same hash information of the first transaction set, the consensus node confirms the transaction execution of the first transaction set, wherein f is the Byzantine fault-tolerant quantity set by the block chain.
3. The method as set forth in claim 2, wherein,
after the consensus node agrees with all transaction sets of the N-th consensus proposal and completes the transaction execution confirmation operation, performing a block writing operation on all transaction sets of the N-th consensus proposal, including:
after the consensus node completes the transaction confirmation operation on all transaction sets of the N-th consensus proposal, generating a temporary block of the N-th consensus proposal;
if no consensus has been reached for all transaction sets of the Nth consensus proposal, the consensus node waits;
if consensus has been reached for all transaction sets of the N-th consensus proposal, the consensus node writes the temporary blocks of the N-th consensus proposal into the block chain.
4. The method of claim 3, wherein the first and second light sources are selected from the group consisting of a red light source, a green light source, and a blue light source,
when the consensus node executes the consensus operation of the first transaction set, the transaction execution operations of the first transaction set are executed in parallel.
5. The method of claim 4, wherein the first and second light sources are selected from the group consisting of a red light source, a green light source, and a blue light source,
the consensus node executes consensus operation based on a practical Byzantine fault-tolerant PBFT protocol;
if the consensus node is used as a consensus main node of the block chain, executing the transaction execution operation of the first transaction set in parallel when executing the consensus operation of a Pre-preparation Pre-Prepare stage of the PBFT protocol on the first transaction set;
and if the consensus node is used as a consensus backup node of the block chain, executing the transaction execution operation of the first transaction set in parallel when executing the consensus operation of the preparation Prepare stage of the PBFT protocol on the first transaction set.
6. The method of claim 5, wherein said at least one of said first and second sets of parameters is selected from the group consisting of,
the consensus node completes the transaction execution operation executed on the first transaction set before executing the consensus operation of the Commit stage of the PBFT protocol on the first transaction set;
and when the consensus node executes the consensus operation of the Commit stage of the PBFT on the first transaction set, sending a Commit message serving as a transaction execution confirmation message of the first transaction set to other consensus nodes of the block chain, wherein the Commit message sent by the consensus nodes carries the hash information of the first transaction set generated by the consensus nodes.
7. The method of claim 6, wherein the first and second light sources are selected from the group consisting of a red light source, a green light source, and a blue light source,
the N round of consensus offer only comprises the first transaction set, the consensus node generates a temporary block of the N round of consensus offer before performing a consensus operation in a Commit phase of the PBFT protocol on the first transaction set, wherein a Commit message sent by the consensus node carries hash information of the temporary block of the N round of consensus offer generated by the consensus node, and the hash information of the temporary block of the N round of consensus offer serves as hash information of the first transaction set.
8. The method of claim 1, wherein the first and second light sources are selected from the group consisting of a red light source, a green light source, and a blue light source,
the N round consensus proposition comprises a plurality of transaction sets including the first transaction set, and the consensus node executes consensus operation on the second transaction set in parallel if a second transaction set exists when executing transaction execution operation on the first transaction set, wherein the second transaction set is the transaction set of the N round consensus proposition, which is not completed in consensus yet.
9. The method of claim 3, further comprising:
after the consensus node generates the temporary block of the N-th round of consensus proposition, if the N-th round of consensus proposition is over time, caching the temporary block of the N-th round of consensus proposition; and the number of the first and second groups,
when the consensus node performs the consensus operation on the (N + 1) th consensus proposal, if the (N + 1) th consensus proposal is consistent with the transaction set of the (N) th consensus proposal, the process of performing the transaction execution operation on the transaction set of the (N + 1) th consensus proposal is skipped, and the temporary block of the (N + 1) th consensus proposal is used as the temporary block of the (N + 1) th consensus proposal, and if the (N + 1) th consensus proposal is inconsistent with the transaction set of the (N) th consensus proposal, the temporary block of the (N) th consensus proposal is deleted.
10. The method of claim 1, wherein the first and second light sources are selected from the group consisting of a red light source, a green light source, and a blue light source,
the consensus node is a consensus master node of the block chain, and before the consensus node performs a transaction execution operation of the first transaction set in the nth round of consensus offers, the method further comprises:
and the consensus node creates the N-th round of consensus suggestions and sends the consensus suggestions to the consensus backup node of the block chain.
11. The method of claim 1, wherein the first and second light sources are selected from the group consisting of a red light source, a green light source, and a blue light source,
the consensus node is a consensus backup node of the blockchain, and before the consensus node performs a transaction execution operation of the first transaction set in the nth round of consensus offers, the method further includes:
and the consensus node receives the N-th consensus suggestion sent by the consensus master node of the block chain.
12. A block link point, comprising:
the transaction consensus module executes consensus operation of the first transaction set in the Nth round of consensus proposition, wherein N is a positive integer;
a transaction execution module to execute transaction execution operations of the first set of transactions;
the transaction execution confirmation module initiates a transaction execution determination operation on the first transaction set after the transaction execution operation is executed;
and the block writing module is used for performing block writing operation on all transaction sets of the N-th round consensus suggestion after all transaction sets of the N-th round consensus suggestion are agreed and the transaction execution confirmation operation is completed.
13. An electronic device includes: a memory, a processor, and a computer program stored on the memory and executable on the processor, the computer program being executed by the processor to:
executing consensus operation of a first transaction set in the Nth round of consensus proposition, wherein N is a positive integer;
performing a transaction performance operation of the first set of transactions;
after the transaction execution operation is executed, initiating a transaction execution determination operation on the first transaction set;
after all transaction sets of the N round consensus proposal are agreed and the transaction execution confirmation operation is completed, the writing block operation is executed on all transaction sets of the N round consensus proposal.
14. A computer-readable storage medium storing one or more programs that, when executed by an electronic device including a plurality of application programs, cause the electronic device to:
executing consensus operation of a first transaction set in the Nth round of consensus proposition, wherein N is a positive integer;
performing a transaction performance operation of the first set of transactions;
after the transaction execution operation is executed, initiating a transaction execution determination operation on the first transaction set;
after all transaction sets of the N round consensus proposal are agreed and the transaction execution confirmation operation is completed, the writing block operation is executed on all transaction sets of the N round consensus proposal.
CN202210178246.2A 2022-02-24 2022-02-24 Transaction processing method of block chain, block chain node and electronic equipment Pending CN114529414A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202210178246.2A CN114529414A (en) 2022-02-24 2022-02-24 Transaction processing method of block chain, block chain node and electronic equipment
PCT/CN2022/135403 WO2023160086A1 (en) 2022-02-24 2022-11-30 Transaction processing method of blockchain, blockchain node, and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210178246.2A CN114529414A (en) 2022-02-24 2022-02-24 Transaction processing method of block chain, block chain node and electronic equipment

Publications (1)

Publication Number Publication Date
CN114529414A true CN114529414A (en) 2022-05-24

Family

ID=81624487

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210178246.2A Pending CN114529414A (en) 2022-02-24 2022-02-24 Transaction processing method of block chain, block chain node and electronic equipment

Country Status (2)

Country Link
CN (1) CN114529414A (en)
WO (1) WO2023160086A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023160086A1 (en) * 2022-02-24 2023-08-31 蚂蚁区块链科技(上海)有限公司 Transaction processing method of blockchain, blockchain node, and electronic device

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190354518A1 (en) * 2018-05-01 2019-11-21 Michael Zochowski Chain mesh network for decentralized transaction systems
CN108648078B (en) * 2018-05-02 2021-03-23 杭州溪塔科技有限公司 Transaction preprocessing method and device and electronic equipment
CN110020859B (en) * 2019-03-28 2022-03-11 杭州秘猿科技有限公司 Parallel execution block chain consensus method and device and electronic equipment
CN112991066A (en) * 2021-04-27 2021-06-18 支付宝(杭州)信息技术有限公司 Consensus method and device in alliance chain and electronic equipment
CN113836232A (en) * 2021-09-24 2021-12-24 支付宝(杭州)信息技术有限公司 Consensus method and system in alliance chain
CN114529414A (en) * 2022-02-24 2022-05-24 蚂蚁区块链科技(上海)有限公司 Transaction processing method of block chain, block chain node and electronic equipment

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023160086A1 (en) * 2022-02-24 2023-08-31 蚂蚁区块链科技(上海)有限公司 Transaction processing method of blockchain, blockchain node, and electronic device

Also Published As

Publication number Publication date
WO2023160086A1 (en) 2023-08-31

Similar Documents

Publication Publication Date Title
US11095750B2 (en) Method, apparatus, and electronic device for processing consensus requests in a blockchain consensus network
US11368317B2 (en) Consensus method of consortium blockchain, and consortium blockchain system
EP3934162B1 (en) Blockchain consensus method and device and electronic equipment
CN111523153B (en) Block generation method and consensus node
CN110557420B (en) Operation method and system of independent sub-chains
CN110032436A (en) Support the block chain of pause and starting common recognition method, system and electronic equipment
CN111523899A (en) Consensus method of alliance chain, data verification method, device and system
CN109634989B (en) HIVE task execution engine selection method and system
CN114529414A (en) Transaction processing method of block chain, block chain node and electronic equipment
CN111522648B (en) Transaction processing method and device for block chain and electronic equipment
CN113821569A (en) Block chain consensus method and block chain
CN114529413A (en) Processing method of block chain transaction, block chain node and electronic equipment
CN111522696B (en) Downtime processing method, data persistence method and hardware of block chain common identification node
CN112465515B (en) Block chain consensus method, consensus node and electronic equipment
CN115409507A (en) Block processing method, block processing device, computer equipment and storage medium
CN113297318B (en) Data processing method, device, electronic equipment and storage medium
CN113438092B (en) Transaction broadcasting method and system
CN114266573A (en) Asynchronous processing method and system for block chain information
CN113535338A (en) Interaction method, system, storage medium and electronic device for data access
CN114357079A (en) Data processing method, node equipment, system and platform based on block chain
CN112445761B (en) File checking method and device and storage medium
CN115270107A (en) Information verification method and device, readable medium and electronic equipment
CN117520449A (en) Data operation management method, device, equipment and storage medium
CN117688883A (en) Interaction method and medium between EDA tools during digital chip time sequence optimization
CN117675797A (en) Channel installation package downloading method and device and computer readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination