CN111240831A - Method and device for parallel execution of transactions in block chain, electronic equipment and storage medium - Google Patents

Method and device for parallel execution of transactions in block chain, electronic equipment and storage medium Download PDF

Info

Publication number
CN111240831A
CN111240831A CN201911413971.8A CN201911413971A CN111240831A CN 111240831 A CN111240831 A CN 111240831A CN 201911413971 A CN201911413971 A CN 201911413971A CN 111240831 A CN111240831 A CN 111240831A
Authority
CN
China
Prior art keywords
transaction
transactions
block chain
nodes
execution
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201911413971.8A
Other languages
Chinese (zh)
Inventor
白玉龙
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shaanxi Medicine Chain Group Co Ltd
Original Assignee
Shaanxi Medicine Chain Group 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 Shaanxi Medicine Chain Group Co Ltd filed Critical Shaanxi Medicine Chain Group Co Ltd
Priority to CN201911413971.8A priority Critical patent/CN111240831A/en
Publication of CN111240831A publication Critical patent/CN111240831A/en
Pending legal-status Critical Current

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/5061Partitioning or combining of resources
    • 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/54Interprogram communication
    • G06F9/542Event management; Broadcasting; Multicasting; Notifications

Abstract

The application provides a method, a device, electronic equipment and a storage medium for parallel execution of transactions in a blockchain, wherein the method comprises the following steps: A. performing different processing on different types of operations on a state library in a block chain; B. grouping the transactions in the block chain according to the acceptance nodes to obtain a plurality of transaction queues, and executing the transactions of the plurality of queues in parallel; C. voting the transaction execution result by all block chain production nodes, and achieving transaction consensus according to the voting result; D. the transactions that have agreed are packaged into blocks. According to the method and the device, with the increase of production nodes of the block chain, the number of transaction execution queues is increased, multi-queue transactions are executed in parallel, and the transaction throughput of the system can be greatly improved.

Description

Method and device for parallel execution of transactions in block chain, electronic equipment and storage medium
Technical Field
The present application relates to the field of blockchain technologies, and in particular, to a method and an apparatus for parallel execution of transactions in a blockchain, an electronic device, and a storage medium.
Background
In the current block chain, transactions can fall according to the execution sequence of the out-block nodes, and for the purpose of state balance of all nodes, the non-out-block nodes only check the fall-block transactions in sequence, so that the system transaction processing efficiency is low.
Disclosure of Invention
In view of this, the present application provides a parallel transaction execution scheme in a block chain to improve the transaction processing efficiency of the system.
In order to achieve the purpose, the technical scheme adopted by the application is as follows:
in a first aspect, the present application provides a method for parallel execution of transactions in a blockchain, including:
A. performing different processing on different types of operations on a state library in a block chain;
B. grouping the transactions in the block chain according to the acceptance nodes to obtain a plurality of transaction queues, and executing the transactions of the plurality of queues in parallel;
C. voting the transaction execution result by all block chain production nodes, and achieving transaction consensus according to the voting result;
D. the transactions that have agreed are packaged into blocks.
Optionally, the step a specifically includes:
when adding the values of the block chain state library, actually adding the state library after each node achieves successful consensus on the transaction; when the value of the state base is subtracted, the subtraction operation is firstly carried out on the state base, and if the transaction achieves the failure consensus, the rollback operation is carried out.
Optionally, the step a further includes:
the modified record is locked while operating on the state values in the state library.
Optionally, the step B specifically includes:
b1, the acceptance node receives the transaction of the client, adds the transaction into the current node queue, codes and signs the transaction according to the execution sequence after the transaction is successfully executed, and broadcasts the transaction signed by the node to other production nodes;
b2, receiving the ordered and signed transactions sent by other nodes, adding the transactions into different transaction queues according to different receiving nodes, and executing the transactions in sequence according to the ordering sequence;
b3, executing the transactions of the plurality of queues in parallel.
Optionally, the step C specifically includes:
c1, each node signs the execution result after the transaction is executed, and broadcasts the execution result to other nodes;
c2, after each node receives the signature of other nodes to the transaction execution result, performing consensus calculation according to the execution result of each node;
and C3, according to the result of the consensus, executing confirmation or rollback operation on the transaction.
In a second aspect, the present application provides a transaction parallel execution apparatus, including:
the processing module is used for carrying out different processing on different types of operations on the state library in the block chain;
the execution module is used for grouping the transactions in the block chain according to the receiving nodes to obtain a plurality of transaction queues, and the transactions of the queues are executed in parallel;
the consensus module is used for voting the transaction execution result by all the blockchain production nodes and achieving transaction consensus according to the voting result;
and the packaging module is used for packaging the transaction which has agreed into the block.
In a third aspect, the present application provides an electronic device, comprising:
a processor, a memory and a communication unit;
the memory stores machine-readable instructions executable by the processor, the processor and the memory communicate via the communication unit when the terminal is operating;
wherein the processor executes the machine-readable instructions to perform the methods of the various aspects described above.
In a fourth aspect, the present application provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, performs the method of the above aspects.
The beneficial effect of this application is:
1. by different processing of different types of operations on the state library in the blockchain, the final state consistency is not influenced by the execution sequence of the blockchain transaction;
2. the transaction of a plurality of queues can be executed in parallel, the state consistency of a plurality of nodes is ensured, and the execution efficiency of the system can be greatly improved;
3. voting is carried out on the transaction execution result by the multiple nodes, the transaction execution consensus is carried out according to the node voting result, and each node has a consistent behavior for any transaction according to the consensus result, so that the consistency of the states of each node is ensured;
4. when the nodes of the block are packed, only the transactions which have achieved consensus are packed into the block, and the condition baselines of the block can be ensured to be consistent at each node.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained from the drawings without inventive effort.
Fig. 1 is a flowchart of a transaction parallel execution method provided in the present application.
Fig. 2 is a schematic structural diagram of a transaction parallel execution device provided in the present application.
Fig. 3 is a schematic structural diagram of an electronic device provided in the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments.
As shown in fig. 1, the present application provides a method for executing transactions in a blockchain in parallel, including:
s10: performing different processing on different types of operations on a state library in a block chain;
through different processing of different types of operations on the state base in the block chain, weakly related transactions in the block chain are allowed to be executed in parallel at the nodes, execution of strongly related transaction sequences is guaranteed, and the fact that the execution sequences do not affect final state consistency is guaranteed.
When the value of the state base is added, after each node achieves successful consensus on the transaction, actually adding the state base; when the value of the state base is subtracted, the subtraction operation is firstly carried out on the state base to prevent double flowers from being generated, and if the transaction achieves failure consensus, the rollback operation is carried out. When the state value in the state library is operated, the modified record is locked, and the parallel of multiple transactions is forbidden.
This ensures that a state agreement is achieved after the nodes of the blockchain execute transactions in different orders.
S20: grouping the transactions in the block chain according to the acceptance nodes to obtain a plurality of transaction queues, and executing the transactions of the plurality of queues in parallel;
a. and the receiving node receives the transaction of the client, joins the current node queue, codes and signs the transaction according to the execution sequence after the transaction is successfully executed, and broadcasts the transaction signed by the node to other production nodes.
b. And after receiving the sequenced and signed transactions sent by other nodes, adding the transactions into different transaction queues according to different receiving nodes. And executed in order in the order of the sort.
C. Multiple queued transactions can be performed in parallel without affecting final node state consistency. Therefore, the transaction execution is changed from single-queue single-thread execution to multi-queue multi-thread parallel execution, and the execution efficiency of the whole system can be greatly improved.
S30: all the production nodes vote on the execution result of the transaction and reach a transaction consensus according to the voting result.
a. Each node signs the execution result after the transaction is executed and broadcasts the execution result to other nodes.
b. After each node receives the signatures of other nodes on the transaction execution results, consensus calculation is carried out according to the execution results of the nodes.
c. And performing confirmation or rollback operation on the transaction according to the consensus result.
According to the multi-node consensus result, all nodes have consistent behaviors for any transaction, and the consistency of the states of all nodes is ensured.
S40: the transactions that have agreed are packaged into blocks.
When the out-block nodes are packed, only the transactions which have agreed to be packed into the blocks. To ensure that the state baselines of the blocks are consistent across nodes. And the stable state baseline of the block during the replay is ensured.
In a second aspect, the present application provides a device for parallel execution of transactions in a blockchain, including:
a processing module 210, configured to perform different processing on different types of operations on a state library in a block chain;
the execution module 220 is configured to group the transactions in the block chain according to the receiving nodes to obtain multiple transaction queues, and execute the transactions in the multiple queues in parallel;
a consensus module 230, configured to vote on the transaction execution result of all blockchain production nodes, and achieve a transaction consensus according to the voting result;
a packaging module 240 for packaging the agreed transactions into blocks.
The above-mentioned apparatus is used for executing the method provided by the foregoing embodiment, and the implementation principle and technical effect are similar, which are not described herein again.
The above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is only one logical functional division, and there may be other divisions in actual implementation, and the above units may be one or more integrated circuits configured to implement the above methods, for example: one or more Application Specific Integrated Circuits (ASICs), or one or more microprocessors (DSPs), or one or more Field Programmable Gate Arrays (FPGAs), among others. For another example, when one of the above units is implemented in the form of a Processing element scheduler code, the Processing element may be a general-purpose processor, such as a Central Processing Unit (CPU) or other processor capable of calling program code. As another example, these units may be integrated together and implemented in the form of a system-on-a-chip (SOC).
Fig. 3 is a schematic structural diagram of an electronic device provided in the present application, where functions of the electronic device are the same as those implemented by the foregoing apparatus, and the electronic device includes:
a processor 310, a memory 320, and a communication unit 330;
the memory 320 stores machine-readable instructions executable by the processor 310, and when the terminal is running, the processor 310 communicates with the memory 320 through the communication unit 330;
wherein the processor 310 executes the machine-readable instructions to perform the methods of the various aspects described above.
The components of the server shown in the figures are not meant to be limiting, and may be in a bus configuration, a star configuration, more or less components than those shown, some components in combination, or a different arrangement of components, as will be appreciated by those skilled in the art.
The memory 320 may be used for storing instructions executed by the processor 310, and the memory 320 may be implemented by any type of volatile or non-volatile storage terminal or combination thereof, such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The execution instructions in the memory 320, when executed by the processor 310, enable the electronic device to perform some or all of the steps in the above-described method embodiments.
The processor 310 is a control center of the storage terminal, connects various parts of the entire electronic terminal using various interfaces and lines, and performs various functions of the electronic terminal and/or processes data by operating or executing software programs and/or modules stored in the memory 320 and calling data stored in the memory. The processor may be composed of an Integrated Circuit (IC), for example, a single packaged IC, or a plurality of packaged ICs connected with the same or different functions. For example, the processor 310 may include only a Central Processing Unit (CPU). In the embodiments of the present application, the CPU may be a single arithmetic core or may include multiple arithmetic cores.
A communication unit 330, configured to establish a communication channel so that the storage terminal can communicate with other terminals. And receiving user data sent by other terminals or sending the user data to other terminals.
The present application also provides a computer storage medium that may store a program that, when executed, may include some or all of the steps in the embodiments provided herein. The storage medium may be a magnetic disk, an optical disk, a read only memory ROM or a Random Access Memory (RAM).
According to the scheme, the number of the transaction execution queues is increased along with the increase of the production nodes, the multi-queue transaction is executed in parallel, the transaction throughput of the system can be greatly improved, and the transaction processing efficiency of the whole system can be improved to a certain extent due to the increase of the number of the nodes.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present application, and shall be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (8)

1. The method for executing transactions in a block chain in parallel is characterized by comprising the following steps:
A. performing different processing on different types of operations on a state library in a block chain;
B. grouping the transactions in the block chain according to the acceptance nodes to obtain a plurality of transaction queues, and executing the transactions of the plurality of queues in parallel;
C. voting the transaction execution result by all block chain production nodes, and achieving transaction consensus according to the voting result;
D. the transactions that have agreed are packaged into blocks.
2. The method of claim 1, wherein step a comprises:
when adding the values of the block chain state library, actually adding the state library after each node achieves successful consensus on the transaction; when the value of the state base is subtracted, the subtraction operation is firstly carried out on the state base, and if the transaction achieves the failure consensus, the rollback operation is carried out.
3. The method of claim 2, wherein step a further comprises:
the modified record is locked when the state value in the state library in the blockchain is operated.
4. The method for parallel execution of transactions in a blockchain according to claim 1, 2 or 3, wherein the step B specifically comprises:
b1, the acceptance node receives the transaction of the client, adds the transaction into the current node queue, codes and signs the transaction according to the execution sequence after the transaction is successfully executed, and broadcasts the transaction signed by the node to other production nodes;
b2, receiving the ordered and signed transactions sent by other nodes, adding the transactions into different transaction queues according to different receiving nodes, and executing the transactions in sequence according to the ordering sequence;
b3, executing the transactions of the plurality of queues in parallel.
5. The method for parallel execution of transactions in a blockchain according to claim 1, 2 or 3, wherein the step C specifically comprises:
c1, each block chain node signs the execution result after the transaction is executed, and broadcasts the execution result to other nodes;
c2, after each block chain node receives the signature of other nodes on the transaction execution result, performing consensus calculation according to the execution result of each node;
and C3, according to the result of the consensus, executing confirmation or rollback operation on the transaction.
6. Parallel execution device of transaction in block chain, characterized by, include:
the processing module is used for carrying out different processing on different types of operations on the state library in the block chain;
the execution module is used for grouping the transactions in the block chain according to the receiving nodes to obtain a plurality of transaction queues, and the transactions of the queues are executed in parallel;
the consensus module is used for voting the transaction execution result by all the blockchain production nodes and achieving transaction consensus according to the voting result;
and the packaging module is used for packaging the transaction which has agreed into the block.
7. An electronic device, comprising:
a processor, a memory and a communication unit;
the memory stores machine-readable instructions executable by the processor, the processor and the memory communicate via the communication unit when the terminal is operating;
wherein the processor executes the machine readable instructions to perform the method of any of claims 1-5.
8. A computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, which computer program, when being executed by a processor, performs the method of any one of claims 1-5.
CN201911413971.8A 2019-12-31 2019-12-31 Method and device for parallel execution of transactions in block chain, electronic equipment and storage medium Pending CN111240831A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911413971.8A CN111240831A (en) 2019-12-31 2019-12-31 Method and device for parallel execution of transactions in block chain, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911413971.8A CN111240831A (en) 2019-12-31 2019-12-31 Method and device for parallel execution of transactions in block chain, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN111240831A true CN111240831A (en) 2020-06-05

Family

ID=70872913

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911413971.8A Pending CN111240831A (en) 2019-12-31 2019-12-31 Method and device for parallel execution of transactions in block chain, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111240831A (en)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111932257A (en) * 2020-08-18 2020-11-13 工银科技有限公司 Block chain parallelization processing method and device
CN112184439A (en) * 2020-09-28 2021-01-05 北京八分量信息科技有限公司 Decentralized transaction method and device based on node sequencing and related products
CN112256476A (en) * 2020-09-27 2021-01-22 陕西医链区块链集团有限公司 Data operation method, device, equipment and medium based on block chain
CN112884588A (en) * 2021-04-30 2021-06-01 支付宝(杭州)信息技术有限公司 Block chain transaction execution method, block chain node and control device
CN112883067A (en) * 2021-04-30 2021-06-01 支付宝(杭州)信息技术有限公司 Block chain transaction execution method, block chain node and control device
CN112988819A (en) * 2021-04-30 2021-06-18 支付宝(杭州)信息技术有限公司 Block chain transaction execution method, block chain node and control device
CN113744063A (en) * 2021-11-04 2021-12-03 支付宝(杭州)信息技术有限公司 Method and device for executing transaction in block chain
CN115150409A (en) * 2022-06-29 2022-10-04 蚂蚁区块链科技(上海)有限公司 Method for executing transaction in block chain system, block chain system and node

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104486401A (en) * 2014-12-11 2015-04-01 中铁程科技有限责任公司 Partitioned data control method and system
CN107451175A (en) * 2017-05-23 2017-12-08 阿里巴巴集团控股有限公司 A kind of data processing method and equipment based on block chain
CN107678865A (en) * 2017-09-20 2018-02-09 中国银行股份有限公司 The verification method and system of block chain based on transaction packet
CN108846659A (en) * 2018-06-13 2018-11-20 深圳前海微众银行股份有限公司 Transfer account method, device and storage medium based on block chain
CN109472610A (en) * 2018-11-09 2019-03-15 福建省农村信用社联合社 A kind of bank transaction is counter to cheat method and system, equipment and storage medium
CN110135985A (en) * 2019-04-04 2019-08-16 杭州抖音科技有限公司 A kind of parallel execution method and system traded on block chain
US20190287101A1 (en) * 2018-12-28 2019-09-19 Alibaba Group Holding Limited Parallel execution of transactions in a blockchain network

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104486401A (en) * 2014-12-11 2015-04-01 中铁程科技有限责任公司 Partitioned data control method and system
CN107451175A (en) * 2017-05-23 2017-12-08 阿里巴巴集团控股有限公司 A kind of data processing method and equipment based on block chain
CN107678865A (en) * 2017-09-20 2018-02-09 中国银行股份有限公司 The verification method and system of block chain based on transaction packet
CN108846659A (en) * 2018-06-13 2018-11-20 深圳前海微众银行股份有限公司 Transfer account method, device and storage medium based on block chain
CN109472610A (en) * 2018-11-09 2019-03-15 福建省农村信用社联合社 A kind of bank transaction is counter to cheat method and system, equipment and storage medium
US20190287101A1 (en) * 2018-12-28 2019-09-19 Alibaba Group Holding Limited Parallel execution of transactions in a blockchain network
CN110135985A (en) * 2019-04-04 2019-08-16 杭州抖音科技有限公司 A kind of parallel execution method and system traded on block chain

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111932257A (en) * 2020-08-18 2020-11-13 工银科技有限公司 Block chain parallelization processing method and device
CN111932257B (en) * 2020-08-18 2023-10-24 中国工商银行股份有限公司 Block chain parallelization processing method and device
CN112256476A (en) * 2020-09-27 2021-01-22 陕西医链区块链集团有限公司 Data operation method, device, equipment and medium based on block chain
CN112256476B (en) * 2020-09-27 2024-04-16 陕西医链区块链集团有限公司 Data operation method, device, equipment and medium based on block chain
CN112184439A (en) * 2020-09-28 2021-01-05 北京八分量信息科技有限公司 Decentralized transaction method and device based on node sequencing and related products
CN112884588A (en) * 2021-04-30 2021-06-01 支付宝(杭州)信息技术有限公司 Block chain transaction execution method, block chain node and control device
CN112883067A (en) * 2021-04-30 2021-06-01 支付宝(杭州)信息技术有限公司 Block chain transaction execution method, block chain node and control device
CN112988819A (en) * 2021-04-30 2021-06-18 支付宝(杭州)信息技术有限公司 Block chain transaction execution method, block chain node and control device
CN112988819B (en) * 2021-04-30 2021-08-20 支付宝(杭州)信息技术有限公司 Block chain transaction execution method, block chain node and control device
CN113744063A (en) * 2021-11-04 2021-12-03 支付宝(杭州)信息技术有限公司 Method and device for executing transaction in block chain
CN115150409A (en) * 2022-06-29 2022-10-04 蚂蚁区块链科技(上海)有限公司 Method for executing transaction in block chain system, block chain system and node

Similar Documents

Publication Publication Date Title
CN111240831A (en) Method and device for parallel execution of transactions in block chain, electronic equipment and storage medium
CN107797854B (en) Transaction file processing method and device, storage medium and computer equipment
CN109271359B (en) Log information processing method and device, electronic equipment and readable storage medium
CN109101416B (en) Kernel fault injection method and electronic equipment
CN111932257B (en) Block chain parallelization processing method and device
CN110162344B (en) Isolation current limiting method and device, computer equipment and readable storage medium
CN110554938B (en) BIOS (basic input output System) testing method, system, terminal and storage medium based on script set
CN112181522A (en) Data processing method and device and electronic equipment
CN110635962A (en) Abnormity analysis method and device for distributed system
CN110554917A (en) method, system, terminal and storage medium for efficiently traversing large data volume set
CN111241594B (en) Method, device, computer equipment and storage medium for signing transaction information
CN111078510A (en) Method and device for recording task processing progress
CN111176917B (en) Method, system, terminal and storage medium for testing stability of CPU SST-BF function
CN111597093B (en) Exception handling method, device and equipment thereof
CN112003730A (en) Method, system, terminal and storage medium for rapid cluster deployment
CN115686789A (en) Discrete event parallel processing method, terminal equipment and storage medium
CN110347471B (en) Hierarchical display component system, display component calling method and device
CN111737274A (en) Transaction data processing method and device and server
CN113626333A (en) Automatic interface testing method and device
CN113419949A (en) Data processing abnormity detection method, device, equipment and storage medium
US10102052B2 (en) Dumping resources
CN112491732A (en) Storage network congestion management method, system, terminal and storage medium
CN111199483A (en) Block chain transaction execution method and device, electronic equipment and storage medium
CN111984512B (en) Storage system resource competition simulation test method, system, terminal and storage medium
CN111061562B (en) Software collaborative packaging method, system, terminal and storage medium

Legal Events

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