CN114529413A - Processing method of block chain transaction, block chain node and electronic equipment - Google Patents

Processing method of block chain transaction, block chain node and electronic equipment Download PDF

Info

Publication number
CN114529413A
CN114529413A CN202210176770.6A CN202210176770A CN114529413A CN 114529413 A CN114529413 A CN 114529413A CN 202210176770 A CN202210176770 A CN 202210176770A CN 114529413 A CN114529413 A CN 114529413A
Authority
CN
China
Prior art keywords
batch
transactions
consensus
transaction
round
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
CN202210176770.6A
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 CN202210176770.6A priority Critical patent/CN114529413A/en
Publication of CN114529413A publication Critical patent/CN114529413A/en
Priority to PCT/CN2022/135613 priority patent/WO2023160092A1/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

Landscapes

  • Business, Economics & Management (AREA)
  • Human Resources & Organizations (AREA)
  • Engineering & Computer Science (AREA)
  • Strategic Management (AREA)
  • Entrepreneurship & Innovation (AREA)
  • Economics (AREA)
  • General Physics & Mathematics (AREA)
  • Marketing (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Business, Economics & Management (AREA)
  • Operations Research (AREA)
  • Development Economics (AREA)
  • Quality & Reliability (AREA)
  • Tourism & Hospitality (AREA)
  • Finance (AREA)
  • Educational Administration (AREA)
  • Accounting & Taxation (AREA)
  • Game Theory and Decision Science (AREA)
  • Technology Law (AREA)
  • Data Mining & Analysis (AREA)
  • Advance Control (AREA)
  • Retry When Errors Occur (AREA)

Abstract

The embodiment of the specification provides a processing method of a block chain transaction, a block chain node and an electronic device. The method comprises the following steps: the first batch of transactions in the nth round of consensus offers to collect blockchains. Performing consensus operation on the first batch of transactions, and if a second batch of transactions exists, performing collection operation on the second batch of transactions in batch order in parallel, wherein the second batch of transactions propose the batch transactions of which the collection is not completed for the Nth round of consensus. And performing transaction execution operation on the first batch of transactions, and if a third batch of transactions exists and performs the consensus operation on the third batch of transactions according to the batch sequence, wherein the third batch of transactions is a batch transaction which is collected and has not completed the consensus of the Nth round of consensus proposals. And sending a transaction execution result of the first batch of transactions in the block chain to perform transaction confirmation on the first batch of transactions. After the transaction confirmation of all the batch transactions of the Nth round consensus suggestion is obtained, the block writing operation is executed on all the batch transactions of the Nth round consensus suggestion.

Description

Processing method of block chain transaction, block chain node and electronic equipment
Technical Field
The present disclosure relates to the field of blockchain technologies, and in particular, to a method for processing blockchain transactions, 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 current processing flow of blockchain transaction mainly includes: transaction collection, transaction consensus, transaction execution and block writing. In the prior art, the four stages are executed in a serial manner, so that the processing efficiency of the blockchain transaction is relatively low.
In the future, the blockchain business will grow explosively, and in order to meet the scene requirement of high business concurrency, a technical scheme capable of improving the processing efficiency of blockchain transaction needs to be provided.
Disclosure of Invention
An embodiment of the present disclosure provides a method for processing a blockchain transaction, a blockchain node, and an electronic device, which can improve processing efficiency of the blockchain transaction.
In order to achieve the above purpose, the embodiments of the present specification are implemented as follows:
in a first aspect, a method for processing blockchain transactions is provided, which is applied to a blockchain node, and includes:
collecting a first batch of transactions in an Nth round of consensus suggestions of a blockchain, wherein the Nth round of consensus suggestions comprises a plurality of batch transactions, and N is a positive integer;
performing consensus operations on the first batch transactions, and if a second batch of transactions exists, performing collection operations on the second batch of transactions in batch order in parallel, wherein the second batch of transactions proposes batch transactions for which collection is not completed for the Nth round of consensus;
performing a transaction execution operation on the first batch of transactions, and if a third batch of transactions exists, executing the consensus operation on the third batch of transactions in batch order in parallel, wherein the third batch of transactions is a batch transaction of which the Nth round consensus proposal has been collected and has not completed consensus;
sending a transaction execution result of the first batch transaction in the blockchain to perform transaction confirmation on the first batch transaction;
and after the transaction confirmation of all the batch transactions of the Nth round consensus suggestion is obtained, performing block writing operation on all the batch transactions of the Nth round consensus suggestion.
In a second aspect, a method for processing a blockchain transaction is provided, where the method is applied to a blockchain node, and includes:
collecting a first batch of transactions in an Nth round of consensus suggestions of a blockchain, wherein the Nth round of consensus suggestions comprises a plurality of batch transactions, and N is a positive integer;
performing consensus operations on the first batch transactions, and if a second batch of transactions exists, performing collection operations on the second batch of transactions in batch order in parallel, wherein the second batch of transactions proposes batch transactions for which collection is not completed for the Nth round of consensus;
if all the batch transactions of the Nth round of consensus proposition are completed consensus, performing transaction execution operation on all the batch transactions of the Nth round of consensus proposition;
sending the transaction execution results of all batch transactions of the Nth round of consensus proposal in the blockchain to perform transaction confirmation on all batch transactions of the Nth round of consensus proposal;
and after the transaction confirmation of all the batch transactions of the Nth round consensus suggestion is obtained, performing block writing operation on all the batch transactions of the Nth round consensus suggestion.
In a third aspect, there is provided a block link point comprising:
the first transaction collection module is used for collecting first batch transactions in the N round of consensus suggestions of the block chain, wherein the N round of consensus suggestions comprise a plurality of batch transactions, and N is a positive integer;
the first transaction consensus module executes consensus operation on the first batch of transactions, and if a second batch of transactions exists, the transaction collection module simultaneously and parallelly executes collection operation on the second batch of transactions according to the batch sequence, wherein the second batch of transactions are batch transactions of which the Nth round consensus proposal is not completed;
the first transaction execution module performs transaction execution operation on the first batch of transactions, and if a third batch of transactions exists, the transaction consensus module simultaneously and parallelly executes consensus operation on the third batch of transactions according to the batch sequence, wherein the third batch of transactions are batch transactions of which the Nth round consensus offers are collected and not completed;
the first transaction confirmation module is used for sending a transaction execution result of the first batch of transactions in the block chain so as to perform transaction confirmation on the first batch of transactions;
and the first transaction block writing module is used for writing the block for all the batch transactions of the Nth round of consensus and suggestion after obtaining the transaction confirmation of all the batch transactions of the Nth round of consensus and suggestion.
In a fourth aspect, an electronic device is provided comprising: 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:
collecting a first batch of transactions in an Nth round of consensus suggestions of a blockchain, wherein the Nth round of consensus suggestions comprises a plurality of batch transactions, and N is a positive integer;
performing consensus operations on the first batch transactions, and if a second batch of transactions exists, performing collection operations on the second batch of transactions in batch order in parallel, wherein the second batch of transactions proposes batch transactions for which collection is not completed for the Nth round of consensus;
performing a transaction execution operation on the first batch of transactions, and if a third batch of transactions exists, executing the consensus operation on the third batch of transactions in batch order in parallel, wherein the third batch of transactions is a batch transaction of which the Nth round consensus proposal has been collected and has not completed consensus;
sending a transaction execution result of the first batch transaction in the blockchain to perform transaction confirmation on the first batch transaction;
and after the transaction confirmation of all the batch transactions of the Nth round consensus suggestion is obtained, performing block writing operation on all the batch transactions of the Nth round consensus suggestion.
In a fifth aspect, a computer-readable storage medium is provided, having stored thereon a computer program which, when executed by a processor, performs the steps of:
collecting a first batch of transactions in an Nth round of consensus suggestions of a blockchain, wherein the Nth round of consensus suggestions comprises a plurality of batch transactions, and N is a positive integer;
performing consensus operations on the first batch transactions, and if a second batch of transactions exists, performing collection operations on the second batch of transactions in batch order in parallel, wherein the second batch of transactions proposes batch transactions for which collection is not completed for the Nth round of consensus;
performing a transaction execution operation on the first batch of transactions, and if a third batch of transactions exists, executing the consensus operation on the third batch of transactions in batch order in parallel, wherein the third batch of transactions is a batch transaction of which the Nth round consensus proposal has been collected and has not completed consensus;
sending a transaction execution result of the first batch transaction in the blockchain to perform transaction confirmation on the first batch transaction;
and after the transaction confirmation of all the batch transactions of the Nth round consensus suggestion is obtained, performing block writing operation on all the batch transactions of the Nth round consensus suggestion.
In a sixth aspect, there is provided a block link point comprising:
the second transaction collection module is used for collecting first batch transactions in the N round of consensus suggestions of the block chain, wherein the N round of consensus suggestions comprise a plurality of batch transactions, and N is a positive integer;
the second transaction consensus module executes consensus operation on the first batch of transactions, and if a second batch of transactions exists, the transaction collection module simultaneously and parallelly executes collection operation on the second batch of transactions according to the batch sequence, wherein the second batch of transactions are batch transactions of which the Nth round consensus proposal is not completed;
the second transaction execution module is used for performing transaction execution operation on all the batch transactions of the Nth round of consensus suggestion if all the batch transactions of the Nth round of consensus suggestion complete consensus;
the second transaction confirmation module is used for sending the transaction execution result of the first batch of transactions in the block chain so as to carry out transaction confirmation on the first batch of transactions;
and the second transaction block writing module is used for writing the block of all the batch transactions of the Nth round of consensus suggestion after obtaining the transaction confirmation of all the batch transactions of the Nth round of consensus suggestion.
In a seventh 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 executed by the processor:
collecting a first batch of transactions in an Nth round of consensus suggestions of a blockchain, wherein the Nth round of consensus suggestions comprises a plurality of batch transactions, and N is a positive integer;
performing consensus operations on the first batch transactions, and if a second batch of transactions exists, performing collection operations on the second batch of transactions in batch order in parallel, wherein the second batch of transactions proposes batch transactions for which collection is not completed for the Nth round of consensus;
if all the batch transactions of the N round of consensus proposition are completed with consensus, performing transaction execution operation on all the batch transactions of the N round of consensus proposition;
sending the transaction execution results of all batch transactions of the Nth round of consensus proposal in the blockchain to perform transaction confirmation on all batch transactions of the Nth round of consensus proposal;
and after the transaction confirmation of all the batch transactions of the Nth round consensus suggestion is obtained, performing block writing operation on all the batch transactions of the Nth round consensus suggestion.
In an eighth aspect, a computer-readable storage medium is provided, having stored thereon a computer program which, when executed by a processor, performs the steps of:
collecting a first batch of transactions in an Nth round of consensus suggestions of a blockchain, wherein the Nth round of consensus suggestions comprises a plurality of batch transactions, and N is a positive integer;
performing consensus operations on the first batch transactions, and if a second batch of transactions exists, performing collection operations on the second batch of transactions in batch order in parallel, wherein the second batch of transactions proposes batch transactions for which collection is not completed for the Nth round of consensus;
if all the batch transactions of the Nth round of consensus proposition are completed consensus, performing transaction execution operation on all the batch transactions of the Nth round of consensus proposition;
sending the transaction execution results of all batch transactions of the Nth round of consensus proposal in the blockchain to perform transaction confirmation on all batch transactions of the Nth round of consensus proposal;
and after the transaction confirmation of all the batch transactions of the Nth round consensus suggestion is obtained, performing block writing operation on all the batch transactions of the Nth round consensus suggestion.
Based on the solution of the embodiments of the present specification, the block link point may perform the transaction collection, the transaction agreement, the transaction execution, and the transaction confirmation for each round of the agreement proposal in batch. Particularly, when the consensus operation is executed on each round of consensus-proposed intermediate batch transaction, the execution operation of the previous batch transaction and the collection operation of the next batch transaction are also executed, so that the processing time of the block chain transaction is shortened in a parallel mode, the throughput of the block chain is further improved, and the requirement of a high-business concurrency scene is met.
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 first flowchart of a processing method for blockchain transactions according to an embodiment of the present disclosure.
Fig. 2 is a schematic time slot diagram of a processing method of blockchain transaction according to an embodiment of the present disclosure.
Fig. 3 is a schematic time slot diagram of a processing method for blockchain transactions according to an embodiment of the present disclosure.
Fig. 4 is a second flowchart of a processing method for blockchain transactions according to an embodiment of the present disclosure.
Fig. 5 is a third time slot diagram of a processing method for blockchain transactions according to an embodiment of the present disclosure.
Fig. 6 is a schematic structural diagram of a first block chain node according to an embodiment of the present disclosure.
Fig. 7 is a schematic structural diagram of a second block chain node according to an embodiment of the present disclosure.
Fig. 8 is a schematic structural diagram of an electronic device provided in an embodiment of this specification.
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 previously mentioned, the blockchain currently accomplishes the four operations of transaction collection, consensus, execution and block writing in a serial manner, which results in relatively inefficient processing of blockchain transactions and limits the throughput of blockchain transactions. As block chains become more popular with various industries, traffic volume may also increase explosively. Obviously, the current transaction processing mode is difficult to be applied to the scene with high subsequent business. To address this issue, this document aims to provide a technical solution capable of improving the efficiency of processing blockchain transactions.
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, collecting the first batch transaction in the N-th round of consensus suggestions of the block chain, wherein the N-th round of consensus suggestions comprises a plurality of batch transactions, and N is a positive integer.
It should be noted that the transaction lot dividing logic of the nth consensus proposal is not specifically limited herein. However, any scheme that divides the transaction in the N-th consensus proposal into a plurality of batches shall fall within the scope of the embodiments of the present disclosure.
By way of exemplary presentation: in this embodiment, each block chain link point of the block chain may uniformly perform ordered batch division on all transactions proposed by the N-th round of consensus according to the corresponding transaction initiation time based on an intelligent contract set in advance. Or, according to the transaction sequence in the N round of consensus suggestions, carrying out batch division on all transactions in the N round of consensus suggestions.
S104, executing the consensus operation on the first batch of transactions, and if a second batch of transactions exists, executing the collection operation on the second batch of transactions in batch sequence in parallel, wherein the second batch of transactions propose the batch transactions which are not completed for the Nth round of consensus.
It should be understood that the batch transactions for which collection has not been completed in this step may include batch transactions for which collection has not been initiated, or batch transactions for which collection has been initiated but not completed. The batch order is the batch division order described above in S102.
In the embodiment of the present specification, the block chain node collects the N-th round of the transaction of the consensus proposal in batch. After the collection of the target batch transaction is completed, the following steps can be executed simultaneously: the consensus execution operation of the target batch transaction and the collection operation of the next batch transaction corresponding to the target batch transaction. That is, the second batch transaction in this step is the next batch transaction of the first batch transaction.
S106, carrying out transaction execution operation on the first batch of transactions, and if a third batch of transactions exists, executing consensus operation on the third batch of transactions according to the batch sequence, wherein the third batch of transactions is batch transactions of which the Nth round consensus offers are collected and not completed.
It should be understood that the batch transaction of not completed consensus in this step may include batch transactions that have not initiated consensus, or batch transactions that have initiated consensus but have not completed consensus.
Similarly, in the embodiment of the present specification, the block link point batch performs the consensus operation on the N-th round of the transaction proposed by the consensus. After the consensus operation of the target batch transaction is completed, the following steps can be executed simultaneously: the execution operation of the target batch transaction and the consensus operation of the next batch transaction corresponding to the target batch transaction. That is, the third batch transaction in this step is the next batch transaction of the second batch transaction.
And S108, sending the transaction execution result of the first batch of transactions in the block chain so as to carry out transaction confirmation on the first batch of transactions.
Specifically, the blockchain link node as the execution subject of this step may send a transaction confirmation request of the transaction execution result of the first batch of transactions to other blockchain nodes of the blockchain; and then if transaction confirmation feedback sent by 2f other block chain nodes is received, confirming that the transaction confirmation of the first batch of transactions is obtained. Wherein f is the maximum number of abnormal common identification nodes allowed by the block chain.
S110, after the transaction confirmation of all the batch transactions of the Nth round of consensus suggestion is obtained, the block writing operation is executed on all the batch transactions of the Nth round of consensus suggestion.
It should be understood that in the embodiment of the present specification, the block link point performs the consensus operation on the transaction of the nth consensus proposal in batches, but may eventually perform the block writing operation only once. That is, in the embodiment of the present specification, all batch transactions of the nth consensus proposal can be recorded through one block.
Based on the methods of embodiments herein, block link points may perform tractions, trade consensus, trade execution, and trade validation on each round of consensus offers in batches. Particularly, when the consensus operation is executed on each round of the intermediate batch transaction proposed by the consensus, the execution operation of the previous batch transaction and the collection operation of the next batch transaction are also executed, so that the processing time of the block chain transaction is shortened in a parallel mode, the throughput of the block chain is further improved, and the requirement of a high-service concurrency scene is met.
In addition, after the transaction confirmation of the first batch of transactions is obtained, the transaction execution result of the first batch of transactions can be fed back to the corresponding block chain client. That is to say, in the method according to the embodiment of the present disclosure, after the transaction execution is completed and the transaction is confirmed in each batch of transactions, the blockchain link point may immediately feed back the transaction execution to the blockchain client, so that the transaction confirmation delay at the blockchain client side is significantly reduced, and the user experience is further improved.
Alternatively, in order to reduce the resource overhead of interaction with the blockchain client side, after the transaction confirmation of all batch transactions of the nth round of consensus offers is obtained, the transaction execution results of all batch transactions of the nth round of consensus offers may be uniformly fed back to the corresponding blockchain client sides.
In practical application, a feedback strategy of the transaction execution result can be decided according to the transaction number in the N-th round consensus suggestion. For example, when the transaction amount in the nth round of consensus offers exceeds a preset threshold, the blockchain client may be selected to immediately feed back the transaction execution result after the transaction execution is completed and the transaction is confirmed in each batch of transactions. Similarly, when the transaction amount in the nth round of consensus offers does not exceed the preset threshold, the transaction execution results of all the batch transactions in the nth round of consensus offers can be uniformly fed back to the corresponding blockchain client after the transaction execution of all the batch transactions in the nth round of consensus offers is completed and the transaction confirmation is obtained.
Further, it should also be understood that the method of embodiments of the present specification can continuously process multiple rounds of consensus-proposed transactions.
The working principle is described in detail below by taking as an example the case that the method of the embodiment of the present specification continuously processes the transactions in the consensus proposals of the nth round and the (N + 1) th round.
Referring to fig. 2, the method of the embodiment of the present specification may set a first thread, a second thread, a third thread, a fourth thread, and a fifth thread that are executed in parallel with each other to respectively correspond to five operations of performing collection, consensus, transaction execution, transaction confirmation, and block writing of a blockchain transaction.
The first thread is used for collecting transactions according to batches, namely the first thread does not collect other batches of transactions before one batch of transactions is collected; the second thread is used for executing the consensus operation of the transactions in batches, namely the second thread does not execute the consensus operation of other batches of transactions before executing the consensus operation of one batch of transactions; the third thread is used for executing the execution operation of the transaction in batches, namely executing the execution operation of other batch transactions before the execution operation of one batch transaction is executed. The fourth thread performs transaction confirmation by batch, namely, transaction confirmation of other batch transactions is not performed before transaction confirmation of one batch transaction is performed. And the fifth thread executes the block writing operation uniformly after all batch transactions of each round of consensus proposal are confirmed.
The first batch transaction described above is taken as an example. After the first thread collects the first batch of transactions, the second thread is informed to carry out consensus operation on the first batch of transactions; after the second thread finishes executing the consensus operation of the first batch of transactions, informing the third thread to execute the execution operation on the first batch of transactions; and after the third thread finishes the execution operation of the first batch of transaction, the fourth thread is informed to carry out transaction confirmation on the first batch of transaction.
Taking the example that the consensus proposals of the Nth round and the (N + 1) th round are divided into three batch transactions, the consensus proposals of the Nth round and the (N + 1) th round can present the time slot relationship shown in FIG. 2 by using the working principle of the thread.
As can be seen from fig. 2:
if all the batch transactions in the N round of consensus propositions are collected when the consensus operation is performed on the first batch transactions, the collection operation of the batch transactions in the (N + 1) round of consensus propositions in the sequence of batches is performed.
And if a second batch of transactions exists when the transaction execution operation is carried out on the first batch of transactions, executing the collection operation of the second batch of transactions in parallel according to the batch sequence.
If all the batch transactions in the N round of consensus suggestions are collected when the transaction execution operation is performed on the first batch transactions, the collection operation of the batch transactions in the (N + 1) th round of consensus suggestions according to the sequence of batches is performed.
If all the batch transactions in the N round of consensus propositions are known to be completed when the transaction execution operation is performed on the first batch transactions, the consensus operation of the collected but not yet known batch transactions in the (N + 1) round of consensus propositions according to the sequence of batches is performed.
And if all the batch transactions in the N round of consensus suggestions are collected when the first batch transactions are subjected to block writing operation, performing collection operation on the batch transactions in the (N + 1) th round of consensus suggestions according to the sequence of batches.
If all the batch transactions in the N round of consensus propositions are known to be completed when the block writing operation is performed on the first batch transactions, the consensus operation of the collected but not yet known batch transactions in the (N + 1) round of consensus propositions is performed according to the sequence of batches.
It will also be appreciated that it is also important to ensure the order in which transactions are executed. Assume that in a transaction scenario, user A needs to send 10000 dollars to user B, and then user B sends 5000 dollars to user C. Assuming that the initial balance of user B is 3000, if the transaction is not performed in sequence, i.e. user B remits 5000 yuan to user C and user a remits 10000 yuan to user B, then the problem of failure of remittance from user B to user C occurs.
Thus, to avoid such transaction logic problems, each round of consensus offers that a subsequent transaction cannot be executed earlier than a previous transaction. In the actual uplink process of transaction data, the time consumption of the execution phase is greater than that of the collection phase and the consensus phase. This results in that after the consensus is completed, each intermediate transaction needs to wait for the previous transaction to complete, and the waiting time (T in fig. 2 indicates the waiting time) determines the uplink efficiency of the transaction data.
The method based on the embodiment of the present specification divides each round of the transaction of the consensus proposition into a plurality of small batches, which can reduce the time consumption of each batch of transaction in execution, that is, reduce the length of T in fig. 2, thereby improving the processing efficiency of the blockchain transaction.
It should be understood that the first, second, third, fourth, and fifth threads described above may belong to different cores of a processor. That is, the illustrative embodiments may perform the collect, consensus, and execute operations of a transaction for the same round of consensus offers in a multi-core, multi-threaded parallel manner.
The above is a description of the method of the embodiments of the present specification. It will be appreciated that appropriate modifications may be made without departing from the principles outlined herein, and such modifications are intended to be included within the scope of the embodiments herein.
For example, in this embodiment, since the operation of the transaction execution result feedback client may be executed immediately after the transaction is executed, one thread may be used to execute the transaction execution operation and the transaction execution result feedback operation. That is, the fourth thread described above is the third thread described above, and the consensus proposals of the nth and N +1 th rounds can exhibit the time slot relationship shown in fig. 3.
For another example, the method of the embodiment of the present specification may further perform the execution operation and the block writing operation on all the batch transactions of the nth round consensus suggestion after all the batch transactions of the nth round consensus suggestion have completed consensus. That is, the processing method for blockchain transaction in the embodiment of the present specification may further include, as shown in fig. 4, the following steps:
s402, collecting the first batch transactions in the N round of consensus suggestions of the block chain, wherein the N round of consensus suggestions comprises a plurality of batch transactions.
S404, executing the consensus operation on the first batch of transactions, and if a second batch of transactions exists, executing the collection operation on the second batch of transactions in batch sequence in parallel, wherein the second batch of transactions propose the batch transactions which are not completed for the Nth round of consensus.
S406, if all the batch transactions of the Nth round of consensus proposition are completed, the transaction execution operation is performed on all the batch transactions of the Nth round of consensus proposition.
And S408, sending the transaction execution results of all the batch transactions of the N-th round of consensus and offer in the blockchain to perform transaction confirmation on all the batch transactions of the N-th round of consensus and offer.
S410, after the transaction confirmation of all the batch transactions of the Nth round consensus proposal is obtained, the block writing operation is executed on all the batch transactions of the Nth round consensus proposal.
Fig. 5 is a time slot relationship diagram for the N-th and N + 1-th rounds of consensus proposals based on the method shown in fig. 4. It should be understood that the execution of all batch transactions of the N-th consensus proposal is performed at least after the execution of all batch transactions of the N-1 th consensus proposal is completed.
Similarly, the method shown in FIG. 4 collects transactions in batch order for each round of consensus offers through the first thread, i.e., the first thread does not collect other batch transactions until one batch transaction is collected; the consensus operation of the transactions is executed according to the batch sequence by the two threads for each round of consensus proposal, namely the second thread does not execute the consensus operation of other batches of transactions before executing the consensus operation of one batch of transactions; uniformly performing transaction execution operation on all batch transactions in each round of consensus proposition through a third thread; executing transaction confirmation on all batch transactions in each round of consensus suggestions in a unified way through a fourth thread; and uniformly writing the blocks of all batch transactions in each round of consensus proposition through the fifth thread. Here, the first thread, the second thread, the third thread, and the fourth and fifth threads are threads that are executed in parallel.
As can be seen from fig. 5, for the method shown in fig. 4:
if all batch transactions in the N round of consensus propositions are collected when the consensus operation is performed on the first batch transactions, the collection operation of the batch transactions in the (N + 1) th round of consensus proposition in the order of batches is performed.
If a second batch of transactions exists when the transaction execution operation is performed on the first batch of transactions, the collection operation of the second batch of transactions in the order of batches is executed in parallel.
If all the batch transactions in the N round of consensus suggestions are collected when the transaction execution operation is performed on the first batch transactions, the collection operation of the batch transactions in the (N + 1) th round of consensus suggestions according to the sequence of batches is performed.
If all the batch transactions in the N round of consensus propositions are known to be completed when the transaction execution operation is performed on the first batch transactions, the consensus operation of the collected but not yet known batch transactions in the (N + 1) round of consensus propositions according to the sequence of batches is performed.
And if all the batch transactions in the N round of consensus suggestions are collected when the block writing operation is carried out on the first batch transactions, executing the collection operation of the batch transactions in the (N + 1) th round of consensus suggestions according to the sequence of batches.
If all the batch transactions in the N round of consensus propositions are known to be completed when the block writing operation is performed on the first batch transactions, the consensus operation of the collected but not yet known batch transactions in the (N + 1) round of consensus propositions is performed according to the sequence of batches.
It can be seen that the method shown in fig. 4 can also perform transaction collection and transaction consensus for each round of consensus suggestions in batches. Particularly, when the consensus operation is executed on the intermediate batch transaction of each round of consensus proposal, the collection operation of the next batch transaction is also executed, so that the processing time of the block chain transaction can be shortened in a parallel mode, the throughput of the block chain is further improved, and the requirement of a high-service concurrency scene is met.
In addition, corresponding to the processing method shown in fig. 1, an embodiment of the present specification further provides a blockchain node. Fig. 6 is a schematic structural diagram of a block chain node 600 according to an embodiment of the present specification, including:
the first transaction collection module 610 collects a first batch transaction in an nth round of consensus offers of the blockchain, wherein the nth round of consensus offers comprises a plurality of batch transactions, and N is a positive integer.
The first transaction consensus module 620 performs a consensus operation on the first batch of transactions, and if there is a second batch of transactions, the transaction collection module concurrently performs a collection operation on the second batch of transactions in batch order, wherein the second batch of transactions propose the batch transactions for which the collection is not completed for the Nth round of consensus.
A first transaction executing module 630, performing a transaction executing operation on the first batch of transactions, and if there is a third batch of transactions, concurrently executing a consensus operation on the third batch of transactions in batch order by the transaction consensus module, wherein the third batch of transactions is a batch transaction in which the Nth consensus offer has been collected and not completed;
the first transaction confirmation module 640 sends the transaction execution result of the first batch of transactions in the blockchain to perform transaction confirmation on the first batch of transactions.
The first transaction block writing module 650 performs block writing operation on all batch transactions of the nth round consensus suggestion after obtaining the transaction confirmation of all batch transactions of the nth round consensus suggestion.
The block link points of the embodiments of the present description may perform the transaction collection, transaction consensus, and transaction execution of each round of consensus offers in batches. Specifically, while executing the consensus operation on the intermediate batch transaction, the execution operation of the previous batch transaction and the collection operation of the next batch transaction are also executed, so that the processing time of the block chain transaction is shortened in a parallel manner, the throughput of the block chain is further improved, and the requirement of a high-business concurrency scene is met.
Alternatively, if all the batch transactions in the N-th round of consensus propositions are collected while the consensus operation is performed on the first batch of transactions, the first transaction collection module 610 performs the collection operation on the batch transactions in the N + 1-th round of consensus propositions in order of batches.
Alternatively, if there is the second batch transaction while the transaction execution operation is performed on the first batch transaction, the first transaction collection module 610 may execute the collection operation on the second batch transaction in batch order in parallel.
Optionally, if all the batch transactions in the N-th round of consensus propositions are collected when the transaction execution operation is performed on the first batch transactions, the first transaction collection module 610 performs the collection operation on the batch transactions in the N + 1-th round of consensus propositions in the order of batches.
Optionally, if all the batch transactions in the N-th round of consensus propositions are collected when the first batch transactions are written into blocks, the first transaction collection module 610 performs the collection of the batch transactions in the N + 1-th round of consensus propositions in order of batches.
Optionally, if all the batch transactions in the nth round of consensus propositions are known in common when the first batch transactions are written, the first transaction collection module 610 performs consensus operations on collected but not yet known batch transactions in the (N + 1) th round of consensus propositions in batch order.
Optionally, the first transaction confirmation module 640 sends a transaction confirmation request of the transaction execution result of the first batch of transactions to other block nodes of the block chain. And then, if transaction confirmation feedback sent by 2f other blockchain nodes is received, confirming that the transaction confirmation of the first batch of transactions is obtained, wherein f is the maximum number of the abnormal common identification nodes allowed by the blockchain.
Optionally, the block link point shown in fig. 6 in the embodiment of this specification further includes:
the first transaction feedback module feeds back the transaction execution result of the first batch transaction to the corresponding block chain client after the transaction confirmation of the first batch transaction is obtained; or after the transaction confirmation of all batch transactions of the Nth round of consensus suggestion is obtained, the transaction execution results of all batch transactions of the Nth round of consensus suggestion are fed back to the corresponding blockchain client.
Optionally, the first transaction collection module 610 collects all batch transactions in the nth round of consensus offers through a first thread that does not collect other batch transactions until one batch transaction is collected. The first transaction consensus module 620 performs the consensus operation on all the batch transactions in the N round of consensus proposition through a second thread, which does not perform the consensus operation on other batch transactions until the consensus operation on one batch transaction is completed. The first transaction execution module 630 executes the execution operations of all the batch transactions in the N-th round of consensus proposition through a third thread, which does not execute the execution operations of other batch transactions until the execution operations of one batch transaction are completed; the first transaction confirmation module 640 performs transaction confirmation of all batch transactions in the nth round of consensus offers through the fourth thread. The first transaction block writing module 650 performs block writing operations on all batch transactions in the nth round consensus proposition through a fifth thread. Wherein the first thread, the second thread, the third thread, the fourth thread, and the fifth thread are threads that are executed in parallel.
Optionally, after the first thread collects the first batch of transactions, notifying the second thread to perform consensus operation on the first batch of transactions; after the second thread finishes executing the consensus operation of the first batch of transactions, informing the third thread to execute the execution operation of the first batch of transactions; and after the third thread finishes executing the execution operation of the first batch of transactions, informing the fourth thread to carry out transaction confirmation on the first batch of transactions.
Obviously, the block link point shown in fig. 6 may be used as the execution subject of the processing method shown in fig. 1, and thus the functions of the processing method realized in fig. 1 to 3 can be realized. Since the principle is the same, the detailed description is omitted here.
In addition, corresponding to the processing method shown in fig. 4, an embodiment of the present specification further provides a blockchain node. Fig. 7 is a schematic structural diagram of a blockchain node 700 according to an embodiment of the present specification, including:
the second transaction collection module 710 collects the first batch transactions in the N-th round of consensus offers of the blockchain, wherein the N-th round of consensus offers comprises a plurality of batch transactions, and N is a positive integer;
a second transaction consensus module 720, performing consensus on the first batch of transactions, and if there are second batch of transactions, the transaction collection module concurrently performs collection operations on the second batch of transactions in batch order, wherein the second batch of transactions is the Nth round of consensus proposing batch transactions for which collection is not yet completed;
the second transaction executing module 730, if the batch transactions of the nth consensus proposal are agreed, performing transaction executing operation on the batch transactions of the nth consensus proposal;
the second transaction confirmation module 740 is configured to send the transaction execution result of the first batch of transactions in the blockchain to perform transaction confirmation on the first batch of transactions;
the second transaction block writing module 750, after receiving the transaction confirmation of all batch transactions of the nth round of consensus-offer, performs block writing operation on all batch transactions of the nth round of consensus-offer.
Alternatively, if all the batch transactions in the N-th round of consensus proposition are collected while the consensus operation is performed on the first batch transactions, the second transaction collection module 710 performs the collection operation on the batch transactions in the N + 1-th round of consensus proposition in order of batch.
Alternatively, if there is the second batch transaction while the transaction execution operation is performed on the first batch transaction, the second transaction collection module 710 performs the collection operation on the second batch transaction in parallel according to the batch order.
Optionally, if all the batch transactions in the N-th round of consensus propositions are collected when the transaction execution operation is performed on the first batch transactions, the second transaction collection module 710 performs the collection operation on the batch transactions in the N + 1-th round of consensus propositions in the order of batches.
Optionally, if all the batch transactions in the N-th round of consensus proposition are collected when the block writing operation is performed on the first batch transactions, the second transaction collection module 710 performs the collection operation on the batch transactions in the N + 1-th round of consensus proposition according to the order of batches.
Optionally, if all the batch transactions in the nth round of consensus proposition are agreed upon when the block writing operation is performed on the first batch transaction, the second transaction collection module 710 performs consensus operation on collected but not yet agreed batch transactions in the (N + 1) th round of consensus proposition according to the order of batches.
Optionally, the second transaction confirmation module 740 sends a transaction confirmation request of the transaction execution result of the first batch of transactions to other block nodes of the block chain. And then, if transaction confirmation feedback sent by 2f other blockchain nodes is received, confirming that the transaction confirmation of the first batch of transactions is obtained, wherein f is the maximum number of the abnormal common identification nodes allowed by the blockchain.
Optionally, the block link point shown in fig. 7 in the embodiment of this specification further includes:
and the second transaction feedback module feeds back the transaction execution results of all batch transactions of the Nth round of consensus and offer to the corresponding blockchain client after obtaining the transaction confirmation of all batch transactions of the Nth round of consensus and offer.
Optionally, the second transaction collection module 710 collects all batch transactions in the nth round of consensus offers through a first thread that does not collect other batch transactions until one batch transaction is collected. The second transaction consensus module 720 performs the consensus on all the batch transactions in the Nth round of consensus propositions through a second thread, which does not perform the consensus on other batch transactions until the consensus on one batch transaction is completed. The second transaction execution module 730 executes the execution operation of all the batch transactions in the N round of consensus propositions through a third thread; the second transaction confirmation module 740 performs transaction confirmation of all batch transactions in the nth round of consensus proposition through the fourth thread. The second transaction block writing module 750 performs a block writing operation on all batch transactions in the nth round consensus proposal through a fifth thread. Wherein the first thread, the second thread, the third thread, the fourth thread, and the fifth thread are threads that are executed in parallel.
Optionally, after the first thread collects the first batch of transactions, the second thread is notified to perform consensus operations on the first batch of transactions.
Obviously, the block link point node shown in fig. 7 may be the main execution body of the processing method shown in fig. 4, and thus the functions of the processing method realized in fig. 4 and 5 can be realized. Since the principle is the same, it is not described herein in detail.
Fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present specification. Referring to fig. 8, 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 via 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. 8, but that 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.
Alternatively, the processor reads a corresponding computer program from the non-volatile memory into the memory and then runs the computer program, and forms a processing device of the blockchain transaction on a logic level, and the processing device can be used as a component in a blockchain link point or a blockchain node shown in fig. 6. The processor is used for executing the program stored in the memory and is specifically used for executing the following operations:
collecting the first batch transaction in the N round of consensus suggestions of the block chain, wherein the N round of consensus suggestions comprises a plurality of batch transactions, and N is a positive integer.
Performing consensus operations on the first batch of transactions, and performing collection operations on second batches of transactions in batch order in parallel if the second batches of transactions exist, wherein the second batches of transactions propose batch transactions for the Nth round of consensus that have not completed collection.
And if a third batch of transactions exists, executing transaction execution operation on the third batch of transactions in batch sequence, wherein the third batch of transactions is a batch transaction which is collected and not completed for the Nth round of consensus offer.
And sending a transaction execution result of the first batch of transactions in the blockchain to perform transaction confirmation on the first batch of transactions.
And after the transaction confirmation of all the batch transactions of the Nth round consensus suggestion is obtained, performing block writing operation on all the batch transactions of the Nth round consensus suggestion.
Alternatively, the processor reads a corresponding computer program from the non-volatile memory into the memory and then runs the computer program to form a processing device of the blockchain transaction on a logic level, and the processing device can be used as a component in a blockchain link point or a blockchain node shown in fig. 7. The processor is used for executing the program stored in the memory and is specifically used for executing the following operations:
collecting the first batch transaction in the N round of consensus suggestions of the block chain, wherein the N round of consensus suggestions comprises a plurality of batch transactions, and N is a positive integer.
Performing consensus operations on the first batch of transactions, and performing collection operations on second batches of transactions in batch order in parallel if the second batches of transactions exist, wherein the second batches of transactions propose batch transactions for the Nth round of consensus that have not completed collection.
And if all the batch transactions of the Nth round consensus suggestion are agreed, performing transaction execution operation on all the batch transactions of the Nth round consensus suggestion.
Sending the transaction execution results of all batch transactions of the Nth round of consensus proposal in the blockchain to perform transaction confirmation on all batch transactions of the Nth round of consensus proposal.
And after the transaction confirmation of all the batch transactions of the Nth round consensus suggestion is obtained, performing block writing operation on all the batch transactions of the Nth round consensus suggestion.
The processing method disclosed in the embodiment shown in fig. 1 or fig. 3 in this specification may be applied to a processor, or may 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 by 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 the present 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 embodiments of the present description may implement the functions of the embodiment shown in fig. 1 to 3 of the block link point shown in fig. 6, or the functions of the embodiment shown in fig. 4 and 5 of the block link point shown in fig. 7. Since the principle is the same, it is not described herein in detail.
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, the present specification embodiments also propose a computer-readable storage medium storing one or more programs, the one or more programs including instructions.
Optionally, the above instructions, when executed by a portable electronic device including a plurality of application programs, can cause the portable electronic device to perform the method of the embodiment shown in fig. 1, and are specifically configured to perform the following method:
collecting the first batch transaction in the N round of consensus suggestions of the block chain, wherein the N round of consensus suggestions comprises a plurality of batch transactions, and N is a positive integer.
Performing consensus operations on the first batch of transactions, and performing collection operations on second batches of transactions in batch order in parallel if the second batches of transactions exist, wherein the second batches of transactions propose batch transactions for the Nth round of consensus that have not completed collection.
Performing a transaction execution operation on the first batch of transactions, and if a third batch of transactions exists, executing the consensus operation on the third batch of transactions in batch order in parallel, wherein the third batch of transactions is a batch transaction of which the Nth round consensus proposal has been collected and not completed.
And sending a transaction execution result of the first batch of transactions in the blockchain to perform transaction confirmation on the first batch of transactions.
And after the transaction confirmation of all the batch transactions of the Nth round consensus suggestion is obtained, performing block writing operation on all the batch transactions of the Nth round consensus suggestion.
Optionally, the above instructions, when executed by a portable electronic device including a plurality of application programs, can enable the portable electronic device to execute the method of the embodiment shown in fig. 4, and are specifically configured to execute the following method:
collecting the first batch transaction in the N round of consensus suggestions of the block chain, wherein the N round of consensus suggestions comprises a plurality of batch transactions, and N is a positive integer.
Performing consensus operations on the first batch of transactions, and performing collection operations on second batches of transactions in batch order in parallel if the second batches of transactions exist, wherein the second batches of transactions propose batch transactions for the Nth round of consensus that have not completed collection.
And if all the batch transactions of the Nth round consensus suggestion are agreed, performing transaction execution operation on all the batch transactions of the Nth round consensus suggestion.
Sending the transaction execution results of all batch transactions of the Nth round of consensus proposal in the blockchain to perform transaction confirmation on all batch transactions of the Nth round of consensus proposal.
And after the transaction confirmation of all the batch transactions of the Nth round consensus suggestion is obtained, performing block writing operation on all the batch transactions of the Nth round consensus suggestion.
It will be appreciated that the above instructions, when executed by a portable electronic device comprising a plurality of applications, can cause the block link point shown in fig. 6 to implement the functionality of the embodiments shown in fig. 1-3, or can cause the block link point shown in fig. 7 to implement the functionality of the embodiments shown in fig. 4 and 5. Since the principle is the same, it is not described herein in detail.
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 has been directed to specific embodiments of this disclosure. 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 (18)

1. A processing method of blockchain transaction is applied to blockchain nodes and comprises the following steps:
collecting a first batch of transactions in an Nth round of consensus suggestions of a blockchain, wherein the Nth round of consensus suggestions comprises a plurality of batch transactions, and N is a positive integer;
performing consensus operations on the first batch transactions, and if a second batch of transactions exists, performing collection operations on the second batch of transactions in batch order in parallel, wherein the second batch of transactions proposes batch transactions for which collection is not completed for the Nth round of consensus;
performing a transaction execution operation on the first batch of transactions, and if a third batch of transactions exists, executing a consensus operation on the third batch of transactions in a batch order, wherein the third batch of transactions is a batch transaction of which the Nth round consensus proposal has been collected and has not completed consensus;
sending a transaction execution result of the first batch transaction in the blockchain to perform transaction confirmation on the first batch transaction;
and after the transaction confirmation of all the batch transactions of the Nth round consensus suggestion is obtained, performing block writing operation on all the batch transactions of the Nth round consensus suggestion.
2. The method of claim 1, further comprising:
and if all the batch transactions in the N round of consensus suggestions are collected when the consensus operation is performed on the first batch transactions, performing the collection operation on the batch transactions in the (N + 1) round of consensus suggestions in the batch order.
3. The method of claim 1, further comprising:
and if the second batch of transactions exist in the transaction execution operation of the first batch of transactions, executing the collection operation of the second batch of transactions in batch order in parallel.
4. The method of claim 1, further comprising:
and if all the batch transactions in the N round of consensus suggestions are collected when the transaction execution operation is performed on the first batch transactions, executing the collection operation of the batch transactions in the (N + 1) th round of consensus suggestions according to the batch sequence.
5. The method of claim 4, further comprising:
and if all the batch transactions in the N round of consensus propositions are known in common when the transaction execution operation is carried out on the first batch transactions, executing the consensus operation on the collected but not-yet-known batch transactions in the (N + 1) round of consensus propositions according to the sequence of batches.
6. The method of claim 1, further comprising:
and if all the batch transactions in the N round of consensus suggestions are collected when the first batch transactions are subjected to block writing operation, performing collection operation on the batch transactions in the (N + 1) th round of consensus suggestions according to the batch sequence.
7. The method of claim 1, further comprising:
and if all the batch transactions in the N round of consensus propositions are known in common when the block writing operation is carried out on the first batch transactions, executing the consensus operation on the collected but not-yet-known batch transactions in the (N + 1) round of consensus propositions in the sequence of batches.
8. The method of claim 1, further comprising:
sending a transaction execution result of the first batch transaction in the blockchain to perform transaction confirmation on the first batch transaction, including:
sending a transaction confirmation request of a transaction execution result of the first batch of transactions to other block chain nodes of the block chain;
and if transaction confirmation feedback sent by 2f other blockchain nodes is received, confirming to obtain transaction confirmation of the first batch of transactions, wherein f is the maximum number of the abnormal consensus nodes allowed by the blockchain.
9. The method of claim 1, further comprising:
after the transaction confirmation of the first batch transaction is obtained, the transaction execution result of the first batch transaction is fed back to the corresponding block chain client;
alternatively, the first and second electrodes may be,
after the transaction confirmation of all the batch transactions of the Nth round of consensus suggestion is obtained, the transaction execution results of all the batch transactions of the Nth round of consensus suggestion are fed back to the corresponding blockchain client.
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,
collecting all batch transactions in the N round of consensus offers through a first thread, wherein the first thread does not collect other batch transactions before collecting one batch transaction;
executing the consensus operation on all the batch transactions in the Nth round of consensus proposition through a second thread, wherein the second thread does not execute the consensus operation on other batch transactions before executing the consensus operation on one batch transaction;
executing execution operations of all batch transactions in the Nth round of consensus proposition through a third thread, wherein the third thread does not execute execution operations of other batch transactions before executing execution operations of one batch transaction;
performing, by a fourth thread, transaction confirmation for all batch transactions in the Nth round of consensus offers;
executing, by a fifth thread, a write block operation on all batch transactions in the Nth round consensus proposal;
wherein the first thread, the second thread, the third thread, the fourth thread, and the fifth thread are threads that are executed in parallel.
11. The method of claim 10, 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,
after the first thread collects the first batch of transactions, informing the second thread to carry out consensus operation on the first batch of transactions;
after the second thread executes the consensus operation of the first batch of transactions, informing the third thread to execute the execution operation of the first batch of transactions;
and after the third thread finishes executing the execution operation of the first batch of transactions, informing the fourth thread to carry out transaction confirmation on the first batch of transactions.
12. A processing method of blockchain transaction is applied to blockchain nodes and comprises the following steps:
collecting a first batch of transactions in an Nth round of consensus suggestions of a blockchain, wherein the Nth round of consensus suggestions comprises a plurality of batch transactions, and N is a positive integer;
performing consensus operations on the first batch transactions, and if a second batch of transactions exists, performing collection operations on the second batch of transactions in batch order in parallel, wherein the second batch of transactions proposes batch transactions for which collection is not completed for the Nth round of consensus;
if all the batch transactions of the Nth round of consensus proposition are completed consensus, performing transaction execution operation on all the batch transactions of the Nth round of consensus proposition;
sending the transaction execution results of all batch transactions of the Nth round of consensus proposal in the blockchain to perform transaction confirmation on all batch transactions of the Nth round of consensus proposal;
and after the transaction confirmation of all the batch transactions of the Nth round consensus suggestion is obtained, performing block writing operation on all the batch transactions of the Nth round consensus suggestion.
13. A block link point, comprising:
the first transaction collection module is used for collecting first batch transactions in an Nth round of consensus suggestions of the block chain, wherein the Nth round of consensus suggestions comprises a plurality of batch transactions, and N is a positive integer;
the first transaction consensus module executes consensus operation on the first batch of transactions, and if a second batch of transactions exists, the transaction collection module simultaneously and parallelly executes collection operation on the second batch of transactions according to batch sequence, wherein the second batch of transactions are batch transactions of which the Nth round consensus proposal is not completed;
the first transaction execution module performs transaction execution operation on the first batch of transactions, and if a third batch of transactions exists, the transaction consensus module simultaneously and parallelly executes consensus operation on the third batch of transactions according to the batch sequence, wherein the third batch of transactions are batch transactions of which the Nth round consensus offers are collected and not completed;
the first transaction confirmation module is used for sending a transaction execution result of the first batch of transactions in the block chain so as to perform transaction confirmation on the first batch of transactions;
and the first transaction block writing module is used for writing the block for all the batch transactions of the Nth round of consensus and suggestion after obtaining the transaction confirmation of all the batch transactions of the Nth round of consensus and suggestion.
14. 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:
collecting a first batch of transactions in an Nth round of consensus suggestions of a blockchain, wherein the Nth round of consensus suggestions comprises a plurality of batch transactions, and N is a positive integer;
performing consensus operations on the first batch transactions, and if a second batch of transactions exists, performing collection operations on the second batch of transactions in batch order in parallel, wherein the second batch of transactions proposes batch transactions for which collection is not completed for the Nth round of consensus;
performing a transaction execution operation on the first batch of transactions, and if a third batch of transactions exists, executing the consensus operation on the third batch of transactions in batch order in parallel, wherein the third batch of transactions is a batch transaction of which the Nth round consensus proposal has been collected and has not completed consensus;
sending a transaction execution result of the first batch transaction in the blockchain to perform transaction confirmation on the first batch transaction;
and after the transaction confirmation of all the batch transactions of the Nth round consensus suggestion is obtained, performing block writing operation on all the batch transactions of the Nth round consensus suggestion.
15. A computer-readable storage medium having a computer program stored thereon, which when executed by a processor, performs the steps of:
collecting a first batch of transactions in an Nth round of consensus suggestions of a blockchain, wherein the Nth round of consensus suggestions comprises a plurality of batch transactions, and N is a positive integer;
performing consensus operations on the first batch transactions, and if a second batch of transactions exists, performing collection operations on the second batch of transactions in batch order in parallel, wherein the second batch of transactions proposes batch transactions for which collection is not completed for the Nth round of consensus;
performing a transaction execution operation on the first batch of transactions, and if a third batch of transactions exists, executing the consensus operation on the third batch of transactions in batch order in parallel, wherein the third batch of transactions is a batch transaction of which the Nth round consensus proposal has been collected and has not completed consensus;
sending a transaction execution result of the first batch transaction in the blockchain to perform transaction confirmation on the first batch transaction;
and after the transaction confirmation of all the batch transactions of the Nth round consensus suggestion is obtained, performing block writing operation on all the batch transactions of the Nth round consensus suggestion.
16. A block link point, comprising:
the second transaction collection module is used for collecting first batch transactions in the N round of consensus suggestions of the block chain, wherein the N round of consensus suggestions comprise a plurality of batch transactions, and N is a positive integer;
the second transaction consensus module executes consensus operation on the first batch of transactions, and if a second batch of transactions exists, the transaction collection module simultaneously and parallelly executes collection operation on the second batch of transactions according to the batch sequence, wherein the second batch of transactions are batch transactions of which the Nth round consensus proposal is not completed;
the second transaction execution module is used for performing transaction execution operation on all the batch transactions of the Nth round of consensus suggestion if all the batch transactions of the Nth round of consensus suggestion complete consensus;
the second transaction confirmation module is used for sending the transaction execution result of the first batch of transactions in the block chain so as to carry out transaction confirmation on the first batch of transactions;
and the second transaction block writing module is used for writing the block of all the batch transactions of the N round of consensus and offer after obtaining the transaction confirmation of all the batch transactions of the N round of consensus and offer.
17. 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:
collecting a first batch of transactions in an Nth round of consensus suggestions of a blockchain, wherein the Nth round of consensus suggestions comprises a plurality of batch transactions, and N is a positive integer;
performing consensus operations on the first batch transactions, and if a second batch of transactions exists, performing collection operations on the second batch of transactions in batch order in parallel, wherein the second batch of transactions proposes batch transactions for which collection is not completed for the Nth round of consensus;
if all the batch transactions of the Nth round of consensus proposition are completed consensus, performing transaction execution operation on all the batch transactions of the Nth round of consensus proposition;
sending the transaction execution results of all batch transactions of the Nth round of consensus proposal in the blockchain to perform transaction confirmation on all batch transactions of the Nth round of consensus proposal;
and after the transaction confirmation of all the batch transactions of the Nth round consensus suggestion is obtained, performing block writing operation on all the batch transactions of the Nth round consensus suggestion.
18. A computer-readable storage medium having a computer program stored thereon, which when executed by a processor, performs the steps of:
collecting a first batch of transactions in an Nth round of consensus suggestions of a blockchain, wherein the Nth round of consensus suggestions comprises a plurality of batch transactions, and N is a positive integer;
performing consensus operations on the first batch transactions, and if a second batch of transactions exists, performing collection operations on the second batch of transactions in batch order in parallel, wherein the second batch of transactions proposes batch transactions for which collection is not completed for the Nth round of consensus;
if all the batch transactions of the Nth round of consensus proposition are completed consensus, performing transaction execution operation on all the batch transactions of the Nth round of consensus proposition;
sending the transaction execution results of all batch transactions of the Nth round of consensus proposal in the blockchain to perform transaction confirmation on all batch transactions of the Nth round of consensus proposal;
and after the transaction confirmation of all the batch transactions of the Nth round consensus suggestion is obtained, performing block writing operation on all the batch transactions of the Nth round consensus suggestion.
CN202210176770.6A 2022-02-24 2022-02-24 Processing method of block chain transaction, block chain node and electronic equipment Pending CN114529413A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202210176770.6A CN114529413A (en) 2022-02-24 2022-02-24 Processing method of block chain transaction, block chain node and electronic equipment
PCT/CN2022/135613 WO2023160092A1 (en) 2022-02-24 2022-11-30 Method for processing blockchain transactions, and blockchain node and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210176770.6A CN114529413A (en) 2022-02-24 2022-02-24 Processing method of block chain transaction, block chain node and electronic equipment

Publications (1)

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

Family

ID=81624334

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210176770.6A Pending CN114529413A (en) 2022-02-24 2022-02-24 Processing method of block chain transaction, block chain node and electronic equipment

Country Status (2)

Country Link
CN (1) CN114529413A (en)
WO (1) WO2023160092A1 (en)

Cited By (2)

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

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111221639A (en) * 2020-01-09 2020-06-02 杭州趣链科技有限公司 Block pipeline execution method of block chain platform
US11194555B2 (en) * 2020-04-13 2021-12-07 International Business Machines Corporation Optimization of execution of smart contracts
CN112887436B (en) * 2021-04-28 2021-08-03 支付宝(杭州)信息技术有限公司 Consensus method, consensus node and block chain system of pipeline mode
CN114547201A (en) * 2022-02-24 2022-05-27 蚂蚁区块链科技(上海)有限公司 Processing method of block chain transaction, block chain node and electronic equipment
CN114529413A (en) * 2022-02-24 2022-05-24 蚂蚁区块链科技(上海)有限公司 Processing method of block chain transaction, block chain node and electronic equipment

Cited By (2)

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

Also Published As

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

Similar Documents

Publication Publication Date Title
CN107528882B (en) Method and device for processing consensus request in block chain consensus network and electronic equipment
CN114529413A (en) Processing method of block chain transaction, block chain node and electronic equipment
CN111522800B (en) Block chain consensus method, node and system of badger Byzantine fault-tolerant consensus mechanism
CN114547201A (en) Processing method of block chain transaction, block chain node and electronic equipment
CN110659988A (en) Parallel processing method and device for block chain consensus and execution and electronic equipment
TWI687875B (en) Distributed transaction processing method and device
CN111399911B (en) Artificial intelligence development method and device based on multi-core heterogeneous computation
CN115168013A (en) Task running system and method and computing device
CN112465515B (en) Block chain consensus method, consensus node and electronic equipment
CN111522648B (en) Transaction processing method and device for block chain and electronic equipment
CN111522696A (en) Downtime processing method, data persistence method and hardware of block chain common identification node
CN115695330B (en) Scheduling system, method, terminal and storage medium for shreds in embedded system
CN111782378A (en) Adaptive processing performance adjusting method, server and readable storage medium
CN111880916A (en) Multi-drawing task processing method, device, terminal, medium and host in GPU
CN111913816A (en) Implementation method, device, terminal and medium for clusters in GPGPU (general purpose graphics processing unit)
CN115543254A (en) Sorting circuit, sorting method and electronic equipment
CN114529414A (en) Transaction processing method of block chain, block chain node and electronic equipment
CN112783922B (en) Query method and device based on relational database
CN112118012A (en) Method and device for determining iteration times of decoder
CN113360189B (en) Asynchronous optimization method, system, device and readable medium suitable for stream processing
CN109903048B (en) Block output method, consensus method and device
CN110221914B (en) File processing method and device
CN116594565A (en) File copying method and device and electronic equipment
CN118012588A (en) Multithreading management method based on task arrangement and related equipment thereof
CN114357079A (en) Data processing method, node equipment, system and platform based on block chain

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