Disclosure of Invention
An embodiment of the present disclosure is directed to a blockchain consensus method, system, node, and electronic device, which can reduce network bandwidth and overhead of storage space in TendermintBFT protocol consensus process.
In order to achieve the above object, the embodiments of the present specification are implemented as follows:
in a first aspect, a method of consensus of a blockchain is provided, comprising:
splitting proposed data of the round of consensus into data blocks corresponding to consensus backup nodes of the block chain based on an erasure coding algorithm when the round of consensus is initiated, wherein the block chain performs consensus by adopting TendermintBFT Bayesian proprietary protocol;
The consensus master node sends the data block split by the proposal data to the corresponding consensus backup node in the blockchain through Propose information in Propose stage of the TendermintBFT protocol;
The consensus backup node which receives the data blocks carries out erasure code verification on the data blocks provided by the consensus main node, so that the data blocks which are successfully subjected to erasure code verification are broadcast to other consensus backup nodes through Pre-vot messages in the Pre-vot stage of the TendermintBFT protocol;
And restoring the data blocks in the Pre-vot messages with at least N-2f numbers to the proposal data by the consensus backup node based on the erasure code algorithm so as to execute the consensus logic of the TendermintBFT protocol on the restored proposal data in the Pre-commit stage of the TendermintBFT protocol to complete the round of consensus, wherein N is the number of the consensus nodes of the block chain, f is the fault tolerance number of the consensus nodes set by the TendermintBFT protocol, and N is more than or equal to 3f+1.
In a second aspect, a blockchain system is provided, comprising a consensus primary node and a consensus backup node, wherein:
When the local round of consensus is initiated, the consensus master node splits the proposal data of the local round of consensus into data blocks corresponding to the consensus backup nodes of the blockchain based on an erasure coding algorithm, wherein the blockchain performs consensus by adopting TendermintBFT Bayesian protocol;
The consensus master node sends the data block split by the proposal data to the corresponding consensus backup node in the blockchain through Propose information in Propose stage of the TendermintBFT protocol;
The consensus backup node which receives the data blocks carries out erasure code verification on the data blocks provided by the consensus main node, so that the data blocks which are successfully subjected to erasure code verification are broadcast to other consensus backup nodes through Pre-vot messages in the Pre-vot stage of the TendermintBFT protocol;
and the consensus backup node restores the data blocks in the Pre-vot messages with at least N-2f numbers to the proposal data based on the erasure code algorithm, so as to execute the consensus logic of the TendermintBFT protocol on the restored proposal data in the Pre-commit stage of the TendermintBFT protocol to complete the round of consensus, wherein N is the number of the consensus nodes of the blockchain, f is the fault tolerance number of the consensus nodes set by the TendermintBFT protocol, and N is more than or equal to 3f+1.
In a third aspect, there is provided a blockchain node comprising:
The erasure code correction module is used for splitting the proposed data of the round of consensus into data blocks corresponding to the consensus backup nodes of the block chains based on an erasure code correction algorithm when the round of consensus is initiated and if the affiliated block chain nodes are the consensus master nodes, wherein the block chains adopt TendermintBFT Bayesian protocol for consensus;
The sending module is used for sending the data block split by the proposal data to the corresponding consensus backup node in the blockchain through Propose information in Propose stage of the TendermintBFT protocol if the affiliated blockchain node is the consensus master node;
The verification module is used for carrying out erasure code verification on the data block provided by the consensus master node if the affiliated blockchain node is the consensus backup node, so that the data block which is successfully subjected to erasure code verification is broadcasted to other consensus backup nodes through a Pre-volt message in the Pre-volt stage of the TendermintBFT protocol;
And the restoration module restores the data blocks in the Pre-vot messages with at least N-2f numbers to the proposed data based on the erasure coding algorithm if the block chain node is the consensus backup node, so as to execute the consensus logic of the TendermintBFT protocol on the restored proposed data in the Pre-commit stage of the TendermintBFT protocol to complete the round of consensus, wherein N is the number of the consensus nodes of the block chain, f is the fault tolerance number of the consensus nodes set by the TendermintBFT protocol, and N is more than or equal to 3f+1.
In a fourth aspect, an electronic device is provided comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, the computer program being executable by the processor to:
When the local round of consensus is initiated, if the local round of consensus is used as a consensus master node, splitting proposed data of the local round of consensus into data blocks corresponding to a consensus backup node of the block chain based on an erasure coding algorithm, wherein the block chain performs consensus by adopting TendermintBFT Bayesian and busy-family protocols;
If the proposed data is used as a consensus backup node, in Propose stage of TendermintBFT protocol, the data blocks split by the proposed data are sent to the corresponding consensus backup node in the blockchain through Propose information;
if the data block is used as a consensus backup node, performing erasure code verification on the data block provided by the consensus master node, and broadcasting the data block successfully subjected to erasure code verification to other consensus backup nodes through a Pre-vot message in the Pre-vot stage of the TendermintBFT protocol;
if the data blocks are used as the consensus backup nodes, based on the erasure coding algorithm, restoring the data blocks in the Pre-vot messages with at least N-2f numbers to the proposed data, and executing the consensus logic of the TendermintBFT protocol on the restored proposed data in the Pre-commit stage of the TendermintBFT protocol to complete the round of consensus, wherein N is the number of the consensus nodes of the blockchain, f is the fault tolerance number of the consensus nodes set by the TendermintBFT protocol, and N is more than or equal to 3f+1.
In a fifth aspect, there is provided a computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of:
When the local round of consensus is initiated, if the local round of consensus is used as a consensus master node, splitting proposed data of the local round of consensus into data blocks corresponding to a consensus backup node of the block chain based on an erasure coding algorithm, wherein the block chain performs consensus by adopting TendermintBFT Bayesian and busy-family protocols;
If the proposed data is used as a consensus backup node, in Propose stage of TendermintBFT protocol, the data blocks split by the proposed data are sent to the corresponding consensus backup node in the blockchain through Propose information;
if the data block is used as a consensus backup node, performing erasure code verification on the data block provided by the consensus master node, and broadcasting the data block successfully subjected to erasure code verification to other consensus backup nodes through a Pre-vot message in the Pre-vot stage of the TendermintBFT protocol;
if the data blocks are used as the consensus backup nodes, based on the erasure coding algorithm, restoring the data blocks in the Pre-vot messages with at least N-2f numbers to the proposed data, and executing the consensus logic of the TendermintBFT protocol on the restored proposed data in the Pre-commit stage of the TendermintBFT protocol to complete the round of consensus, wherein N is the number of the consensus nodes of the blockchain, f is the fault tolerance number of the consensus nodes set by the TendermintBFT protocol, and N is more than or equal to 3f+1.
Based on the scheme of the embodiment of the specification, when executing TendermintBFT consensus, the consensus master node of the blockchain splits the proposal data into data blocks corresponding to the consensus backup nodes by using an erasure coding algorithm, and sends the split data blocks to the corresponding consensus backup nodes. And then, the consensus backup node performs erasure code verification on the data blocks provided by the consensus master node based on erasure code technology, and forwards the data blocks to other consensus backup nodes after the verification is successful, so that each consensus backup node of the blockchain can restore the obtained data blocks to the proposal data through an erasure code algorithm after obtaining a certain number of data blocks, and the consensus logic is executed on the proposal data. In the whole scheme, the consensus master node only needs to send corresponding data blocks to the consensus backup nodes, and the consensus backup nodes mutually forward the respective data blocks, so that the transmission of the proposal data is shared, and the fault tolerance of the transmission of the proposal data is realized with smaller network bandwidth and memory space overhead.
Detailed Description
In order to make the technical solutions in the present specification better understood by those skilled in the art, 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 some embodiments of the present specification, not all embodiments. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are intended to be within the scope of the present disclosure.
As previously described, under the consensus mechanism of the current TendermintBFT protocol, the consensus master node needs to send redundant proposal data to each consensus backup node, so that the consensus backup node performs consensus logic on the proposal data. Redundant proposal data may occupy excessive network bandwidth and memory space for the consensus master. Therefore, the present document aims to provide an optimization scheme of TendermintBFT protocol, which can effectively reduce the network bandwidth and the storage space occupied by the transmission proposal data of the consensus master node in the consensus process.
FIG. 1 is a flow chart of a method of consensus of blockchains in an embodiment of the present description. The method shown in fig. 1 may be performed by a corresponding apparatus, comprising the steps of:
s102, when the block chain consensus master node initiates the local round of consensus, the proposed data of the local round of consensus is split into data blocks corresponding to the block chain consensus backup node based on an erasure coding algorithm, wherein the block chain performs consensus by adopting TendermintBFT Bayesian proprietary protocol.
Erasure Coding (EC) is a method of fault-tolerant protection of data by dividing the data into segments, expanding, encoding, and storing redundant data blocks in different locations, such as disks, storage nodes, or other geographical locations. From a data function perspective, the protection afforded by erasure codes can be expressed by the following equation n=k+m. The variable "k" represents the value of the original data or symbol. The variable "m" represents the value of the extra or redundant symbol added after a fault that provides protection. The variable "n" represents the total value of the symbols created after the erasure coding process. For example, in one EC 10/16 configuration, there are 6 additional symbols (variable m) added to 10 original symbols (variable k). The 16 data segments (variable n) may be spread over 16 drives, nodes or geographic locations, and the original file may be reconstructed from 10 verification segments. That is, even if 6 drives, nodes, or geographic locations are lost or unavailable, the original file may be restored. It can be seen that erasure codes require only a small amount of redundancy to achieve data recovery.
In the embodiment of the present disclosure, the erasure coding technique is used to split the proposed data to be consensus into data blocks corresponding to the consensus backup node, and then the data blocks are saved by the consensus backup node.
And S104, the consensus master node transmits the data block divided by the proposal data to the corresponding consensus backup node in the blockchain through Propose information in Propose stage of TendermintBFT protocol.
In the Propose phase of the conventional TendermintBFT protocol, the consensus master node sends a full amount of proposal data with redundancy to each consensus backup node via Propose messages. The transmission cost of the common-knowledge master node can be effectively reduced by only transmitting the corresponding data block to the common-knowledge backup node through the erasure coding algorithm.
It should be noted that the plurality of data blocks into which the proposed data is split may correspond to the common backup nodes of the blockchain one by one, or the number of the plurality of data blocks into which the proposed data is split is smaller than the number of the common backup nodes of the blockchain, and one common backup node corresponds to one data block at most. Thus, in this step, the consensus master node may, but need not, send a data block to each consensus backup node of the blockchain, depending on the algorithm settings of the erasure code.
And S106, the consensus backup node which receives the data blocks carries out erasure code verification on the data blocks provided by the consensus master node, so that the data blocks which are successfully subjected to erasure code verification are broadcast to other consensus backup nodes through Pre-vote messages in the Pre-vote stage of TendermintBFT protocols.
Specifically, the data block into which the proposal data is split corresponds to the merck tree path information obtained based on the erasure coding algorithm. The consensus master node also sends the merck tree path information matched with the data block split by the proposal data to the corresponding consensus backup node in the blockchain through Propose messages. In the step, the common backup node which receives the data block carries out the merck tree reconstruction on the data block provided by the common main node based on the erasure code algorithm, if the merck tree path information provided by the common node is matched with the reconstructed merck tree, the erasure code verification is successful, otherwise, the erasure code verification fails.
In addition, as a preferred scheme, if the consensus of the round of consensus is initiated before the consensus of the previous round, the consensus backup node is indicated to have cached the proposal data when the consensus of the previous round is executed, and at this time, the step can directly perform faster matching check based on the cached proposal data consensus master node provided data blocks to replace erasure code check. If the proposal data of the round of consensus is not initiated in the previous round of consensus, the consensus backup node which receives the data blocks carries out erasure code verification on the data blocks provided by the consensus master node.
S108, the consensus backup node point restores the data blocks in the Pre-vot messages with at least N-2f numbers to the proposal data based on the erasure code algorithm, so as to execute the consensus logic of TendermintBFT protocol to the restored proposal data in the Pre-commit stage of TendermintBFT protocol, and complete the round of consensus, wherein N is the number of the consensus nodes of the block chain, f is the fault tolerance number of the consensus nodes set by TendermintBFT protocol, and N is more than or equal to 3f+1.
Where N-2f reverts back to the minimum number of data blocks required to propose data.
Specifically, in this step, if the consensus backup node restores the extracted data based on the erasure coding algorithm, in the Pre-vot stage, a Pre-commit message is broadcasted to other consensus nodes of the blockchain, wherein when the present round of consensus generates N-f Pre-commit messages, the proposed data reaches a passing consensus.
Based on the consensus method shown in fig. 1, it can be known that in the scheme of the embodiment of the present disclosure, when the consensus master node of the blockchain performs the consensus of TendermintBFT, an erasure coding algorithm is used to split the proposed data into data blocks corresponding to the consensus backup nodes, and the split data blocks are sent to the corresponding consensus backup nodes. And then, the consensus backup node performs erasure code verification on the data blocks provided by the consensus master node based on erasure code technology, and forwards the data blocks to other consensus backup nodes after the verification is successful, so that each consensus backup node of the blockchain can restore the obtained data blocks to the proposal data through an erasure code algorithm after obtaining a certain number of data blocks, and the consensus logic is executed on the proposal data. In the whole scheme, the consensus master node only needs to send corresponding data blocks to the consensus backup nodes, and the consensus backup nodes mutually forward the respective data blocks, so that the transmission of the proposal data is shared, and the fault tolerance of the transmission of the proposal data is realized with smaller network bandwidth and memory space overhead.
The following describes the consensus method of the embodiments of the present specification in detail.
In the method of the embodiments of the present description, the blockchain performs consensus based on the TendermintBFT protocol. Let the number of common node of the block chain be N, the fault tolerance number of common node of the bayer is f, N > =3f+1. The corresponding consensus flow is as follows:
the proposed node in the blockchain initializes the height to be consensus hp, and other parameters, based on the current consensus block height. And initiating the round of consensus for the current height to be consensus. Consensus includes the following phases:
Stage Propose:
And each consensus node judges whether to be a consensus master node of the round of consensus according to the information consensus height hp and the consensus round roundp initiated by the round of consensus.
If the data block is used as a consensus master node, acquiring proposal data (firstly checking whether the previous round already has cache data, if yes, using the cache data, otherwise acquiring new proposal data), then performing (N-2 f, N) erasure coding on the proposal data to obtain data blocks corresponding to the consensus backup node and Merck path information (namely root hash value calculated by erasure coding) of the data blocks, and then in Propose stage, sending the data blocks split by the proposal data to the corresponding consensus backup node in a block chain through Propose messages < Propose, hp, roundp, r, bi, si, -1 >. Where i represents the i-th consensus backup node, si is a data block corresponding to the i-th consensus backup node, and bi is merck tree merkle path information for the i-th consensus backup node.
If the node is used as a consensus backup node, waiting to collect Propose data of the message, and checking Propose information in the message when receiving the message < Propose, hp, roundp, r, bi, si, -1> sent by the consensus master node. It should be appreciated that verifying the information in Propose messages includes performing erasure code verification based on si and bi.
Pre-vot stage:
If Propose messages pass the check, a Pre-vot message < Pre-vot, hp, roundp, r, bi, si > is broadcast to other consensus backup nodes, and if Propose messages do not pass the check, a Pre-vot nil message < Pre-vot, hp, roundp, nil, nil, nil > message is broadcast to other consensus backup nodes, where the Pre-vot nil message is used to vote for a null block.
When any consensus backup node receives N-F effective Pre-vot messages, performing erasure code calculation by using si in each Pre-vot message of at least N-2F, and restoring the proposal data.
Pre-commit phase:
If any consensus node gets valid proposal data, broadcasting Pre-commit message < Precommit, hp, roundp, r > to other consensus nodes, otherwise broadcasting Pre-commit nil message. The reason why the consensus backup node broadcasts the Pre-commit nil message may be that the consensus backup node does not collect the Pre-vot messages reaching N-F or the consensus backup node collects the Pre-vot messages reaching N-F, but the consensus backup node does not recover the valid proposal data through erasure code calculation.
Wherein, when the current round of consensus generates N-f Pre-commit messages, the proposal data reaches the passing consensus. When the present round of consensus generates f Pre-commit nil messages, the proposal data directly determines that failed consensus is reached.
In summary, the method of the embodiment of the present disclosure integrates the implementation of data fault-tolerant transmission based on erasure codes into TendermintBFT protocol, and compared with the conventional TendermintBFT protocol, the method does not increase extra signaling overhead, but obviously improves the transmission efficiency of the proposed data, and improves the consensus efficiency for TendermintBFT protocol consensus.
The above is an introduction to the method of the embodiments of the present specification. It will be appreciated that suitable modifications may be made without departing from the principles set forth herein above, and such modifications are intended to be considered within the scope of the embodiments of the present disclosure.
Corresponding to the consensus method shown in fig. 1, the embodiment of the present disclosure further provides a blockchain system. Fig. 2 is a block diagram of a blockchain system 200 of an embodiment of the present description, including a consensus primary node 210 and a plurality of consensus backup nodes 220. Wherein:
When the local round of consensus is initiated, the consensus master node 210 splits the proposed data of the local round of consensus into data blocks corresponding to the consensus backup nodes 220 of the blockchain based on an erasure coding algorithm, wherein the blockchain performs consensus by adopting TendermintBFT Bayesian and busy protocols;
At Propose stage of the TendermintBFT protocol, the consensus master node 210 sends the data block split by the proposal data to the corresponding consensus backup node 220 in the blockchain through Propose message;
The consensus backup node 220 that receives the data block performs erasure code verification on the data block provided by the consensus master node 210, so that in the Pre-vot stage of the TendermintBFT protocol, the data block that is successfully subjected to erasure code verification is broadcast to other consensus backup nodes 220 through a Pre-vot message;
The consensus backup node 220 restores the data blocks in the Pre-vot messages with at least N-2f numbers to the proposed data based on the erasure coding algorithm, so as to execute the consensus logic of the TendermintBFT protocol on the restored proposed data in the Pre-commit stage of the TendermintBFT protocol, and complete the round of consensus, where N is the number of consensus nodes of the blockchain, f is the fault tolerance number of the consensus nodes set by the TendermintBFT protocol, and N is greater than or equal to 3f+1.
In the blockchain system of the present embodiment, when the consensus master node 210 performs the consensus of TendermintBFT, the proposed data is split into data blocks corresponding to the consensus backup node 220 using an erasure coding algorithm, and the split data blocks are sent to the corresponding consensus backup node 220. Then, the consensus backup node 220 performs erasure code verification on the data blocks provided by the consensus master node 210 based on erasure code technology, and forwards the data blocks to other consensus backup nodes 220 after the verification is successful, so that each consensus backup node 220 of the blockchain can restore the obtained data blocks to the proposal data through erasure code algorithm after obtaining a certain number of data blocks, so as to execute consensus logic on the proposal data. In the whole scheme, the consensus master node 210 only needs to send corresponding data blocks to the consensus backup nodes 220, and the consensus backup nodes 220 forward the respective data blocks to each other, so that the transmission of the proposal data is shared, and the fault tolerance of the transmission of the proposal data is realized with smaller network bandwidth and memory space overhead.
Optionally, if the erasure code verification fails, the consensus backup node 220 that receives the data block broadcasts a Pre-vot nil message to other consensus nodes in the Pre-vot stage of the TendermintBFT protocol, where the Pre-vot nil message is used for voting the empty block.
Optionally, the consensus backup node 220 restores the data block in the obtained Pre-vot message back to the proposed data based on the erasure coding algorithm in the Pre-vot stage of the TendermintBFT protocol, including that the consensus backup node 220 quickly restores the data in the obtained Prevote message to the proposed data based on the erasure coding algorithm after obtaining at least N-f Prevote messages including self-provided.
Optionally, the consensus backup node 220 executes the consensus logic of the TendermintBFT protocol on the restored proposed data in the Pre-vote stage of the TendermintBFT protocol, including broadcasting a Pre-commit message to other consensus nodes of the blockchain in the Pre-vote stage of the TendermintBFT protocol if the consensus backup node 220 restores the proposed data based on the erasure coding algorithm, wherein when the current round of consensus generates N-f Pre-commit messages, the proposed data reaches a passing consensus.
Optionally, if the consensus backup node 220 fails to restore the extracted data, in the Pre-vot stage of the TendermintBFT protocol, a Pre-commit nil message is broadcasted to other consensus nodes of the blockchain, wherein when the present round of consensus generates f Pre-commit nil messages, the proposed data directly determines that failed consensus is reached.
Optionally, the data block split by the proposed data corresponds to merck tree path information obtained based on the erasure code algorithm, the common master node 210 further sends merck tree path information matched with the data block split by the proposed data to the corresponding common backup node 220 in the blockchain through Propose messages, the common backup node 220 receiving the data block performs erasure code verification on the data block provided by the common master node 210, and the method comprises that the common backup node 220 receiving the data block performs merck tree reconstruction on the data block provided by the common master node 210 based on the erasure code algorithm, if the merck tree path information provided by the common node is matched with the reconstructed merck tree, the erasure code verification is successful, otherwise, the erasure code verification fails.
Optionally, the receiving the data block consensus backup node 220 performs erasure code verification on the data block provided by the consensus master node 210, including performing erasure code verification on the data block provided by the consensus master node 210 by the receiving the data block consensus backup node 220 if the proposed data is not initiated in the previous round of consensus, or performing matching verification on the data block provided by the consensus master node 210 directly through the proposed data cached in the previous round of consensus to replace the erasure code verification.
It is obvious that the blockchain system of the embodiment of the present disclosure may be used as an execution body of the consensus method shown in fig. 1, so that the function implemented by the consensus method in fig. 1 can be implemented. Since the principle is the same, the description is not repeated here.
Corresponding to the consensus method shown in fig. 1, the embodiment of the present disclosure further provides a blockchain node. FIG. 3 is a block diagram of a blockchain node 300 of an embodiment of the present description, including:
The erasure code module 310 splits the proposed data of the round of consensus into data blocks corresponding to the consensus backup nodes of the blockchain based on an erasure code algorithm when the round of consensus is initiated and if the affiliated blockchain node is a consensus master node, wherein the blockchain performs consensus by adopting TendermintBFT Bayesian protocol;
The sending module 320, if the affiliated blockchain node is a consensus master node, sends the data block split by the proposed data to the corresponding consensus backup node in the blockchain through Propose message in Propose stage of the TendermintBFT protocol;
The verification module 330 performs erasure code verification on the data block provided by the consensus master node if the affiliated blockchain node is the consensus backup node, so that the data block successfully subjected to erasure code verification is broadcast to other consensus backup nodes through a Pre-vote message in the Pre-vote stage of the TendermintBFT protocol;
And the restoring module 340 restores the data blocks in the Pre-vot messages obtained by at least N-2f data blocks to the proposed data based on the erasure coding algorithm if the affiliated blockchain node is the consensus backup node, so as to execute the consensus logic of the TendermintBFT protocol on the restored proposed data in the Pre-commit stage of the TendermintBFT protocol to complete the round of consensus, wherein N is the number of the consensus nodes of the blockchain, f is the fault tolerance number of the consensus nodes set by the TendermintBFT protocol, and N is greater than or equal to 3f+1.
It is apparent that the blockchain node in the embodiments of the present disclosure may be a consensus master node or a consensus backup node in the consensus method shown in fig. 1, so that the function implemented by the consensus method in fig. 1 can be implemented. Since the principle is the same, the description is not repeated here.
Fig. 4 is a schematic structural view of an electronic device according to an embodiment of the present specification. Referring to fig. 4, at the hardware level, the electronic device includes a processor, and optionally an internal bus, a network interface, and a memory. The Memory may include a Memory, such as a Random-Access Memory (RAM), and may further include a non-volatile Memory (non-volatile Memory), such as at least 1 disk Memory. Of course, the electronic device may also include hardware required for other services.
The processor, network interface, and memory may be interconnected by an internal bus, which may be an ISA (Industry Standard Architecture ) bus, a PCI (PERIPHERAL COMPONENT INTERCONNECT, peripheral component interconnect standard) bus, or EISA (Extended Industry Standard Architecture ) bus, among others. The buses may be classified as address buses, data buses, control buses, etc. For ease of illustration, only one bi-directional arrow is shown in FIG. 4, but not only one bus or type of bus.
And the memory is used for storing programs. In particular, the program may include program code including computer-operating instructions. The memory may include memory and non-volatile storage and provide instructions and data to the processor.
The processor reads the corresponding computer program from the nonvolatile memory to the memory and then runs the computer program to form a consensus device on a logic level, wherein the consensus device can be a consensus master node or a consensus backup node of the block chain system, or can be a component in the consensus master node or the consensus backup node of the block chain system. The processor is used for executing the programs stored in the memory and is specifically used for executing the following operations:
When the local round of consensus is initiated, if the local round of consensus is used as a consensus master node, splitting proposed data of the local round of consensus into data blocks corresponding to a consensus backup node of the block chain based on an erasure coding algorithm, wherein the block chain performs consensus by adopting TendermintBFT Bayesian and busy-family protocols;
If the proposed data is used as a consensus backup node, in Propose stage of TendermintBFT protocol, the data blocks split by the proposed data are sent to the corresponding consensus backup node in the blockchain through Propose information;
if the data block is used as a consensus backup node, performing erasure code verification on the data block provided by the consensus master node, and broadcasting the data block successfully subjected to erasure code verification to other consensus backup nodes through a Pre-vot message in the Pre-vot stage of the TendermintBFT protocol;
if the data blocks are used as the consensus backup nodes, based on the erasure coding algorithm, restoring the data blocks in the Pre-vot messages with at least N-2f numbers to the proposed data, and executing the consensus logic of the TendermintBFT protocol on the restored proposed data in the Pre-commit stage of the TendermintBFT protocol to complete the round of consensus, wherein N is the number of the consensus nodes of the blockchain, f is the fault tolerance number of the consensus nodes set by the TendermintBFT protocol, and N is more than or equal to 3f+1.
The consensus method disclosed in the embodiment shown in fig. 1 of the present specification can be applied to a processor or implemented by a processor. The processor may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware in a processor or by instructions in the form of software. The Processor may be a general-purpose Processor including a central processing unit (Central Processing Unit, CPU), a network Processor (Network Processor, NP), etc., or may be a digital signal Processor (DIGITAL SIGNAL Processor, DSP), application SPECIFIC INTEGRATED Circuit (ASIC), field-Programmable gate array (Field-Programmable GATE ARRAY, FPGA) or other Programmable logic device, discrete gate or transistor logic device, discrete hardware components. The various methods, steps and logic blocks disclosed in the embodiments of this 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 the embodiments of the present specification may be embodied directly in hardware, in a decoded processor, or in a combination of hardware and software modules in a decoded processor. The software modules may be located in a random access memory, flash memory, read only memory, programmable read only memory, or electrically erasable programmable memory, registers, etc. as well known in the art. The storage medium is located in a memory, and the processor reads the information in the memory and, in combination with its hardware, performs the steps of the above method.
It should be understood that the electronic device of the embodiments of the present disclosure may implement the functions of the embodiment of the above-described consensus method shown in fig. 1. Since the principle is the same, the description is not repeated here.
Of course, in addition to the software implementation, the electronic device in this specification does not exclude other implementations, such as a logic device or a combination of software and hardware, that is, the execution subject of the following process is not limited to each logic unit, but may also be hardware or a logic device.
Furthermore, the embodiments of the present specification also propose a computer-readable storage medium storing one or more programs, the one or more programs comprising instructions, which when executed by a portable electronic device comprising a plurality of application programs, enable the portable electronic device to perform the method of the embodiment shown in fig. 1, and in particular to perform the method of:
When the local round of consensus is initiated, if the local round of consensus is used as a consensus master node, splitting proposed data of the local round of consensus into data blocks corresponding to a consensus backup node of the block chain based on an erasure coding algorithm, wherein the block chain performs consensus by adopting TendermintBFT Bayesian and busy-family protocols;
If the proposed data is used as a consensus backup node, in Propose stage of TendermintBFT protocol, the data blocks split by the proposed data are sent to the corresponding consensus backup node in the blockchain through Propose information;
if the data block is used as a consensus backup node, performing erasure code verification on the data block provided by the consensus master node, and broadcasting the data block successfully subjected to erasure code verification to other consensus backup nodes through a Pre-vot message in the Pre-vot stage of the TendermintBFT protocol;
if the data blocks are used as the consensus backup nodes, based on the erasure coding algorithm, restoring the data blocks in the Pre-vot messages with at least N-2f numbers to the proposed data, and executing the consensus logic of the TendermintBFT protocol on the restored proposed data in the Pre-commit stage of the TendermintBFT protocol to complete the round of consensus, wherein N is the number of the consensus nodes of the blockchain, f is the fault tolerance number of the consensus nodes set by the TendermintBFT protocol, and N is more than or equal to 3f+1.
It will be appreciated by those skilled in the art that embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, the present specification may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present description can take the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
The foregoing describes specific embodiments of the present disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims can be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
The foregoing is merely an example of the present specification and is not intended to limit the present specification. Various modifications and alterations to this specification will become apparent to those skilled in the art. Any modifications, equivalent substitutions, improvements, or the like, which are within the spirit and principles of the present description, are intended to be included within the scope of the claims of the present description. Moreover, all other embodiments obtained by those skilled in the art without making any inventive effort shall fall within the scope of protection of this document.