Block output method and device in block chain consensus algorithm

文档序号:1738612 发布日期:2019-12-20 浏览:16次 中文

阅读说明:本技术 一种区块链共识算法中的出块方法和装置 (Block output method and device in block chain consensus algorithm ) 是由 叶嘉雨 于 2019-08-19 设计创作,主要内容包括:本说明书实施例公开了一种区块链共识算法中出块方法和装置,该方法包括:在共识算法的出块过程中,充分利用多核系统,并行执行交易执行操作以及交易持久化操作,并在交易执行成功且交易持久化成功之后,并行执行提案区块的内容持久化操作以及交易结果持久化操作,从而提升出块速度,提高共识效率。(The embodiment of the specification discloses a block outlet method and a block outlet device in a block chain consensus algorithm, wherein the method comprises the following steps: in the block-out process of the consensus algorithm, a multi-core system is fully utilized to execute transaction execution operation and transaction persistence operation in parallel, and after the transaction execution is successful and the transaction persistence is successful, the content persistence operation and the transaction result persistence operation of the proposal block are executed in parallel, so that the block-out speed is increased, and the consensus efficiency is improved.)

1. A block-out method in a block chain consensus algorithm is applied to a Byzantine consensus algorithm protocol, and the method comprises the following steps:

proposing a block, broadcasting to the block chain network for consensus;

after the consensus is achieved, executing transaction execution operation and transaction persistence operation in parallel;

after the transaction execution is successful and the transaction persistence is successful, the content persistence operation and the transaction result persistence operation of the proposal block are executed in parallel.

2. The method of claim 1, wherein the transaction execution operation and the transaction persistence operation are executed in parallel, and specifically comprises:

and executing all the transactions which have completed the consensus ranking in turn, and meanwhile persisting other transactions except the transaction which is executed in all the transactions.

3. The method of claim 2, further comprising:

and meanwhile, the execution result after the transaction is executed is persisted, wherein the execution result is used for representing whether the transaction is executed successfully or not.

4. The method of claim 1, wherein the content persistence operation and the transaction result persistence operation of the proposal block are performed in parallel, and the method further comprises:

and persisting the contents of the proposal block constructed based on the transaction result to a database, and persisting the transaction receipt and the transaction position.

5. The method of claim 4, persisting the contents of the proposal block constructed based on the transaction results to a database, comprising:

and persisting the block head of the proposal block constructed based on the transaction result to the database.

6. The method of claim 4 or 5, if the content persistence operation of the proposal block is successfully performed, waiting for a consensus of the next block;

otherwise, the transaction execution operation and the transaction persistence operation are executed again in parallel, and after the transaction execution is successful and the transaction persistence is successful, the next block is waited for consensus.

7. The method of claim 4 or 5, if the execution of the transaction result persistence operation is successful, waiting for a consensus of the next chunk;

otherwise, the transaction execution operation and the transaction persistence operation are executed again in parallel, and after the transaction execution is successful and the transaction persistence is successful, the next block is waited for consensus.

8. A block output device in a block chain consensus algorithm is applied to a Byzantine consensus algorithm protocol, and the device comprises:

the proposal module is used for proposing a block and broadcasting the block to the block chain network for consensus;

the first execution module is used for executing transaction execution operation and transaction persistence operation in parallel after the consensus is achieved;

and the second execution module is used for executing the content persistence operation and the transaction result persistence operation of the proposal block in parallel after the transaction is successfully executed and the transaction is persisted to be successful.

9. The apparatus of claim 8, wherein the first execution module is specifically configured to:

and executing all the transactions which have completed the consensus ranking in turn, and meanwhile persisting other transactions except the transaction which is executed in all the transactions.

10. The apparatus of claim 8, wherein the second execution module is specifically configured to:

and persisting the contents of the proposal block constructed based on the transaction result to a database, and persisting the transaction receipt and the transaction positioning.

11. An electronic device, comprising:

a processor; and

a memory arranged to store computer executable instructions that, when executed, cause the processor to:

proposing a block, broadcasting to the block chain network for consensus;

after the consensus is achieved, executing transaction execution operation and transaction persistence operation in parallel;

after the transaction execution is successful and the transaction persistence is successful, the content persistence operation and the transaction result persistence operation of the proposal block are executed in parallel.

12. A computer-readable storage medium storing one or more programs that, when executed by an electronic device including a plurality of application programs, cause the electronic device to:

proposing a block, broadcasting to the block chain network for consensus;

after the consensus is achieved, executing transaction execution operation and transaction persistence operation in parallel;

after the transaction execution is successful and the transaction persistence is successful, the content persistence operation and the transaction result persistence operation of the proposal block are executed in parallel.

Technical Field

The present disclosure relates to the field of computer software technologies, and in particular, to a block output method and apparatus in a block chain consensus algorithm.

Background

At present, consensus protocols are considered as the core content of blockchain technology. The consensus protocol plays a crucial role no matter the design of transaction processing capacity, expansibility influence or incentive model of the blockchain platform.

Consensus protocols can be simply divided into: the two major protocols, the Proof of Work (PoW) consensus protocol and the Byzantine Fault Tolerance (BFT) consensus protocol, have been generated since the birth of bitcoin. The block-out process in the consensus mechanism of the BFT consensus protocol generally includes the following three stages:

1. the consensus node proposes a block and broadcasts the block to the whole network consensus;

2. the agreement is achieved, and the transaction in the proposal block is executed in series;

3. and storing the content of the proposal block, the transaction, the execution result and the transaction result into a database.

In the existing block output scheme, transaction execution and various storage operations in the above stages are executed serially, the storage operation can be executed only after the transaction execution operation is finished, and the next stage can be entered after one stage is finished, so that the block output speed is limited, the block output time is long, and the consensus efficiency is influenced.

Disclosure of Invention

An object of the embodiments of the present disclosure is to provide a block output method and apparatus in a block chain consensus algorithm, so as to effectively increase the block output speed in the block chain consensus algorithm and improve the consensus efficiency.

In order to solve the above technical problem, the embodiments of the present specification are implemented as follows:

in a first aspect, a block output method in a blockchain consensus algorithm is provided, which is applied to a byzantine consensus algorithm protocol, and the method includes:

proposing a block, broadcasting to the block chain network for consensus;

after the consensus is achieved, executing transaction execution operation and transaction persistence operation in parallel;

after the transaction execution is successful and the transaction persistence is successful, the content persistence operation and the transaction result persistence operation of the proposal block are executed in parallel.

In a second aspect, a block output apparatus in a blockchain consensus algorithm is provided, where the apparatus is applied in a byzantine consensus algorithm protocol, and the apparatus includes:

the proposal module is used for proposing a block and broadcasting the block to the block chain network for consensus;

the first execution module is used for executing transaction execution operation and transaction persistence operation in parallel after the consensus is achieved;

and the second execution module is used for executing the content persistence operation and the transaction result persistence operation of the proposal block in parallel after the transaction is successfully executed and the transaction is persisted to be successful.

In a third aspect, an electronic device is provided, including:

a processor; and

a memory arranged to store computer executable instructions that, when executed, cause the processor to:

proposing a block, broadcasting to the block chain network for consensus;

after the consensus is achieved, executing transaction execution operation and transaction persistence operation in parallel;

after the transaction execution is successful and the transaction persistence is successful, the content persistence operation and the transaction result persistence operation of the proposal block are executed in parallel.

In a fourth aspect, a computer-readable storage medium is presented, the computer-readable storage medium storing one or more programs that, when executed by an electronic device that includes a plurality of application programs, cause the electronic device to:

proposing a block, broadcasting to the block chain network for consensus;

after the consensus is achieved, executing transaction execution operation and transaction persistence operation in parallel;

after the transaction execution is successful and the transaction persistence is successful, the content persistence operation and the transaction result persistence operation of the proposal block are executed in parallel.

According to the technical scheme, in the block output process of the consensus algorithm, the multi-core system is fully utilized, transaction execution operation and transaction persistence operation are executed in parallel, and after the transaction execution is successful and the transaction persistence is successful, the content persistence operation and the transaction result persistence operation of the proposal block are executed in parallel, so that the block output speed is increased, and the consensus efficiency is improved.

Drawings

In order to more clearly illustrate the embodiments of the present specification or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, it is obvious that the drawings in the following description are only some embodiments described in the present specification, and for those skilled in the art, other drawings can be obtained according to the drawings without any creative effort.

Fig. 1 is a schematic diagram illustrating a block extracting method in a block chain consensus algorithm according to an embodiment of the present disclosure.

Fig. 2 is a second schematic diagram illustrating a block extracting method in a block chain consensus algorithm according to an embodiment of the present disclosure.

Fig. 3 is a schematic structural diagram of an electronic device provided in an embodiment of the present specification.

Fig. 4 is a schematic structural diagram of a block output apparatus in a block chain consensus algorithm according to an embodiment of the present disclosure.

Detailed Description

In order to make those skilled in the art better understand the technical solutions in the present specification, the technical solutions in the embodiments of the present specification will be clearly and completely described below with reference to the drawings in the embodiments of the present specification, and it is obvious that the described embodiments are only a part of the embodiments of the present specification, and not all of the embodiments. All other embodiments obtained by a person skilled in the art based on the embodiments in the present specification without any inventive step should fall within the scope of protection of the present specification.

13页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种数字货币的验证方法及系统

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!