CN113204432B - Transaction processing method and device in blockchain and electronic equipment - Google Patents

Transaction processing method and device in blockchain and electronic equipment Download PDF

Info

Publication number
CN113204432B
CN113204432B CN202110692124.0A CN202110692124A CN113204432B CN 113204432 B CN113204432 B CN 113204432B CN 202110692124 A CN202110692124 A CN 202110692124A CN 113204432 B CN113204432 B CN 113204432B
Authority
CN
China
Prior art keywords
block
transaction
consensus
blockchain
nth
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.)
Active
Application number
CN202110692124.0A
Other languages
Chinese (zh)
Other versions
CN113204432A (en
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.)
Alipay Hangzhou Information Technology Co Ltd
Ant Blockchain Technology Shanghai Co Ltd
Original Assignee
Alipay Hangzhou Information Technology Co Ltd
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 Alipay Hangzhou Information Technology Co Ltd, Ant Blockchain Technology Shanghai Co Ltd filed Critical Alipay Hangzhou Information Technology Co Ltd
Priority to CN202110692124.0A priority Critical patent/CN113204432B/en
Publication of CN113204432A publication Critical patent/CN113204432A/en
Application granted granted Critical
Publication of CN113204432B publication Critical patent/CN113204432B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5061Partitioning or combining of resources
    • 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
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/5011Pool
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/5018Thread allocation

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Business, Economics & Management (AREA)
  • General Engineering & Computer Science (AREA)
  • Accounting & Taxation (AREA)
  • Finance (AREA)
  • Development Economics (AREA)
  • General Business, Economics & Management (AREA)
  • Technology Law (AREA)
  • Strategic Management (AREA)
  • Marketing (AREA)
  • Economics (AREA)
  • Retry When Errors Occur (AREA)
  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)
  • Debugging And Monitoring (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The embodiment of the specification discloses a transaction processing method, a transaction processing device and electronic equipment in a blockchain. The method comprises the following steps: executing a transaction execution operation corresponding to an Nth block by the block chain node, wherein the transaction corresponding to the Nth block has reached consensus in a block chain system; and in the process of executing the transaction execution operation corresponding to the Nth block by the block chain node, executing the consensus operation of the transaction corresponding to the (n+1) th block in parallel.

Description

Transaction processing method and device in blockchain and electronic equipment
The application relates to a patent application with the application number of 202110146211.6, the application date of 2021, 02 month and 03 days and the name of transaction processing method, device and electronic equipment in a blockchain.
Technical Field
The present disclosure relates to the field of blockchain technologies, and in particular, to a method and an apparatus for processing transactions in a blockchain, and an electronic device.
Background
In some blockchain systems, the flow of transaction processing may be as shown in fig. 1, including the following four phases: collecting transactions, consensus, executing transactions, writing blocks. Through the above process, one block can be generated. After one block (e.g., block N in fig. 1) is generated, the transaction process proceeds to the next block (e.g., block n+1 in fig. 1).
As previously described, the transaction processing flow for a block in a blockchain includes four phases. After the nth block is generated, a transaction processing flow of the n+1th block is entered. In such a transaction processing manner, at any point in time, the consensus node can process only one phase corresponding to one block. This approach does not make good use of the processing resources of the nodes, such as the parallel computing characteristics of the cores, nor is the performance of the blockchain system improved.
FIG. 1 illustrates a general process by which a consensus node in a blockchain system processes transactions. In some blockchain systems, not all consensus nodes perform the transaction collection operations in the four phases described above. For example, in some blockchain systems employing a primary consensus algorithm (e.g., PRACTICAL BYZANTINE FAULT TOLERANCE, PBFT, a practical bayer fault-tolerant algorithm), a consensus primary node may perform the four-phase operation described above, and a consensus non-primary node may perform the three-phase operation of consensus- > transaction execution- > block writing; or each consensus node performs all the operations of the four phases. In other blockchain systems employing non-master consensus algorithms (e.g., honey Badger Byzantine Fault Tolerant, HBBFT, meles bezels fault tolerance algorithm), the consensus nodes do not distinguish between master nodes or non-master nodes, and each can perform all of the four phases of operations described above.
The Chinese patent with the application publication number of CN111522648A discloses a transaction processing method, wherein a block chain point executes a writing block operation of an Nth round of transaction and a consensus execution operation of an (n+1) th round of transaction in parallel. A representative embodiment may be as shown in fig. 2 (also fig. 2 of the patent application publication No. CN111522648 a). As shown in fig. 2, the first thread and the second thread may execute in parallel, and in the process of N rounds of consensus and transaction execution by the first thread, the second thread may perform N-1 th round of writing block operation in parallel; in the process of carrying out N+1 rounds of consensus and transaction execution by the first thread, the second thread can carry out the writing block operation of the Nth round of transaction in parallel; in the process of carrying out N+2 rounds of consensus and transaction execution by the first thread, the second thread can carry out the writing block operation of the N+1 round of transaction in parallel. The above examples are mainly directed to the situation that in the blockchain transaction processing process, the occupation time of the consensus stage and the transaction execution stage is relatively short, and the occupation time of the block writing stage is relatively long. Thus, the coupling relationship of the consensus operation and the transaction execution operation in the same round is maintained, and the write block operation of the round is decoupled, so that two different threads can be adopted to respectively execute (consensus+transaction execution) and write block. In this way, in the process of executing the writing block operation of the previous block, the (consensus+transaction execution) operation of the next block can be executed in parallel, and the method is particularly suitable for processing by adopting a computer with a multi-core CPU, so that the transaction processing efficiency can be improved, and the blockchain system can be suitable for application scenes with high concurrency of business.
In fact, the transactions collected in a certain round may include ordinary transfer transactions, and may also include transactions involving smart contracts. For ordinary transfer transactions, the processing time is generally relatively short, while for transactions involving smart contracts, contract logic may be complex or transactions involving contracts may be more, so there may be cases where the processing time is relatively long. Thus, for a transaction involving a large number of smart contracts, or for a smart contract involving complex logic, the transaction execution link may be processed more often than the consensus link, more closely to the processing time of the write block operation, or even more often than the processing time of the write block operation. Thus, there is still room for further optimization in this example where only (consensus + transaction execution) and write blocks are decoupled.
Disclosure of Invention
The embodiment of the specification provides a transaction processing method, a transaction processing device and electronic equipment in a blockchain.
A method of transaction processing in a blockchain, comprising:
Executing a transaction execution operation corresponding to an Nth block by the block chain node, wherein the transaction corresponding to the Nth block has reached consensus in a block chain system;
and in the process of executing the transaction execution operation corresponding to the Nth block by the block chain node, executing the consensus operation of the transaction corresponding to the (n+1) th block in parallel, wherein N is a positive integer.
A transaction processing device for use in a blockchain node, comprising:
The transaction execution module is used for executing transaction execution operation corresponding to an Nth block, wherein the transaction corresponding to the Nth block has reached consensus in a block chain system;
And the consensus module is used for executing the consensus operation of the transaction corresponding to the (N+1) th block in parallel in the process of executing the transaction execution operation corresponding to the (N) th block by the transaction execution module.
An electronic device, comprising:
A processor; and
A memory arranged to store computer executable instructions that, when executed, cause the processor to:
Executing a transaction execution operation corresponding to an nth block, wherein the transaction corresponding to the nth block has been agreed in a blockchain system;
and in the process of executing the transaction execution operation corresponding to the Nth block, executing the consensus operation of the transaction corresponding to the (N+1) th block in parallel, wherein N is a positive integer.
By adopting the transaction processing method provided by the embodiment of the specification, when the transaction in the blockchain is processed, the blockchain node can process different stages of the transaction corresponding to different blocks in parallel, so that the computing capacity of the multi-core CPU is utilized, the operation efficiency of the blockchain system is greatly improved, and the performance is improved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the specification, illustrate and explain the exemplary embodiments of the present specification and their description, are not intended to limit the specification unduly. In the drawings:
FIG. 1 is a schematic diagram of a prior art process for processing transactions in a blockchain system;
FIG. 2 is a process diagram of a transaction processing method according to the prior art;
FIG. 3 is a flow chart illustrating an implementation of a transaction processing method in a blockchain according to an embodiment of the present disclosure;
FIG. 4 is a schematic diagram of one embodiment of a transaction processing method in a blockchain provided in one embodiment of the present disclosure;
Fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure;
Fig. 6 is a schematic structural diagram of a transaction processing device according to an embodiment of the present disclosure.
Detailed Description
For the purposes, technical solutions and advantages of this document, the technical solutions of this specification will be clearly and completely described below with reference to specific embodiments of this specification and corresponding drawings. It will be apparent that the embodiments described are only some, but not all, of the embodiments of this document. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are intended to be within the scope of the present disclosure.
The following describes in detail the technical solutions provided by the embodiments of the present specification with reference to the accompanying drawings.
One or more embodiments of the present disclosure provide a transaction processing method in a blockchain, where an implementation flow chart is shown in fig. 3, including:
In step 310, the blockchain node performs a transaction execution operation corresponding to the nth block.
The transaction corresponding to the nth block may be a transaction that has been agreed upon in the blockchain system. Further, in step 310, the blockchain node may execute the transaction corresponding to the nth block that has reached the consensus.
The transaction execution operations described above may be handled by a transaction execution thread in a blockchain node. The consensus operations described above may be handled by consensus threads in blockchain nodes.
As described in the background, transaction processing in a blockchain typically includes four distinct operations, collecting transactions, transaction consensus, transaction execution, and writing blocks. It is mentioned that each consensus node may perform all the operations of the four phases, or some consensus nodes may perform the operations of the last three phases, but not the operations of collecting transactions. Thus, for a consensus node executing a collection transaction, this operation may also be performed by a separate thread in the consensus node, e.g., referred to as a transaction collection thread. Specifically, as shown in fig. 4, before executing the transaction execution operation corresponding to the nth block, the consensus node may query, through the transaction collection thread, whether the transaction collected in the transaction memory pool meets the preset transaction collection condition. And if the preset transaction collection condition is met, the consensus node packages the transaction collected by the transaction memory pool through the transaction collection thread. In this way the consensus node can get a proposal to be consensus. Further, the consensus node may perform the operation of the consensus phase through a consensus thread.
Specifically, when the consensus node is a consensus master node in the blockchain system with the master consensus algorithm or when the consensus node is a consensus node in the blockchain system without the master consensus algorithm, the consensus thread can acquire the transaction corresponding to the nth block from the transaction collecting thread. Further, a consensus proposal may be initiated based on the transaction to perform a consensus phase operation, such as by a consensus thread in the blockchain node.
In addition, when the consensus node is a consensus non-master node in the block chain system adopting the master consensus algorithm, the block link point responds to the consensus proposal of the transaction corresponding to the Nth block sent by other consensus nodes, and performs the consensus operation based on the consensus proposal. The consensus operation may be performed, for example, by a consensus thread in the blockchain node. In this case, since the consensus node is responsive to the transmitted consensus proposal, the transmitted consensus proposal may include a transaction to be consensus, and thus the consensus node may not perform the operation of collecting the transaction.
Since the consensus thread needs to acquire the transaction corresponding to the nth block from the collecting transaction thread, the sequence of collecting transaction- & gt consensus can be maintained for the processing flow of the transaction corresponding to the same block.
After the blockchain node completes the consensus operation for the transaction corresponding to the nth block, the executing operation for the transaction corresponding to the nth block in step 310 may be performed. The transaction execution operations may be performed, for example, by a transaction execution thread in the blockchain node.
Similarly, after the consensus thread performs the consensus operation of the transaction corresponding to the nth block, the consensus result is transferred to the transaction execution thread of the block chain node, so that the sequence of consensus-transaction execution can be maintained for the processing flow of the transaction corresponding to the same block.
In step 320, the blockchain node performs the consensus operation for the transaction corresponding to the n+1th block in parallel during the transaction performing operation corresponding to the nth block.
Similarly, the consensus node may query, via the transaction collection thread, whether the transaction collected in the transaction memory pool has met a predetermined transaction collection condition before performing a consensus operation on the n+1st block corresponding transaction. If the preset transaction collection condition is met, the consensus node packages the transaction collected by the transaction memory pool through the transaction collection thread, so that the transaction corresponding to the (n+1) th block is formed. In this way, the node can get a proposal to be consensus. Further, the consensus node may perform the consensus phase operation through the consensus thread, that is, the performing in step 320 performs the consensus operation on the n+1st block corresponding transaction.
Specifically, when the consensus node is a consensus master node in the blockchain system with the master consensus algorithm or when the consensus node is a consensus node in the blockchain system without the master consensus algorithm, the consensus thread can acquire the transaction corresponding to the n+1st block from the transaction collecting thread. Further, a consensus proposal may be initiated based on the transaction, thereby entering into operation of a consensus phase, such as may be performed by a consensus thread in a blockchain node.
In addition, when the consensus node is a consensus non-master node in the blockchain system adopting the master consensus algorithm, the blockchain link point responds to the consensus proposal of the transaction corresponding to the (n+1) th block sent by other consensus nodes, and performs the consensus operation based on the consensus proposal, for example, the consensus thread in the blockchain node can perform the consensus operation. In this case, since the consensus node is responsive to the transmitted consensus proposal, the transmitted consensus proposal may include a transaction to be consensus, and thus the consensus node may not perform the operation of collecting the transaction.
Since the consensus thread needs to acquire the transaction corresponding to the n+1st block from the collection transaction thread, the order of collection transaction→consensus can be maintained for the processing flow of the transaction corresponding to the same block.
If the blockchain node performs a process of collecting transactions corresponding to the nth block and performs a process of collecting transactions corresponding to the n+1th block, the blockchain node collects transactions corresponding to the n+1th block followed by collecting transactions corresponding to the n+1th block. This is particularly true where the blockchain node has only one collection transaction thread assigned. Moreover, the blockchain node performs the operation of collecting the n+1th blockcorresponding transaction in parallel in the course of consensus on the nth proposal.
The block chain node may perform the consensus operation for the transaction corresponding to the n+1th block after the consensus operation for the transaction corresponding to the N-th block is achieved. This is particularly true where the blockchain node has only one consensus thread assigned.
It should be noted that, the consensus proposal of the nth block and the consensus proposal of the n+1th block may be initiated by the same consensus node or may be initiated by different consensus nodes. For example, the blockchain node may have a consensus operation for the nth block initiated by the blockchain node as a consensus master node, and a consensus operation for the n+1th block may have another blockchain node initiated by the consensus master node, and vice versa.
After the block chain node completes the consensus operation on the transaction corresponding to the n+1th block, the transaction execution operation on the transaction corresponding to the n+1th block can be performed. The transaction execution operations may be performed, for example, by a transaction execution thread in the blockchain node.
Similarly, after the consensus thread performs the consensus operation of the n+1th block corresponding transaction, the consensus result is transferred to the transaction execution thread of the block chain node, so that the sequence of consensus-transaction execution can be maintained for the processing flow of the same block corresponding transaction.
As shown in fig. 4, after the block link point completes the transaction execution operation corresponding to the nth block, the block chain node may also write the result of the transaction execution into the nth block of the block chain ledger, i.e. write the block operation. Similarly, in the process of executing the write block operation corresponding to the nth block, the block chain node executes the transaction execution operation corresponding to the (n+1) th block in parallel.
The blockchain node performs operations on transactions corresponding to the n+1th block, which may be performed after performing operations on transactions corresponding to the N-th block. This is particularly true where the blockchain node has only one transaction execution thread assigned.
As shown in fig. 4, after the block link point completes the execution operation on the transaction corresponding to the n+1th block, the blockchain node may also write the result of the transaction execution into the n+1th block of the blockchain ledger. Similarly, a write block operation for the n+1th block by a blockchain node may be performed after a write block operation for the N-th block. This is particularly true where the blockchain node has only one write block thread assigned.
When the block chain node performs the collection transaction operation corresponding to the n+1th block, the consensus operation of the N-th block may not be completed yet, and thus the consensus operation of the n+1th block cannot be started yet. At this time, the blockchain node may store the collected transaction corresponding to the n+1th block in the memory, and after the corresponding consensus operation of the N-th block is completed, extract the transaction corresponding to the n+1th block from the memory, and start the consensus operation for the transaction corresponding to the n+1th block.
Similarly, when the block chain node performs the consensus operation corresponding to the n+1th block, the transaction performing operation of the N-th block may not be completed yet, and thus the transaction performing operation of the n+1th block cannot be started yet. At this time, the blockchain node may store the consensus result corresponding to the n+1th block in the memory, and after the transaction execution operation corresponding to the n+1th block is completed, extract the consensus result corresponding to the n+1th block from the memory, and start executing the transaction execution operation corresponding to the n+1th block.
Similarly, when the transaction execution operation corresponding to the n+1th block is completed by the blockchain node, the writing block operation of the N-th block may not be completed yet, and thus the writing block operation of the n+1th block cannot be started yet. At this time, the blockchain node may store the transaction execution result corresponding to the n+1th block in the memory, and after the corresponding write block operation of the N-th block is completed, extract the transaction execution result corresponding to the n+1th block from the memory, and start executing the write block operation corresponding to the n+1th block.
By adopting the transaction processing method provided by the embodiment of the specification, when the transaction in the blockchain is processed, the blockchain node can process different stages of the corresponding transaction of different blocks in parallel, so that the computing capacity of the multi-core CPU is utilized, the operation efficiency of the blockchain system is greatly improved, and the performance is improved.
Fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure. Referring to fig. 5, at the hardware level, the electronic device includes a processor, and optionally 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 (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, network interface, and memory may be interconnected by an internal bus, which may be an ISA (Industry Standard Architecture ) bus, a PCI (PERIPHERAL COMPONENT INTERCONNECT, peripheral component interconnect standard) bus, or EISA (Extended Industry Standard Architecture ) bus, among others. The buses may be classified as address buses, data buses, control buses, etc. For ease of illustration, only one bi-directional arrow is shown in FIG. 5, but not only one bus or type of bus.
And the memory is used for storing programs. In particular, the program may include program code including computer-operating instructions. The memory may include memory and non-volatile storage and provide instructions and data to the processor.
The processor reads the corresponding computer program from the nonvolatile memory into the memory and then runs to form the transaction processing device on a logic level. The processor is used for executing the programs stored in the memory and is specifically used for executing the following operations:
Executing a transaction execution operation corresponding to an nth block, wherein the transaction corresponding to the nth block has been agreed in a blockchain system;
and in the process of executing the transaction execution operation corresponding to the Nth block, executing the consensus operation of the transaction corresponding to the (N+1) th block in parallel, wherein N is a positive integer.
Based on the electronic device shown in fig. 5, it can be known that when the scheme of the embodiment of the present disclosure processes transactions in a blockchain, the blockchain node can process different stages of transactions corresponding to different blocks in parallel, so that the computing capability of the multi-core CPU is utilized, the operation efficiency of the blockchain system is greatly improved, and the performance is improved.
The transaction processing method in the blockchain disclosed in the embodiments shown in fig. 3 to 4 of the present specification can be applied to a processor or 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 (Central Processing Unit, CPU), a network processor (Network Processor, NP), etc.; but may also be a digital signal Processor (DIGITAL SIGNAL Processor, DSP), application SPECIFIC INTEGRATED Circuit (ASIC), field-Programmable gate array (Field-Programmable GATE ARRAY, FPGA) or other Programmable logic device, discrete gate or transistor logic device, discrete hardware components. The various methods, steps, and logic blocks disclosed in one or more embodiments of the present description 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 one or more embodiments of the present disclosure may be embodied directly in a hardware decoding processor or in a combination of hardware and software modules in a decoding processor. The software modules may be located in a random access memory, flash memory, read only memory, programmable read only memory, or electrically erasable programmable memory, registers, etc. as well known in the art. The storage medium is located in a memory, and the processor reads the information in the memory and, in combination with its hardware, performs the steps of the above method.
The electronic device may also execute the transaction processing method in the blockchain of fig. 3 to 4, and this description will not be repeated here.
Of course, in addition to the software implementation, the electronic device in this specification does not exclude other implementations, such as a logic device or a combination of software and hardware, that is, the execution subject of the following process is not limited to each logic unit, but may also be hardware or a logic device.
The present description also proposes a computer-readable storage medium storing one or more programs, the one or more programs comprising instructions, which when executed by a portable electronic device comprising a plurality of application programs, enable the portable electronic device to perform the method of the embodiments shown in fig. 3-4, and in particular to perform the operations of:
Executing a transaction execution operation corresponding to an nth block, wherein the transaction corresponding to the nth block has been agreed in a blockchain system;
and in the process of executing the transaction execution operation corresponding to the Nth block, executing the consensus operation of the transaction corresponding to the (N+1) th block in parallel, wherein N is a positive integer.
Fig. 6 is a schematic structural diagram of a transaction processing device 600 according to an embodiment of the present disclosure. In particular applications, the transaction processing device 600 may be a blockchain node, or alternatively, the transaction processing device may be deployed on a blockchain node. Referring to fig. 6, in one embodiment, a transaction processing device 600 includes:
A transaction execution module 603, configured to execute a transaction execution operation corresponding to an nth block, where the transaction corresponding to the nth block has been agreed in the blockchain system;
The consensus module 602 performs the consensus operation on the transaction corresponding to the n+1th block in parallel in the process that the transaction execution module performs the transaction execution operation corresponding to the N-th block.
Optionally, before the transaction execution module 603 performs the transaction execution operation of the nth block, the consensus module 602 further performs consensus on the transaction corresponding to the nth block in the blockchain system.
Optionally, the transaction processing device 600 further includes a transaction collection module 601, where the transaction collection module 601 collects the transaction corresponding to the nth block before the consensus module 602 performs consensus on the transaction corresponding to the nth block in the blockchain system.
Optionally, the transaction processing apparatus 600 further includes a writing block module 604, where after the transaction execution module 603 completes the execution operation on the transaction corresponding to the nth block, the writing block module 604 writes the result of the transaction execution into the nth block of the blockchain ledger.
Optionally, the consensus module 602 performs a consensus operation for the transaction corresponding to the n+1th block after consensus is reached for the transaction corresponding to the nth block.
Optionally, the consensus module 602 performs the operation of collecting the transaction corresponding to the n+1th block in parallel in the process of consensus the transaction corresponding to the nth block.
Optionally, the transaction collection module 601 performs the operation of collecting the n+1th block corresponding transaction after collecting the N-th block corresponding transaction.
Optionally, during the execution of the write block operation corresponding to the nth block by the write block module 604, the transaction execution module 603 performs the transaction execution operation corresponding to the n+1th block in parallel.
Optionally, the transaction execution module 603 performs the transaction execution operation corresponding to the n+1th block after performing the transaction execution operation corresponding to the nth block.
Optionally, after the transaction execution module 603 completes the transaction execution operation corresponding to the n+1th block, the writing module 604 writes the result of the transaction execution into the n+1th block of the blockchain ledger.
Optionally, the writing block module 604 performs a writing block operation corresponding to the n+1th block after the writing block operation corresponding to the N-th block.
Optionally, if the transaction collecting module 601 has not completed the process of the consensus corresponding to the nth block after the operation of collecting the transaction corresponding to the n+1th block is completed, the transaction collecting module further stores the collected transaction corresponding to the n+1th block into the memory.
Optionally, if the consensus module 602 finishes the consensus operation corresponding to the n+1th block, the transaction execution module 603 does not finish the transaction execution process corresponding to the n+1th block, and the consensus module further stores the consensus result of the n+1th block into the memory.
Optionally, if the transaction execution module 603 ends the transaction execution operation corresponding to the n+1th block, the block writing process of the writing module 604 corresponding to the N-th block is not yet ended, and the transaction execution module further stores the transaction execution result corresponding to the n+1th block into the memory.
Based on the transaction processing device 600 shown in fig. 6, it can be known that when the scheme of the embodiment of the present disclosure processes transactions in a blockchain, the blockchain node deploying the transaction processing device 600 can use the computing capability of the multi-core CPU to process different stages of transactions corresponding to different blocks in parallel, so that the operation efficiency and performance of the blockchain system are greatly improved.
In summary, the foregoing description is only a preferred embodiment of the present invention and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, improvement, or the like, which is within the spirit and principles of one or more embodiments of the present disclosure, is intended to be included within the scope of one or more embodiments of the present disclosure.
The system, apparatus, module or unit set forth in the above embodiments may be implemented in particular by a computer chip or entity, or by a product having a certain function. One typical implementation is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
Computer readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. Computer-readable media, as defined herein, does not include transitory computer-readable media (transmission media), such as modulated data signals and carrier waves.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article or apparatus that comprises the element.
In this specification, each embodiment is described in a progressive manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for system embodiments, since they are substantially similar to method embodiments, the description is relatively simple, as relevant to see a section of the description of method embodiments.

Claims (15)

1. A method of transaction processing in a blockchain, comprising:
Executing a transaction execution operation corresponding to an Nth block by the block chain node, wherein the transaction corresponding to the Nth block has reached consensus in a block chain system;
In the process of executing the transaction execution operation corresponding to the Nth block, the block chain node parallelly executes the consensus operation of the transaction corresponding to the (n+1) th block, wherein N is a positive integer; the consensus operation for the transaction corresponding to the (N+1) th block is executed after consensus is achieved for the transaction corresponding to the (N) th block.
2. The method of claim 1, wherein prior to the blockchain node performing the transaction execution operation for the nth block, the method further comprises:
The blockchain node performs consensus on the transaction corresponding to the Nth block in a blockchain system.
3. The method of claim 2, the blockchain node having prior to consensus in a blockchain system for a transaction corresponding to the nth block, the method further comprising:
and the blockchain node collects the transaction corresponding to the Nth block.
4. The method of claim 1, wherein after the block link point completes performing an operation on the transaction corresponding to the nth block, the method further comprises:
the block link writes the result of the transaction execution into the nth block of the blockchain ledger.
5. The method of claim 2, the method further comprising:
And the blockchain node performs the operation of collecting the transaction corresponding to the (n+1) th block in parallel in the process of consensus the transaction corresponding to the (N) th block.
6. The method of claim 5, wherein the blockchain node performs the operation of collecting the n+1th blockcorrespondence transaction after performing the operation of collecting the N-th blockcorrespondence transaction.
7. The method of claim 6, wherein the blockchain node performs the transaction execution operation corresponding to the n+1th block in parallel with the execution of the write block operation corresponding to the nth block.
8. The method of claim 7, wherein the blockchain node performs operations on transactions corresponding to the n+1th block, after performing operations on transactions corresponding to the N-th block.
9. The method of claim 7, wherein after the block link point completes performing an operation on the transaction corresponding to the n+1th block, the method further comprises:
The blockchain link writes the result of the transaction execution into the n+1th block of the blockchain ledger.
10. The method of claim 9, wherein the blockchain node performs a write block operation for the n+1th block after the write block operation for the N-th block.
11. The method of claim 5, further comprising, if the blockchain node has not ended after performing the operation of collecting n+1th blockcorresponds transactions, the process of consensus for the nth blockcorresponds to:
the block link point stores the collected transaction corresponding to the (n+1) th block into a memory.
12. The method of claim 7, further comprising, if the blockchain node has not completed executing the transaction corresponding to the nth block after executing the consensus operation corresponding to the n+1th block has completed:
And the block link point stores the consensus result corresponding to the (n+1) th block into a memory.
13. The method of claim 9, further comprising, if the blockchain node has not ended writing to the corresponding N-th block after executing the transaction execution operation corresponding to the n+1-th block has ended:
The block link point stores the transaction execution result corresponding to the (n+1) th block into the memory.
14. A transaction processing device for use in a blockchain node, comprising:
The transaction execution module is used for executing transaction execution operation corresponding to an Nth block, wherein the transaction corresponding to the Nth block has reached consensus in a block chain system;
The consensus module is used for executing consensus operation of the transaction corresponding to the (N+1) th block in parallel in the process of executing the transaction execution operation corresponding to the (N) th block by the transaction execution module; the consensus operation for the transaction corresponding to the (N+1) th block is executed after consensus is achieved for the transaction corresponding to the (N) th block.
15. An electronic device, comprising:
A processor; and
A memory arranged to store computer executable instructions that, when executed, cause the processor to:
Executing a transaction execution operation corresponding to an nth block, wherein the transaction corresponding to the nth block has been agreed in a blockchain system;
In the process of executing the transaction execution operation corresponding to the Nth block, executing the consensus operation of the transaction corresponding to the (N+1) th block in parallel, wherein N is a positive integer; the consensus operation for the transaction corresponding to the (N+1) th block is executed after consensus is achieved for the transaction corresponding to the (N) th block.
CN202110692124.0A 2021-02-03 2021-02-03 Transaction processing method and device in blockchain and electronic equipment Active CN113204432B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110692124.0A CN113204432B (en) 2021-02-03 2021-02-03 Transaction processing method and device in blockchain and electronic equipment

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110692124.0A CN113204432B (en) 2021-02-03 2021-02-03 Transaction processing method and device in blockchain and electronic equipment
CN202110146211.6A CN112506671B (en) 2021-02-03 2021-02-03 Transaction processing method and device in block chain and electronic equipment

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
CN202110146211.6A Division CN112506671B (en) 2021-02-03 2021-02-03 Transaction processing method and device in block chain and electronic equipment

Publications (2)

Publication Number Publication Date
CN113204432A CN113204432A (en) 2021-08-03
CN113204432B true CN113204432B (en) 2024-08-16

Family

ID=74952910

Family Applications (2)

Application Number Title Priority Date Filing Date
CN202110146211.6A Active CN112506671B (en) 2021-02-03 2021-02-03 Transaction processing method and device in block chain and electronic equipment
CN202110692124.0A Active CN113204432B (en) 2021-02-03 2021-02-03 Transaction processing method and device in blockchain and electronic equipment

Family Applications Before (1)

Application Number Title Priority Date Filing Date
CN202110146211.6A Active CN112506671B (en) 2021-02-03 2021-02-03 Transaction processing method and device in block chain and electronic equipment

Country Status (2)

Country Link
CN (2) CN112506671B (en)
WO (1) WO2022166673A1 (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112506671B (en) * 2021-02-03 2021-05-07 支付宝(杭州)信息技术有限公司 Transaction processing method and device in block chain and electronic equipment
CN112884588B (en) * 2021-04-30 2021-08-03 支付宝(杭州)信息技术有限公司 Block chain transaction execution method, block chain node and control device
CN113630257B (en) * 2021-10-09 2022-01-04 支付宝(杭州)信息技术有限公司 Consensus method, block chain system and consensus node
CN113761071B (en) * 2021-10-09 2023-07-11 支付宝(杭州)信息技术有限公司 Consensus method, block chain system and consensus node
CN113744063B (en) * 2021-11-04 2022-02-08 支付宝(杭州)信息技术有限公司 Method and device for executing transaction in block chain

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1804908A (en) * 2006-01-18 2006-07-19 成都前锋电子电器集团股份有限公司 Data storage system for tax controlled cash register
KR20190009958A (en) * 2017-07-20 2019-01-30 주식회사 더블체인 Extendable block chain system and block chain extending method

Family Cites Families (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107402824B (en) * 2017-05-31 2020-06-02 创新先进技术有限公司 Data processing method and device
CN107528882B (en) * 2017-07-14 2020-12-25 创新先进技术有限公司 Method and device for processing consensus request in block chain consensus network and electronic equipment
CN107688999B (en) * 2017-08-11 2020-11-13 杭州溪塔科技有限公司 Block chain-based parallel transaction execution method
CN109213790B (en) * 2018-08-10 2021-04-20 南京一目智能科技有限公司 Block chain-based data circulation analysis method and system
CN110020859B (en) * 2019-03-28 2022-03-11 杭州秘猿科技有限公司 Parallel execution block chain consensus method and device and electronic equipment
EP3767514A1 (en) * 2019-06-26 2021-01-20 Indian Institute of Technology Bombay Method for scaling computation in blockchain by delaying transaction execution
CN110517141B (en) * 2019-08-27 2023-06-13 深圳前海微众银行股份有限公司 Consensus method and device based on block chain system
CN110648136B (en) * 2019-09-10 2022-06-03 杭州秘猿科技有限公司 Consensus and transaction synchronous parallel processing method and device and electronic equipment
CN110659988B (en) * 2019-09-10 2022-11-18 杭州秘猿科技有限公司 Parallel processing method and device for block chain consensus and execution and electronic equipment
CN110728578A (en) * 2019-09-29 2020-01-24 南京金宁汇科技有限公司 Parallel execution method, system and storage medium for block chain transaction
CN111475501B (en) * 2020-06-24 2020-10-30 支付宝(杭州)信息技术有限公司 Data cleaning method and device for block chain network
CN111522648B (en) * 2020-07-03 2020-10-09 支付宝(杭州)信息技术有限公司 Transaction processing method and device for block chain and electronic equipment
CN112506671B (en) * 2021-02-03 2021-05-07 支付宝(杭州)信息技术有限公司 Transaction processing method and device in block chain and electronic equipment

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1804908A (en) * 2006-01-18 2006-07-19 成都前锋电子电器集团股份有限公司 Data storage system for tax controlled cash register
KR20190009958A (en) * 2017-07-20 2019-01-30 주식회사 더블체인 Extendable block chain system and block chain extending method

Also Published As

Publication number Publication date
CN112506671B (en) 2021-05-07
WO2022166673A1 (en) 2022-08-11
CN112506671A (en) 2021-03-16
CN113204432A (en) 2021-08-03

Similar Documents

Publication Publication Date Title
CN113204432B (en) Transaction processing method and device in blockchain and electronic equipment
CN107450979B (en) Block chain consensus method and device
US10999060B2 (en) Data processing method and apparatus
CN113743941B (en) Method for executing transaction in block chain, block chain and main node
CN108846749B (en) Partitioned transaction execution system and method based on block chain technology
CN109598407B (en) Method and device for executing business process
CN111369358B (en) Block chain consensus method and device and electronic equipment
CN110020859B (en) Parallel execution block chain consensus method and device and electronic equipment
CN110648136B (en) Consensus and transaction synchronous parallel processing method and device and electronic equipment
CN113743942B (en) Transaction execution method, blockchain, master node and master storage device
CN109582398B (en) State processing method and device and electronic equipment
CN113744063B (en) Method and device for executing transaction in block chain
CN109376988B (en) Service data processing method and device
CN109345081B (en) Data acquisition method and device and electronic equipment
CN113486109A (en) Data synchronization method and device of heterogeneous database and electronic equipment
CN111709748B (en) Transaction execution method and device with business attribute and electronic equipment
CN109614393A (en) Verification of data method and device
CN110245115B (en) File processing method, engine and system
CN110059115B (en) Data reading method and device
CN113706146B (en) Processing method, device and system for executing batch transactions based on blockchain
CN110599139B (en) Block output method and device in block chain consensus algorithm
CN115033350A (en) Execution method and device of distributed transaction
CN109614388B (en) Budget deduction method and device
CN112351085A (en) Network resource safety sharing method
CN113723963B (en) Method and device for checking labels of transactions in blockchain and electronic equipment

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
GR01 Patent grant
GR01 Patent grant