CN113204432A - Transaction processing method and device in block chain and electronic equipment - Google Patents

Transaction processing method and device in block chain and electronic equipment Download PDF

Info

Publication number
CN113204432A
CN113204432A CN202110692124.0A CN202110692124A CN113204432A CN 113204432 A CN113204432 A CN 113204432A CN 202110692124 A CN202110692124 A CN 202110692124A CN 113204432 A CN113204432 A CN 113204432A
Authority
CN
China
Prior art keywords
block
transaction
consensus
nth
blockchain
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.)
Granted
Application number
CN202110692124.0A
Other languages
Chinese (zh)
Other versions
CN113204432B (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.)
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

Images

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)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)
  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the specification discloses a transaction processing method and device in a block chain and electronic equipment. The method comprises the following steps: the block chain node executes a transaction execution operation corresponding to the Nth block, wherein the transaction corresponding to the Nth block is agreed in the block chain system; and in the process that the block chain node executes 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.

Description

Transaction processing method and device in block chain and electronic equipment
The present application is a divisional application of patent applications having an application number of "202110146211.6", an application date of "2021, 02/03", and an invention name of "transaction processing method, apparatus, and electronic device in block chain".
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 stages: collect transaction → consensus → transaction execution → write block. Through the above process, a tile can be generated. After a block (e.g., block N in fig. 1) is generated, the transaction processing flow of the next block (e.g., block N +1 in fig. 1) is entered.
As mentioned above, the transaction processing flow of one tile in the tile chain includes four stages. After the nth block is generated, the transaction processing flow of the (N +1) th block is entered. In such a transaction processing manner, at any time point, the consensus node can only process one stage corresponding to one block. This approach does not make good use of the processing resources of the nodes, for example, the parallel computing characteristics of multiple cores are not made good use of, and the performance of the blockchain system is difficult to be improved.
Fig. 1 shows a general process for processing a transaction by a consensus node in a blockchain system. In some blockchain systems, not all of the common nodes perform the transaction collection operations in the four phases described above. For example, in some block chain systems using a main consensus algorithm (e.g., Practical Byzantine Fault Tolerance, PBFT), the consensus master node may perform the four phases of operations, and the consensus non-master node may perform the three phases of operations of consensus → transaction execution → block writing; or each common node may perform all the operations of the four phases. In some other blockchain systems that use an algorithm without main consensus (e.g., honeyy Badger Byzantine Fault Tolerant, HBBFT, Badger bazaltion Fault-Tolerant algorithm), the nodes with consensus do not distinguish between main nodes or non-main nodes, and each node with consensus can perform all the above four phases of operations.
Chinese patent application publication No. CN111522648A discloses a transaction processing method, in which block chain nodes execute block writing operation of the nth round of transaction and consensus execution operation of the N +1 th round of transaction in parallel. A representative embodiment may be as shown in fig. 2 (which is also fig. 2 of the patent application publication No. CN 111522648A). As shown in fig. 2, a first thread and a second thread may be executed in parallel, and during the execution of N rounds of consensus and transaction by the first thread, the second thread may perform a block writing operation for the N-1 st round of transaction in parallel; in the process that the first thread carries out N +1 rounds of consensus and transaction execution, the second thread can carry out block writing operation of Nth round of transaction in parallel; during the process of carrying out N +2 rounds of consensus and transaction execution by the first thread, the second thread can carry out block writing operation of N +1 round of transaction in parallel. The above example mainly aims at the situation that the occupation time of the consensus phase and the transaction execution phase is short and the occupation time of the block writing phase is long in the block chain transaction processing process. Thus, the coupling of the consensus operation and the transaction execution operation in the same round is maintained, while being decoupled from the write block operation of the round, so that two different threads can be used to execute (consensus + transaction execution) and write block, respectively. In this way, in the process of executing the block writing operation of the previous block, the operation of (consensus + transaction execution) of the next block can be executed in parallel, and the method is particularly suitable for processing by a computer adopting a multi-core CPU (central processing unit), so that the transaction processing efficiency can be improved, and the blockchain system can be suitable for application scenes with high business concurrence.
In fact, transactions collected in a certain round may include ordinary transfer transactions and transactions involving smart contracts. For ordinary transfer transactions, the processing time is generally relatively short, whereas for transactions involving smart contracts, the contract logic may be more complex, or transactions involving contracts may be more numerous, such that the processing time may be relatively long. Thus, for transactions involving a large number of transactions involving smart contracts, or for smart contracts involving complex logic, the transaction execution link may have a processing time that is longer than the processing time of the consensus link, closer to the processing time of the write block operation, or even longer than the processing time of the write block operation. Thus, only the (consensus + trade execution) and write blocks are decoupled in this example, and there is still further room for optimization.
Disclosure of Invention
The embodiment of the specification provides a transaction processing method and device in a block chain and electronic equipment.
A method of transaction processing in a blockchain, comprising:
the block chain node executes a transaction execution operation corresponding to the Nth block, wherein the transaction corresponding to the Nth block is agreed in the block chain system;
and in the process that the block chain node executes 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.
A transaction processing device applied to a blockchain node comprises:
a transaction execution module for executing a transaction execution operation corresponding to an nth block, wherein the transaction corresponding to the nth block has agreed in a blockchain system;
and the consensus module is used for parallelly executing the consensus operation on the transaction corresponding to the (N +1) th block in the process of executing the transaction execution operation corresponding to the Nth 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 reached a consensus 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 block chain is processed, the block chain link points can process different stages of the corresponding transaction of different blocks in parallel, the computing power of the multi-core CPU is utilized, the operation efficiency of the block chain system is greatly improved, and the performance is improved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the specification and are incorporated in and constitute a part of this specification, illustrate embodiments of the specification and together with the description serve to explain the specification and not to limit the specification in a non-limiting sense. In the drawings:
FIG. 1 is a schematic diagram illustrating a process for processing transactions in a blockchain system provided in the prior art;
FIG. 2 is a process diagram of a transaction processing method provided by the prior art;
fig. 3 is a schematic flow chart of an implementation of a transaction processing method in a blockchain according to an embodiment of the present disclosure;
FIG. 4 is a schematic diagram illustrating an embodiment of a method for processing transactions in a blockchain according to an 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
In order to make the purpose, technical solutions and advantages of this document more clear, the technical solutions of this specification will be clearly and completely described below with reference to specific embodiments of this specification and the accompanying drawings. It is to be understood that the embodiments described are only a few embodiments of this document, and not all embodiments. All other embodiments obtained by a person skilled in the art without making any inventive step based on the embodiments in this description belong to the protection scope of this document.
The technical solutions provided by the embodiments of the present description are described in detail below with reference to the accompanying drawings.
One or more embodiments of the present specification provide a method for processing a transaction in a blockchain, where an implementation flow diagram is shown in fig. 3, and the method includes:
in step 310, the block node performs a transaction execution operation corresponding to the nth block.
The transaction corresponding to the nth block may be a transaction that has agreed in the blockchain system. Further, in step 310, the block link point may execute the transaction corresponding to the nth block that has been agreed upon.
The transaction execution operation may be processed by a transaction execution thread in a blockchain node. The above consensus operation may be handled by a consensus thread in a blockchain node.
As described in the background, the transaction processing in a blockchain typically includes four distinct operations, collecting transactions, transaction consensus, transaction execution, and writing blocks. As mentioned above, 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 without performing the operation of collecting transactions. Thus, for a consensus node performing a collect transaction, this operation may also be performed by a separate thread in the consensus node, e.g., referred to as a transaction collect thread. Specifically, as shown in fig. 4, before the execution of the transaction execution operation corresponding to the nth block begins, the consensus node may query, through the transaction collection thread, whether the transactions collected in the transaction memory pool have satisfied the preset transaction collection condition. And if the preset transaction collection condition is met, the consensus node packs the transactions collected by the transaction memory pool through a 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 adopting the master consensus algorithm, or the consensus node is a consensus node in the blockchain system adopting the masterless consensus algorithm, the consensus thread may obtain the transaction corresponding to the nth block from the collected transaction thread. Further, a consensus proposal may be initiated based on the transaction to perform a consensus phase operation, e.g., a consensus thread in a blockchain node may perform the consensus operation.
In addition, when the consensus node is a consensus non-master node in the blockchain system adopting the master consensus algorithm, the blockchain node responds to consensus proposals of transactions corresponding to the Nth block sent by other consensus nodes, and performs consensus operation based on the consensus proposals. The consensus operation may be performed, for example, by a consensus thread in a blockchain node. In this case, since the consensus node is in response to the sent consensus offer, and the sent consensus offer may include the transaction to be agreed upon, 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 collection transaction thread, the sequence of collection transaction → consensus can still be maintained for the processing flow of the transaction corresponding to the same block.
After the block link point completes the consensus operation on the transaction corresponding to the nth block, the transaction execution operation corresponding to the nth block in step 310 may be performed. The transaction execution operation may be performed, for example, by a transaction execution thread in a blockchain node.
Similarly, after the consensus operation of the nth block-corresponding transaction is completed, the consensus result is transmitted to the transaction execution thread of the block-linked node, so that the sequence of consensus → transaction execution can still be maintained for the processing flow of the same block-corresponding transaction.
In step 320, during the process of executing the transaction execution operation corresponding to the nth block, the block nodes execute the consensus operation corresponding to the (N +1) th block in parallel.
Similarly, before the consensus operation is performed on the transaction corresponding to the (N +1) th block, the consensus node may query, through the transaction collection thread, whether the transaction collected in the transaction memory pool has satisfied the preset transaction collection condition. And if the preset transaction collection condition is met, the consensus node packs the transactions collected by the transaction memory pool through a 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 agreed upon. Further, the consensus node may perform the operation of the consensus phase through the consensus thread, i.e., perform the consensus operation on the (N +1) th block corresponding transaction in step 320.
Specifically, when the consensus node is a consensus master node in the blockchain system adopting the master consensus algorithm, or the consensus node is a consensus node in the blockchain system adopting the masterless consensus algorithm, the consensus thread may obtain the transaction corresponding to the (N +1) th block from the collected transaction thread. Further, a consensus proposal may be initiated based on the transaction to enter into a consensus phase, e.g., a consensus thread in a blockchain node may perform the consensus operation.
When the consensus node is a consensus non-master node in the blockchain system using the master consensus algorithm, the blockchain node responds to consensus suggestions for the transaction corresponding to the (N +1) th block from other consensus nodes, and performs consensus operations based on the consensus suggestions, for example, the consensus operations may be performed by a consensus thread in the blockchain node. In this case, since the consensus node is in response to the sent consensus offer, and the sent consensus offer may include the transaction to be agreed upon, 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 +1) th block from the collection transaction thread, the sequence of collection transaction → consensus can still be maintained for the processing flow of the transaction corresponding to the same block.
If the blockchain node performs the process of collecting the transaction corresponding to the nth block and performs the process of collecting the transaction corresponding to the (N +1) th block, the blockchain node collects the transaction corresponding to the (N +1) th block and then collects the transaction corresponding to the (N +1) th block. This is particularly true where only one gather transaction thread is assigned to a blockchain node. And, the blockchain node performs an operation of collecting the (N +1) th blockchain transaction in parallel in the process of consensus on the nth proposal.
The consensus operation of the block link point on the transaction corresponding to the (N +1) th block may be performed after the consensus on the transaction corresponding to the nth block is achieved. This is particularly true where only one consensus thread is assigned to a blockchain node.
It should be noted that the consensus proposal for the nth block and the consensus proposal for the (N +1) th block may be initiated by the same consensus node or by different consensus nodes. For example, the consensus operation for the block-linked point for the nth block may be initiated by the block-linked point as the consensus master, while the consensus operation for the (N +1) th block may be initiated by another block-linked point as the consensus master, or vice versa.
After the block link point completes the consensus operation on the transaction corresponding to the (N +1) th block, the transaction corresponding to the (N +1) th block may be executed. The transaction execution operation may be performed, for example, by a transaction execution thread in a blockchain node.
Similarly, after the consensus operation of the (N +1) th block-corresponding transaction is performed by the consensus thread, the consensus result is transmitted to the transaction execution thread of the block link point, so that the sequence of consensus → transaction execution can still be maintained for the processing flow of the same block-corresponding transaction.
As shown in fig. 4, after the block link point completes the operation of executing the transaction corresponding to the nth block, the block link point may also write the result of executing the transaction into the nth block of the block chain book, i.e., a block writing operation. Similarly, during the block link point executing the block writing operation corresponding to the nth block, the transaction executing operation corresponding to the (N +1) th block is executed in parallel.
The block link point may perform the operation on the transaction corresponding to the (N +1) th block after performing the operation on the transaction corresponding to the nth block. This is particularly true where only one transaction execution thread is assigned to a blockchain node.
As shown in fig. 4, after the block link point completes the operation of executing the transaction corresponding to the (N +1) th block, the block link point may also write the result of executing the transaction into the (N +1) th block of the block chain ledger. Similarly, the block link point may perform a write block operation on the N +1 th block after the write block operation on the nth block. This is particularly true where the blockchain node has only one write block thread assigned.
When the block chain node completes the collection transaction operation corresponding to the (N +1) th block, the consensus operation for the nth block may not be completed yet, and thus the consensus operation for the (N +1) th block cannot be started yet. At this time, the block link point may store the collected transaction corresponding to the (N +1) th block in the memory, extract the transaction corresponding to the (N +1) th block from the memory after the corresponding consensus operation of the nth block is completed, and start the consensus operation on the transaction corresponding to the (N +1) th block.
Similarly, when the block node completes the consensus operation corresponding to the (N +1) th block, the transaction execution operation of the nth block may not be completed, and thus the transaction execution operation of the (N +1) th block may not be started. At this time, the block link point may store the consensus result corresponding to the (N +1) th block in the memory, and after the transaction execution operation corresponding to the nth block is completed, extract the consensus result corresponding to the (N +1) th block from the memory, and start to execute the transaction execution operation corresponding to the (N +1) th block.
Similarly, when the transaction execution operation corresponding to the (N +1) th block is completed, the block writing operation for the nth block may not be completed, and thus the block writing operation for the (N +1) th block may not be started. At this time, the block chain node may store the transaction execution result corresponding to the (N +1) th block in the memory, and after the block writing operation corresponding to the nth block is completed, extract the transaction execution result corresponding to the (N +1) th block from the memory, and start to execute the block writing operation corresponding to the (N +1) th block.
By adopting the transaction processing method provided by the embodiment of the specification, when the transaction in the blockchain is processed, the blockchain link points can process different stages of the corresponding transaction of different blocks in parallel, the computing power 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 provided in an embodiment of the present specification. Referring to fig. 5, 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. 5, but this does not indicate only one bus or one type of bus.
And the memory is used for storing programs. In particular, the program may include program code comprising computer operating instructions. The memory may include both memory and non-volatile storage and provides instructions and data to the processor.
The processor reads the corresponding computer program from the nonvolatile memory into the memory and then runs the computer program to form the transaction processing device on a logic level. The processor is used for executing the program 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 reached a consensus 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, in the scheme of the embodiment of the present specification, when a transaction in a block chain is processed, block chain link points may process different stages of the transaction corresponding to different blocks in parallel, and the computing power of a multi-core CPU is utilized, so that the operating efficiency of the block chain system is greatly improved, and the performance is improved.
The transaction processing method in the blockchain disclosed in the embodiments of fig. 3 to 4 of the present specification can be applied to 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 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 one or more 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 one or more embodiments of the present disclosure may be embodied directly in hardware, in a software module executed by a hardware decoding processor, or in a combination of the hardware and software modules executed by a hardware 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.
The electronic device may further execute the transaction processing method in the block chain of fig. 3 to 4, which is not described herein again.
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.
Embodiments of the present specification also provide a computer-readable storage medium storing one or more programs, the one or more programs including instructions, which when executed by a portable electronic device including a plurality of application programs, enable the portable electronic device to perform the method of the embodiments shown in fig. 3-4, and are specifically configured to:
executing a transaction execution operation corresponding to an Nth block, wherein the transaction corresponding to the Nth block has reached a consensus 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 provided in an embodiment of the present specification. In a particular application, the transaction processing device 600 may be a blockchain node, or the transaction processing device may be deployed on a blockchain node. Referring to fig. 6, in one embodiment, the transaction processing device 600 includes:
a transaction executing module 603 configured to execute a transaction executing operation corresponding to an nth block, wherein the transaction corresponding to the nth block has been agreed in the blockchain system;
the consensus module 602, during the transaction execution module executing the transaction execution operation corresponding to the nth block, concurrently executes the consensus operation corresponding to the (N +1) th block.
Optionally, before the transaction executing module 603 executes the transaction executing operation of the nth block, 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 transaction collection module 601, and before the consensus module 602 performs consensus on the transaction corresponding to the nth block in the blockchain system, the transaction collection module 601 collects the transaction corresponding to the nth block.
Optionally, the transaction processing apparatus 600 further includes a block writing module 604, and after the transaction executing module 603 completes the transaction executing operation corresponding to the nth block, the block writing module 604 writes the result of the transaction executing operation into the nth block of the block chain ledger.
Optionally, the consensus module 602 performs a consensus operation on the transaction corresponding to the (N +1) th block after agreeing on the transaction corresponding to the nth block.
Optionally, in the process that the consensus module 602 performs consensus on the transaction corresponding to the nth block, the transaction collection module 601 performs an operation of collecting transactions corresponding to the (N +1) th block in parallel.
Optionally, the transaction collection module 601 performs an operation of collecting transactions corresponding to the (N +1) th block after collecting transactions corresponding to the nth block.
Optionally, during the process that the write block module 604 performs the write block operation corresponding to the nth block, the transaction execution module 603 performs the transaction execution operation corresponding to the (N +1) th block in parallel.
Optionally, the transaction executing module 603 executes the transaction executing operation corresponding to the (N +1) th block after executing the transaction executing operation corresponding to the nth block.
Optionally, after the transaction executing module 603 completes the transaction executing operation corresponding to the (N +1) th block, the writing block module 604 writes the result of the transaction executing operation into the (N +1) th block of the block chain ledger.
Optionally, the write block module 604 performs a write block operation corresponding to the N +1 th block after performing the write block operation corresponding to the nth block.
Optionally, if the transaction collection module 601 finishes the operation of collecting the transaction corresponding to the nth +1 block, and the process of the consensus module 602 for the consensus corresponding to the nth block is not finished yet, the transaction collection module further stores the collected transaction corresponding to the nth +1 block in the memory.
Optionally, if the transaction execution module 603 has not finished executing the transaction corresponding to the nth block after the consensus operation corresponding to the (N +1) th block is finished by the consensus module 602, the consensus module further stores the consensus result of the (N +1) th block in the memory.
Optionally, if the transaction executing module 603 finishes executing the transaction executing operation corresponding to the (N +1) th block, the block writing module 604 does not finish the block writing process corresponding to the nth block, and the transaction executing module further stores the transaction executing result corresponding to the (N +1) th block in the memory.
Based on the transaction processing device 600 shown in fig. 6, it can be known that, in the scheme of the embodiment of the present specification, when a transaction in a blockchain is processed, the blockchain link points where the transaction processing device 600 is deployed can process different stages of the transaction corresponding to different blocks in parallel by using the computing power of the multi-core CPU, so that the operation efficiency of the blockchain system is greatly improved, and the performance is improved.
In short, the above description is only a preferred embodiment of the present disclosure, and is not intended to limit the scope of the present disclosure. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of one or more embodiments of the present disclosure should be included in the scope of protection of one or more embodiments of the present disclosure.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. One typical implementation device is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smartphone, 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 computer storage media 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, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
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 an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.

Claims (16)

1. A method of transaction processing in a blockchain, comprising:
the block chain node executes a transaction execution operation corresponding to the Nth block, wherein the transaction corresponding to the Nth block is agreed in the block chain system;
and in the process that the block chain node executes 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.
2. The method of claim 1, prior to the block link point performing the transaction performance operation for the nth block, the method further comprising:
and the block link point performs consensus on the transaction corresponding to the Nth block in a block link system.
3. The method of claim 2, wherein prior to the block link point agreeing on the transaction corresponding to the nth block in a block link system, the method further comprises:
and the block chain node collects the transaction corresponding to the Nth block.
4. The method of claim 1, wherein after the block link point completes the operation on the transaction corresponding to the nth block, the method further comprises:
the blockchain node writes the result of the transaction execution into the nth block of a blockchain book.
5. The method of claim 1, wherein the consensus operation for the transaction corresponding to the (N +1) th block is performed after the consensus operation for the transaction corresponding to the nth block is achieved.
6. The method of claim 2, further comprising:
and the block chain node parallelly executes the operation of collecting the transaction corresponding to the (N +1) th block in the process of identifying the transaction corresponding to the Nth block.
7. The method of claim 6, wherein the block link point performs the operation of collecting the (N +1) th block corresponding transaction after performing the operation of collecting the (N) th block corresponding transaction.
8. The method of claim 7, wherein the block link point performs the transaction execution operation corresponding to the (N +1) th block in parallel during the block writing operation corresponding to the nth block.
9. The method of claim 8, wherein the block link point performs the operation on the transaction corresponding to the (N +1) th block after performing the operation on the transaction corresponding to the nth block.
10. The method of claim 8, wherein after the block link point completes the operation on the transaction corresponding to the (N +1) th block, the method further comprises:
the blockchain link point writes the result of the transaction execution into the (N +1) th block of a blockchain book.
11. The method of claim 10, wherein the block linking point operates on a write block corresponding to the (N +1) th block after the write block corresponding to the nth block.
12. The method of claim 6, if the blockchain node finishes the process of consensus on the nth block after the operation of collecting the (N +1) th corresponding transaction is finished, the method further comprising:
and the block chain node stores the collected transaction corresponding to the (N +1) th block into the memory.
13. The method of claim 8, if the blockchain node has not finished performing the transaction for the nth block after the end of performing the consensus operation for the (N +1) th block, the method further comprising:
and the block chain node stores the consensus result corresponding to the (N +1) th block into the memory.
14. The method of claim 10, if the blockchain node ends the block writing process for the nth block after the transaction execution operation corresponding to the (N +1) th block is completed, the method further comprises:
and the block chain node stores the transaction execution result corresponding to the (N +1) th block into the memory.
15. A transaction processing device applied to a blockchain node comprises:
a transaction execution module for executing a transaction execution operation corresponding to an nth block, wherein the transaction corresponding to the nth block has agreed in a blockchain system;
and the consensus module is used for parallelly executing the consensus operation on the transaction corresponding to the (N +1) th block in the process of executing the transaction execution operation corresponding to the Nth block by the transaction execution module.
16. 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 reached a consensus 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.
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
CN202110146211.6A CN112506671B (en) 2021-02-03 2021-02-03 Transaction processing method and device in block chain and electronic equipment
CN202110692124.0A CN113204432B (en) 2021-02-03 2021-02-03 Transaction processing method and device in blockchain 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 true CN113204432A (en) 2021-08-03
CN113204432B 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)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022166673A1 (en) * 2021-02-03 2022-08-11 支付宝(杭州)信息技术有限公司 Transaction processing method and apparatus in blockchain, and electronic device
WO2023056958A1 (en) * 2021-10-09 2023-04-13 支付宝(杭州)信息技术有限公司 Consensus method, blockchain system, and consensus node

Families Citing this family (3)

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

Citations (8)

* 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
CN107528882A (en) * 2017-07-14 2017-12-29 阿里巴巴集团控股有限公司 The method, apparatus and electronic equipment of processing common recognition request in block chain common recognition network
CN107688999A (en) * 2017-08-11 2018-02-13 杭州秘猿科技有限公司 A kind of parallel transaction based on block chain performs method
CN109213790A (en) * 2018-08-10 2019-01-15 南京简诺特智能科技有限公司 A kind of data circulation analysis method and system based on block chain
KR20190009958A (en) * 2017-07-20 2019-01-30 주식회사 더블체인 Extendable block chain system and block chain extending method
CN110728578A (en) * 2019-09-29 2020-01-24 南京金宁汇科技有限公司 Parallel execution method, system and storage medium for block chain transaction
CN111475501A (en) * 2020-06-24 2020-07-31 支付宝(杭州)信息技术有限公司 Data cleaning method and device for block chain network
CN111522648A (en) * 2020-07-03 2020-08-11 支付宝(杭州)信息技术有限公司 Transaction processing method and device for block chain and electronic equipment

Family Cites Families (7)

* 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
CN110020859B (en) * 2019-03-28 2022-03-11 杭州秘猿科技有限公司 Parallel execution block chain consensus method and device and electronic equipment
US11423016B2 (en) * 2019-06-26 2022-08-23 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
CN110659988B (en) * 2019-09-10 2022-11-18 杭州秘猿科技有限公司 Parallel processing method and device for block chain consensus and execution and electronic equipment
CN110648136B (en) * 2019-09-10 2022-06-03 杭州秘猿科技有限公司 Consensus and transaction synchronous parallel processing method and device and electronic equipment
CN112506671B (en) * 2021-02-03 2021-05-07 支付宝(杭州)信息技术有限公司 Transaction processing method and device in block chain and electronic equipment

Patent Citations (8)

* 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
CN107528882A (en) * 2017-07-14 2017-12-29 阿里巴巴集团控股有限公司 The method, apparatus and electronic equipment of processing common recognition request in block chain common recognition network
KR20190009958A (en) * 2017-07-20 2019-01-30 주식회사 더블체인 Extendable block chain system and block chain extending method
CN107688999A (en) * 2017-08-11 2018-02-13 杭州秘猿科技有限公司 A kind of parallel transaction based on block chain performs method
CN109213790A (en) * 2018-08-10 2019-01-15 南京简诺特智能科技有限公司 A kind of data circulation analysis method and system based on block chain
CN110728578A (en) * 2019-09-29 2020-01-24 南京金宁汇科技有限公司 Parallel execution method, system and storage medium for block chain transaction
CN111475501A (en) * 2020-06-24 2020-07-31 支付宝(杭州)信息技术有限公司 Data cleaning method and device for block chain network
CN111522648A (en) * 2020-07-03 2020-08-11 支付宝(杭州)信息技术有限公司 Transaction processing method and device for block chain and electronic equipment

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022166673A1 (en) * 2021-02-03 2022-08-11 支付宝(杭州)信息技术有限公司 Transaction processing method and apparatus in blockchain, and electronic device
WO2023056958A1 (en) * 2021-10-09 2023-04-13 支付宝(杭州)信息技术有限公司 Consensus method, blockchain system, and consensus node

Also Published As

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

Similar Documents

Publication Publication Date Title
CN112506671B (en) Transaction processing method and device in block chain and electronic equipment
CN107450979B (en) Block chain consensus method and device
CN108648078B (en) Transaction preprocessing method and device and electronic equipment
US10999060B2 (en) Data processing method and apparatus
CN108846749B (en) Partitioned transaction execution system and method based on block chain technology
CN113743941B (en) Method for executing transaction in block chain, block chain and main node
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
EP3640813B1 (en) Cluster-based random walk method and apparatus
CN113486109A (en) Data synchronization method and device of heterogeneous database and electronic equipment
CN109582398B (en) State processing method and device and electronic equipment
CN111383031A (en) Intelligent contract execution method and system in block chain and electronic equipment
CN113743942A (en) Transaction execution method, block chain, main node and main storage device
CN107451204B (en) Data query method, device and equipment
CN109345081B (en) Data acquisition method and device and electronic equipment
CN113744062B (en) Method for performing transactions in a blockchain, blockchain node and blockchain
CN109376988B (en) Service data processing method and device
CN110059115B (en) Data reading method and device
CN115760405A (en) Transaction execution method, device, computer equipment and medium
CN113706146B (en) Processing method, device and system for executing batch transactions based on blockchain
CN110046194A (en) A kind of method, apparatus and electronic equipment of expanding node relational graph
CN112907198B (en) Service state circulation maintenance method and device and electronic equipment
CN110599139B (en) Block output method and device in block chain consensus algorithm
CN115098483A (en) Pre-execution cache data cleaning method and block link point
CN110018844B (en) Management method and device of decision triggering scheme 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
TR01 Transfer of patent right

Effective date of registration: 20240919

Address after: Room 803, floor 8, No. 618 Wai Road, Huangpu District, Shanghai 200010

Patentee after: Ant blockchain Technology (Shanghai) Co.,Ltd.

Country or region after: China

Address before: 310000 801-11 section B, 8th floor, 556 Xixi Road, Xihu District, Hangzhou City, Zhejiang Province

Patentee before: Alipay (Hangzhou) Information Technology Co.,Ltd.

Country or region before: China

Patentee before: Ant blockchain Technology (Shanghai) Co.,Ltd.

TR01 Transfer of patent right