CN111221639A - Block pipeline execution method of block chain platform - Google Patents
Block pipeline execution method of block chain platform Download PDFInfo
- Publication number
- CN111221639A CN111221639A CN202010022852.6A CN202010022852A CN111221639A CN 111221639 A CN111221639 A CN 111221639A CN 202010022852 A CN202010022852 A CN 202010022852A CN 111221639 A CN111221639 A CN 111221639A
- Authority
- CN
- China
- Prior art keywords
- thread task
- execution
- transaction
- transactions
- block
- 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
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/48—Program initiating; Program switching, e.g. by interrupt
- G06F9/4806—Task transfer initiation or dispatching
- G06F9/4843—Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
- G06F9/4881—Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION 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
- G06Q20/00—Payment architectures, schemes or protocols
- G06Q20/38—Payment protocols; Details thereof
- G06Q20/382—Payment protocols; Details thereof insuring higher security of transaction
- G06Q20/3827—Use of message hashing
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION 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/00—Finance; Insurance; Tax strategies; Processing of corporate or income taxes
- G06Q40/04—Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Business, Economics & Management (AREA)
- Software Systems (AREA)
- Accounting & Taxation (AREA)
- General Physics & Mathematics (AREA)
- Physics & Mathematics (AREA)
- Finance (AREA)
- General Engineering & Computer Science (AREA)
- Strategic Management (AREA)
- General Business, Economics & Management (AREA)
- Computer Security & Cryptography (AREA)
- Development Economics (AREA)
- Economics (AREA)
- Marketing (AREA)
- Technology Law (AREA)
- Advance Control (AREA)
Abstract
The invention discloses a block pipeline execution method of a block chain platform, which comprises the following steps: for a batch of transactions to be executed, the block chain platform firstly checks the tags of the transactions, then executes the transactions, then calculates the Hash in the world state, and generates blocks after the Hash and the execution result are subjected to subsequent consensus. Meanwhile, the first thread task, the second thread task and the third thread task can continuously execute the signature verification of the transaction, the execution of the transaction and the calculation of the Hash, namely the method realizes the pipeline execution of the block, and the block execution process is divided into a plurality of parts and then executed in parallel, thereby improving the execution efficiency of the block chain node.
Description
Technical Field
The invention relates to the field of design of a decentralized block chain block transaction execution process, in particular to a block pipeline execution method of a block chain platform.
Background
The blockchain is a novel decentralized protocol, can safely store digital currency transactions or other data, and information cannot be forged or falsified; the blocks are memory units, the block chain is formed by 'linking' the blocks, and the blocks contain information such as executed transaction, Hash value of the blocks, Hash value of the world state and the like. For the block chain platform, the received transactions are sequenced to obtain a batch of transactions, and the batch of transactions are executed and finally generate a block after result consensus.
The traditional block chain of alliances is serial in the execution of a block transaction, that is, the next block transaction cannot be processed until the block transaction is not completed. For most of current computers, the system has a plurality of cpu cores, and the current serial execution does not well utilize the characteristic, so that if the block transaction execution can be performed in parallel, the execution efficiency of a block chain can be greatly improved, the multi-core characteristic of the computer can be fully exerted, and the performance of the block chain can be improved.
Disclosure of Invention
Aiming at the problems in the prior art, the invention provides a block pipeline execution method of a block chain platform, which can split the block execution process, and execute all the processes in parallel, thereby fully playing the multi-core characteristic of a computer and improving the performance of the block chain platform.
The purpose of the invention is realized by the following technical scheme:
a block pipeline execution method of a block chain platform is characterized by comprising the following steps:
the method comprises the following steps: when the block chain platform is started, starting a first thread task, a second thread task and a third thread task, wherein the first thread task is used for verifying and signing a batch of transactions, the second thread task is used for executing the batch of transactions, and the third thread task is used for calculating the world state Hash after the execution of the batch of transactions is completed.
Step two: the block chain platform firstly enters a first thread task for a batch of transactions to be executed, checks the signature of the transaction, namely, verifies whether the signature of the transaction is legal, directly marks the transaction as an illegal transaction if the signature verification is illegal, skips a second thread task and a third thread task, and transmits the transaction which is legal for signature verification to a second thread task for executing the transaction;
step three: and the second thread task executes a batch of transactions thrown into by the first thread task, and the execution process executes real execution according to transaction contents, such as calling a virtual machine to execute a contract and modifying data on the block chain. And after the transaction execution is finished, transferring the result of the data modification on the block chain and the execution result to a third thread task.
Step four: and after receiving the result of block chain data modification, the third thread task calculates the Hash of the world state according to the result of block chain data modification to obtain the Hash value of the current world state, and then generates a block by carrying out subsequent consensus on the Hash and the execution result.
Furthermore, in the first step, three thread tasks must be started when the start of the blockchain platform is completed;
furthermore, in the second step, after the thread task of the transaction signature verification finishes the current batch of transaction signature verification and the transaction completed by signature verification is transmitted to the next thread task to be executed, the thread of the transaction signature verification can immediately perform signature verification of the next batch of transactions;
furthermore, in the third step, after the transaction execution thread finishes executing the transaction and hands over the result to the thread task of the world state Hash calculation, the transaction execution thread can immediately execute the next batch of transactions which are verified to be finished.
Furthermore, in the fourth step, after the world state Hash calculation thread processes the world state calculation after the execution of the current batch of transactions is finished, the world state calculation after the execution of the next batch of transactions can be immediately performed.
Compared with the prior art, the invention has the following beneficial effects: the block pipeline execution of the block chain platform is applied to the block chain platform with the block execution process, the block execution of the current block chain platform is completely executed in sequence, namely, one block is completely executed, and the next block can be executed after the next stage. Compared with the prior art, the method has the advantages that the execution process of the block is divided into a plurality of parts at finer granularity, and then the plurality of parts are executed in a pipeline in parallel. The invention can greatly improve the performance of the block chain platform by fully utilizing the multi-core characteristic of the computer.
Drawings
FIG. 1 is a time-space diagram of a block execution pipeline of the present invention.
Detailed Description
In order that the objects and effects of the invention will become more apparent, the invention will be described in detail with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Fig. 1 is a block execution pipeline space-time diagram of the present invention, which is a parallel execution method based on Java intelligent contracts, where the intelligent contracts include annotations called across contracts, and the method specifically includes the following steps:
the method comprises the following steps: when the block chain platform is started, starting a first thread task, a second thread task and a third thread task when the block chain platform is started, wherein the first thread task is used for verifying and signing a batch of transactions, the second thread task is used for executing the batch of transactions, and the third thread task is used for calculating the world state Hash after the execution of the batch of transactions is completed. The first thread task, the second thread task and the third thread task are started already when the block chain platform is started. Starting multiple threads is a precondition for parallelism.
Step two: the block chain platform firstly enters a first thread task for a batch of transactions to be executed, checks the signature of the transactions, namely, verifies whether the signature of the transactions is legal or not, directly marks the transactions as illegal transactions if the signature verification is illegal, skips a second thread task and a third thread task, and transmits the transactions with the signature verification being legal to a second thread task for executing the transactions.
The first thread task finishes the verification of the current batch of transactions, and after the transactions finished by verification are transmitted to the second thread task to be executed, the first thread task conducts verification of the next batch of transactions, so that verification can be conducted simultaneously, and verification and execution can be conducted in parallel.
Step three: and the second thread task executes a batch of transactions thrown into by the first thread task, and the execution process executes real execution according to transaction contents, such as calling a virtual machine to execute a contract and modifying data on the block chain. And after the transaction execution is finished, transferring the result of the data modification on the block chain and the execution result to a third thread task.
And after the second thread task finishes the execution of the transaction and the execution result is handed over to the third thread task, the second thread task executes the next batch of verified transactions.
Step four: and after receiving the result of block chain data modification, the third thread task calculates the Hash of the world state according to the result of block chain data modification to obtain the Hash value of the current world state, and then generates a block by carrying out subsequent consensus on the Hash and the execution result. And after the third thread task finishes processing the world state calculation after the current batch of transaction execution is finished, performing the world state calculation after the next batch of transaction execution is finished.
The invention divides the execution process of the block into a plurality of parts with finer granularity, then carries out pipeline parallel execution on the plurality of parts, and can greatly improve the performance of the block chain platform by fully utilizing the multi-core characteristic of the computer.
It will be understood by those skilled in the art that the foregoing is only a preferred embodiment of the present invention, and is not intended to limit the invention, and although the invention has been described in detail with reference to the foregoing examples, it will be apparent to those skilled in the art that various changes in the form and details of the embodiments may be made and equivalents may be substituted for elements thereof. All modifications, equivalents and the like which come within the spirit and principle of the invention are intended to be included within the scope of the invention.
Claims (5)
1. A block pipeline execution method of a block chain platform is characterized by comprising the following steps:
the method comprises the following steps: when the block chain platform is started, starting a first thread task, a second thread task and a third thread task, wherein the first thread task is used for verifying and signing a batch of transactions, the second thread task is used for executing the batch of transactions, and the third thread task is used for calculating the world state Hash after the execution of the batch of transactions is completed.
Step two: the block chain platform firstly enters a first thread task for a batch of transactions to be executed, checks the signature of the transaction, namely, verifies whether the signature of the transaction is legal, directly marks the transaction as an illegal transaction if the signature verification is illegal, skips a second thread task and a third thread task, and transmits the transaction which is legal for signature verification to a second thread task for executing the transaction;
step three: and the second thread task executes a batch of transactions thrown into by the first thread task, and the execution process executes real execution according to transaction contents, such as calling a virtual machine to execute a contract and modifying data on the block chain. And after the transaction execution is finished, transferring the result of the data modification on the block chain and the execution result to a third thread task.
Step four: and after receiving the result of block chain data modification, the third thread task calculates the Hash of the world state according to the result of block chain data modification to obtain the Hash value of the current world state, and then generates a block by carrying out subsequent consensus on the Hash and the execution result.
2. The block pipeline execution method of claim 1, wherein in step one, the first thread task, the second thread task, and the third thread task must be started when the start of the block chain platform is completed.
3. The block pipeline execution method of claim 1, wherein in step two, the first thread task finishes checking the current batch of transactions, and after the transactions finished with the checking are transmitted to the second thread task for execution, the first thread task checks the next batch of transactions.
4. The block pipeline execution method of claim 1, wherein in step three, the second thread task completes execution of the transaction, and after the execution result is handed over to the third thread task, the second thread task performs execution of the next verified transaction.
5. The block pipeline execution method of claim 1, wherein in step four, after the third thread task processes the world state calculation after the current batch transaction is finished, the world state calculation after the next batch transaction is finished is performed.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010022852.6A CN111221639A (en) | 2020-01-09 | 2020-01-09 | Block pipeline execution method of block chain platform |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010022852.6A CN111221639A (en) | 2020-01-09 | 2020-01-09 | Block pipeline execution method of block chain platform |
Publications (1)
Publication Number | Publication Date |
---|---|
CN111221639A true CN111221639A (en) | 2020-06-02 |
Family
ID=70828177
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010022852.6A Pending CN111221639A (en) | 2020-01-09 | 2020-01-09 | Block pipeline execution method of block chain platform |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111221639A (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111478772A (en) * | 2020-06-22 | 2020-07-31 | 杭州趣链科技有限公司 | Assembly line friendly signature and signature verification method, device and storage medium |
CN112131236A (en) * | 2020-09-21 | 2020-12-25 | 中国电子科技网络信息安全有限公司 | Novel block chain parallel processing performance optimization method |
CN112991067A (en) * | 2021-04-28 | 2021-06-18 | 支付宝(杭州)信息技术有限公司 | Block chain consensus method, device and system |
WO2023160088A1 (en) * | 2022-02-24 | 2023-08-31 | 蚂蚁区块链科技(上海)有限公司 | Method for processing blockchain transactions, and blockchain node and electronic device |
WO2023160092A1 (en) * | 2022-02-24 | 2023-08-31 | 蚂蚁区块链科技(上海)有限公司 | Method for processing blockchain transactions, and blockchain node and electronic device |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109285006A (en) * | 2018-09-20 | 2019-01-29 | 中链科技有限公司 | A kind of parallel proof processing method and processing device of block chain data |
CN109508337A (en) * | 2018-11-12 | 2019-03-22 | 杭州秘猿科技有限公司 | A kind of transaction is parallel to execute method, apparatus, electronic equipment and system |
CN110457123A (en) * | 2018-09-13 | 2019-11-15 | 腾讯科技(深圳)有限公司 | A kind of control method and device of block processes task |
CN110532038A (en) * | 2019-08-19 | 2019-12-03 | 杭州趣链科技有限公司 | A kind of parallel execution method based on Java intelligence contract |
-
2020
- 2020-01-09 CN CN202010022852.6A patent/CN111221639A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110457123A (en) * | 2018-09-13 | 2019-11-15 | 腾讯科技(深圳)有限公司 | A kind of control method and device of block processes task |
CN109285006A (en) * | 2018-09-20 | 2019-01-29 | 中链科技有限公司 | A kind of parallel proof processing method and processing device of block chain data |
CN109508337A (en) * | 2018-11-12 | 2019-03-22 | 杭州秘猿科技有限公司 | A kind of transaction is parallel to execute method, apparatus, electronic equipment and system |
CN110532038A (en) * | 2019-08-19 | 2019-12-03 | 杭州趣链科技有限公司 | A kind of parallel execution method based on Java intelligence contract |
Cited By (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111478772A (en) * | 2020-06-22 | 2020-07-31 | 杭州趣链科技有限公司 | Assembly line friendly signature and signature verification method, device and storage medium |
CN111478772B (en) * | 2020-06-22 | 2020-10-16 | 杭州趣链科技有限公司 | Assembly line friendly signature and signature verification method, device and storage medium |
CN112131236A (en) * | 2020-09-21 | 2020-12-25 | 中国电子科技网络信息安全有限公司 | Novel block chain parallel processing performance optimization method |
CN112131236B (en) * | 2020-09-21 | 2022-07-05 | 中国电子科技网络信息安全有限公司 | Novel block chain parallel processing performance optimization method |
CN112991067A (en) * | 2021-04-28 | 2021-06-18 | 支付宝(杭州)信息技术有限公司 | Block chain consensus method, device and system |
CN112991067B (en) * | 2021-04-28 | 2021-08-03 | 支付宝(杭州)信息技术有限公司 | Block chain consensus method, device and system |
WO2023160088A1 (en) * | 2022-02-24 | 2023-08-31 | 蚂蚁区块链科技(上海)有限公司 | Method for processing blockchain transactions, and blockchain node and electronic device |
WO2023160092A1 (en) * | 2022-02-24 | 2023-08-31 | 蚂蚁区块链科技(上海)有限公司 | Method for processing blockchain transactions, and blockchain node and electronic device |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111221639A (en) | Block pipeline execution method of block chain platform | |
CN110169013B (en) | Computer-implemented system and method for implementing complex functionality on blockchains | |
CN110532038B (en) | Parallel execution method based on Java intelligent contract | |
CN109033475A (en) | A kind of file memory method, device, equipment and storage medium | |
CN109951547B (en) | Transaction request parallel processing method, device, equipment and medium | |
CN111882435B (en) | Method and device for executing transaction in block chain | |
TWI719797B (en) | Storage and execution method and device of smart contract in blockchain and electronic equipment | |
CN102929585B (en) | A kind of batch processing method and system supporting the distributed data processing of many main frames | |
CN110569629A (en) | Binary code file tracing method | |
CN110968437A (en) | Method, device, equipment and medium for parallel execution of single contract based on Java intelligent contract | |
TW201220118A (en) | A method and a system for automatically analyzing and classifying a malicious program | |
CN113743950A (en) | Method for performing transactions in a blockchain, blockchain node and blockchain | |
CN110704464B (en) | Method and device for processing bifurcation problem | |
CN111800274B (en) | Verifiable calculation energy consumption optimization method based on block chain | |
US8752056B2 (en) | Running native code across single or multi-core hybrid processor achitecture | |
Milman et al. | BQ: A lock-free queue with batching | |
CN113421073A (en) | Method and apparatus for concurrently executing transactions in a blockchain | |
CN113743943B (en) | Method for executing transaction in block chain, main node and slave node | |
CN113744062B (en) | Method for performing transactions in a blockchain, blockchain node and blockchain | |
CN110490742B (en) | Transaction execution method and device in blockchain | |
WO2021180243A1 (en) | Machine learning-based method for optimizing image information recognition, and device | |
CN113743949B (en) | Method for performing transactions in a blockchain, master node and slave node | |
CN101295239A (en) | Instruction execution method of Java card virtual machine | |
CN110489430A (en) | A kind of source tracing method and its system signed and verified based on data block | |
Lewis et al. | Identifying similarities in TMBL programs with alignment to quicken their compilation for GPUs: computational intelligence on consumer games and graphics hardware |
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 |