WO2023045533A1 - Consensus on blockchain - Google Patents

Consensus on blockchain Download PDF

Info

Publication number
WO2023045533A1
WO2023045533A1 PCT/CN2022/107791 CN2022107791W WO2023045533A1 WO 2023045533 A1 WO2023045533 A1 WO 2023045533A1 CN 2022107791 W CN2022107791 W CN 2022107791W WO 2023045533 A1 WO2023045533 A1 WO 2023045533A1
Authority
WO
WIPO (PCT)
Prior art keywords
consensus
data
tendermintbft
protocol
node
Prior art date
Application number
PCT/CN2022/107791
Other languages
French (fr)
Chinese (zh)
Inventor
李帅
Original Assignee
蚂蚁区块链科技(上海)有限公司
支付宝(杭州)信息技术有限公司
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 蚂蚁区块链科技(上海)有限公司, 支付宝(杭州)信息技术有限公司 filed Critical 蚂蚁区块链科技(上海)有限公司
Publication of WO2023045533A1 publication Critical patent/WO2023045533A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/08Error detection or correction by redundancy in data representation, e.g. by using checking codes
    • G06F11/10Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's
    • G06F11/1004Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's to protect a block of data words, e.g. CRC or checksum
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1448Management of the data involved in backup or backup restore
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1458Management of the backup or restore process
    • G06F11/1469Backup restoration techniques

Definitions

  • This document belongs to the field of blockchain technology, and in particular relates to a blockchain consensus method, system, nodes and electronic equipment.
  • TendermintBFT is one of the commonly used Byzantine fault-tolerant protocols.
  • the consensus master node needs to send the proposed data (transaction set) to the consensus backup node.
  • the consensus master node needs to send redundant proposed data. Redundant proposal data will cause the consensus stage to occupy too much network bandwidth and storage space of the consensus master node.
  • the purpose of the embodiments of this specification is to provide a blockchain consensus method, system, nodes and electronic equipment, which can reduce the overhead of network bandwidth and storage space during the consensus process of the TendermintBFT protocol.
  • a blockchain consensus method including: when the consensus master node of the blockchain initiates the current round of consensus, based on the erasure code algorithm, the proposed data of the current round of consensus is split into The data block corresponding to the consensus backup node of the chain, wherein, the blockchain uses the TendermintBFT Byzantine protocol for consensus; the consensus master node splits the proposed data into The data block is sent to the corresponding consensus backup node in the blockchain; the consensus backup node that receives the data block performs erasure code verification on the data block provided by the consensus master node, so that it can be verified in the Pre In the -vote stage, broadcast the data block with successful erasure code verification to other consensus backup nodes through the pre-vote message; the consensus backup node will obtain at least N-2f pre-vote messages based on the erasure code algorithm The data block is restored back to the proposed data, so that in the Pre-commit phase of the TendermintBFT protocol, the consensus logic of the Tender
  • a blockchain system including: a consensus master node and a consensus backup node; wherein: the consensus master node splits the proposed data of the current round of consensus based on an erasure code algorithm when the current round of consensus is initiated into a data block corresponding to the consensus backup node of the block chain, wherein the block chain uses the TendermintBFT Byzantine protocol for consensus; the consensus master node passes the Propose message to the The data block divided into the proposed data is sent to the corresponding consensus backup node in the blockchain; the consensus backup node that receives the data block performs erasure code verification on the data block provided by the consensus master node, so as to In the Pre-vote stage of the TendermintBFT protocol, the data block whose erasure code verification is successful is broadcast to other consensus backup nodes through the pre-vote message; the consensus backup node will obtain at least N- The data blocks in the 2f pre-vote messages are restored to the proposed data, so that in the Pre-com
  • a blockchain node including: an erasure code module.
  • an erasure code module When the current round of consensus is initiated, if the blockchain node to which it belongs is the consensus master node, the proposal of this round of consensus will be converted based on the erasure code algorithm.
  • the data is split into data blocks corresponding to the consensus backup nodes of the blockchain, wherein the blockchain adopts the TendermintBFT Byzantine protocol for consensus;
  • the sending module if the blockchain node it belongs to is the consensus master node, In the Propose phase of the TendermintBFT protocol, the proposed data is split into data blocks and sent to the corresponding consensus backup node in the blockchain through the Propose message;
  • the verification module if the blockchain node it belongs to is a consensus backup node , the erasure code verification is performed on the data block provided by the consensus master node, so that in the Pre-vote stage of the TendermintBFT protocol, the data block whose erasure code verification succeeds is broadcast to other consensuses through the pre-vote message backup node; restore module, if the block chain node to which it belongs is a consensus backup node, based on the erasure code algorithm, restore the data blocks in the pre-vote messages obtained at least N-2f back to the proposed data,
  • an electronic device including: a memory, a processor, and a computer program stored on the memory and operable on the processor, the computer program being executed by the processor: in this round of consensus
  • the proposed data of the current round of consensus will be split into data blocks corresponding to the consensus backup nodes of the blockchain based on the erasure code algorithm, wherein the blockchain adopts TendermintBFT Byzantine protocol for consensus; if it is used as a consensus backup node, then in the Propose phase of the TendermintBFT protocol, the proposed data is split into data blocks and sent to the corresponding consensus backup node in the blockchain through the Propose message; If it is used as a consensus backup node, it will perform erasure code verification on the data blocks provided by the consensus master node, so that in the Pre-vote stage of the TendermintBFT protocol, the data that has been successfully verified by the erasure code through the pre-vote
  • a computer-readable storage medium is provided.
  • a computer program is stored on the computer-readable storage medium.
  • the computer program is executed by a processor, the following steps are implemented: when the current round of consensus is initiated, if the consensus When the master node, based on the erasure code algorithm, the proposed data of this round of consensus is split into data blocks corresponding to the consensus backup nodes of the blockchain, wherein the blockchain adopts the TendermintBFT Byzantine protocol for consensus; If it is used as a consensus backup node, in the Propose phase of the TendermintBFT protocol, the proposed data will be split into data blocks and sent to the corresponding consensus backup node in the blockchain through the Propose message; if it is used as a consensus backup node, Then perform erasure code verification on the data blocks provided by the consensus master node, so that in the Pre-vote stage of the TendermintBFT protocol, the data blocks with successful erasure code verification are broadcast to other consensus backups through the pre-vote message No
  • the consensus master node of the blockchain executes the consensus of TendermintBFT, it uses the erasure code algorithm to split the proposed data into data blocks corresponding to the consensus backup nodes, and the split data The block is sent to the corresponding consensus backup node.
  • the consensus backup node performs erasure code verification on the data blocks provided by the consensus master node based on the erasure code technology, and forwards the data block to other consensus backup nodes after the verification is successful, so that each consensus backup node of the blockchain After obtaining a certain number of data blocks, the obtained data blocks can be restored back to the proposed data through the erasure code algorithm to perform consensus logic on the proposed data.
  • the consensus master node only needs to send the corresponding data blocks to the consensus backup nodes, and the consensus backup nodes forward their respective data blocks to each other, so as to share the transmission of the proposed data, with a smaller network bandwidth and storage space Overhead, to achieve fault tolerance for transmitting proposed data.
  • Fig. 1 is a schematic flow chart of the blockchain consensus method provided by the embodiment of this specification.
  • Fig. 2 is a schematic structural diagram of the blockchain system provided by the embodiment of this specification.
  • Fig. 3 is a schematic structural diagram of a blockchain node provided by an embodiment of this specification.
  • FIG. 4 is a schematic structural diagram of an electronic device provided by an embodiment of this specification.
  • this document aims to provide an optimization scheme for the TendermintBFT protocol, which can effectively reduce the network bandwidth and storage space occupied by the consensus master node for transmitting proposed data during the consensus process.
  • Fig. 1 is a flow chart of the consensus method of the block chain in the embodiment of this specification. The method shown in FIG. 1 may be executed by corresponding devices below, and includes the following steps.
  • the consensus master node of the blockchain splits the proposed data of the current round of consensus into data blocks corresponding to the consensus backup nodes of the blockchain based on the erasure code algorithm.
  • the variable "k” represents the value of the original data or symbol.
  • the variable "m” represents the value of the extra or redundant symbols added after the failure to provide protection.
  • the variable "n” represents the total value of symbols created after the erasure coding process. For example, in an EC 10/16 configuration, 6 additional symbols (variable m) are added to the 10 original symbols (variable k).
  • the erasure code technology is used to split the proposed data to be consensus into data blocks corresponding to the consensus backup nodes, which are subsequently stored by the consensus backup nodes.
  • the consensus master node sends the data blocks into which the proposed data is split to the corresponding consensus backup node in the blockchain through the Propose message.
  • the consensus master node will send a full amount of redundant proposal data to each consensus backup node through the Propose message. In this step, only the corresponding data block is sent to the consensus backup node through the erasure code algorithm, which can effectively reduce the transmission overhead of the consensus master node.
  • the multiple data blocks into which the proposed data is split can correspond to the consensus backup nodes of the blockchain; or, the number of multiple data blocks into which the proposed data is split is smaller than the consensus backup nodes of the blockchain.
  • the number of nodes, a consensus backup node corresponds to at most one data block. Therefore, in this step, the consensus master node can but not necessarily send data blocks to each consensus backup node of the blockchain, which depends on the algorithm settings of the erasure code.
  • the consensus backup node that receives the data block performs erasure code verification on the data block provided by the consensus master node, so as to verify the successful erasure code of the data block through the pre-vote message in the Pre-vote stage of the TendermintBFT protocol Broadcast to other consensus backup nodes.
  • the data blocks into which the proposed data is split correspond to the Merkle tree path information obtained based on the erasure code algorithm.
  • the consensus master node also sends the Merkle tree path information matched by the data blocks that the proposed data is split into to the corresponding consensus backup node in the blockchain through the Propose message.
  • the consensus backup node that receives the data block reconstructs the Merkle tree on the data block provided by the consensus master node based on the erasure code algorithm. If the Merkle tree path information provided by the consensus node matches the reconstructed Merkle tree , the erasure code verification succeeds, otherwise the erasure code verification fails.
  • the consensus backup node if the proposed data of this round of consensus has been initiated in the previous round of consensus, it means that the consensus backup node has already cached the proposed data when executing the previous round of consensus. At this time, this step can directly Based on the cached proposed data consensus, the data blocks provided by the master node perform faster matching verification instead of erasure code verification. If the proposed data of this round of consensus has not been initiated in the previous round of consensus, the consensus backup node that receives the data block will perform erasure code verification on the data block provided by the consensus master node.
  • the consensus backup node restores the data blocks in the pre-vote messages obtained at least N-2f back to the proposed data, so as to restore the proposed data in the Pre-commit phase of the TendermintBFT protocol
  • the data executes the consensus logic of the TendermintBFT protocol to complete this round of consensus, where N is the number of consensus nodes in the blockchain, f is the fault-tolerant number of consensus nodes set by the TendermintBFT protocol, and N is greater than or equal to 3f+1.
  • N-2f is the minimum number of data blocks required to restore the proposed data.
  • the consensus backup node restores the mentioned data based on the erasure code algorithm, then in the Pre-vote stage, broadcast the Pre-commit message to other consensus nodes of the blockchain; The round of consensus generates N-f Pre-commit messages, and the proposed data reaches a consensus.
  • the consensus master node of the blockchain executes the TendermintBFT consensus, it uses the erasure code algorithm to split the proposed data into , and send the split data blocks to the corresponding consensus backup nodes.
  • the consensus backup node performs erasure code verification on the data blocks provided by the consensus master node based on the erasure code technology, and forwards the data block to other consensus backup nodes after the verification is successful, so that each consensus backup node of the blockchain After obtaining a certain number of data blocks, the obtained data blocks can be restored back to the proposed data through the erasure code algorithm to perform consensus logic on the proposed data.
  • the consensus master node only needs to send the corresponding data blocks to the consensus backup nodes, and the consensus backup nodes forward their respective data blocks to each other, so as to share the transmission of the proposed data, with a smaller network bandwidth and storage space Overhead, to achieve fault tolerance for transmitting proposed data.
  • the blockchain implements consensus based on the TendermintBFT protocol. Assuming that the number of consensus nodes in the blockchain is N, the number of fault-tolerant Byzantine consensus nodes is f, and N is greater than or equal to 3f+1.
  • the corresponding consensus process is as follows: the proposed node in the blockchain initializes the consensus height hp and other parameters according to the current consensus block height. For the current consensus height, initiate this round of consensus. Consensus includes the following stages.
  • Propose stage Each consensus node judges whether it is the consensus master node of this round of consensus according to the information consensus height hp and consensus round roundp initiated by this round of consensus.
  • verifying the information in the Propose message includes: performing erasure code verification based on si and bi.
  • Pre-vote stage If the Propose message passes the verification, broadcast the pre-vote message ⁇ Pre-vote, hp, roundp, r, bi, si> to other consensus backup nodes; if the Propose message fails the verification, broadcast the pre-vote message to other consensus backup nodes
  • the backup node broadcasts the pre-vote nil message ⁇ Pre-vote, hp, roundp, nil, nil, nil> message, where the pre-vote nil message is used to vote for empty blocks.
  • any consensus backup node when any consensus backup node receives N-F valid Pre-vote messages: use at least N-2f si in each Pre-vote message to perform erasure code calculation and restore the proposed data.
  • Pre-commit stage If any consensus node obtains valid proposal data, it broadcasts a Pre-commit message ⁇ Precommit, hp, roundp, r> to other consensus nodes; otherwise, it broadcasts a Pre-commit nil message.
  • the reason why the consensus backup node broadcasts the Pre-commit nil message may be that the consensus backup node has not collected N-F Pre-vote messages, or the consensus backup node has collected N-F Pre-vote messages, but through erasure code calculation Valid proposed data was not restored.
  • the proposed data when the current round of consensus generates N-f Pre-commit messages, the proposed data reaches a consensus.
  • the proposed data directly confirms that a failed consensus has been reached.
  • the method in the embodiment of this specification integrates data error-tolerant transmission based on erasure codes into the TendermintBFT protocol.
  • FIG. 2 is a structural diagram of a blockchain system 200 according to an embodiment of this specification, including: a consensus master node 210 and multiple consensus backup nodes 220 .
  • the consensus master node 210 when the consensus master node 210 initiates the current round of consensus, based on the erasure code algorithm, the proposal data of the current round of consensus is split into data blocks corresponding to the consensus backup node 220 of the blockchain, wherein the The block chain adopts the TendermintBFT Byzantine protocol for consensus; the consensus master node 210 sends the data blocks into which the proposed data is split to the corresponding block in the block chain through the Propose message in the Propose phase of the TendermintBFT protocol Consensus backup node 220; 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-vote stage of the TendermintBFT protocol, the pre-vote message will The data block with successful erasure code verification is broadcast to other consensus backup nodes 220; the consensus backup node 220 restores the data blocks in the pre-vote messages obtained at least N-2f based on
  • the consensus master node 210 when executing the TendermintBFT consensus, uses an erasure code algorithm to split the proposed data into data blocks corresponding to the consensus backup node 220, and split the The data block is sent to the corresponding consensus backup node 220.
  • the consensus backup node 220 performs erasure code verification on the data block provided by the consensus master node 210 based on the erasure code technology, and forwards the data block to other consensus backup nodes 220 after the verification is successful, so that each block chain
  • the consensus backup node 220 can restore the obtained data blocks back to the proposed data through an erasure code algorithm, so as to execute consensus logic on the proposed data.
  • the consensus master node 210 only needs to send the corresponding data block to the consensus backup node 220, and the consensus backup nodes 220 forward their respective data blocks to each other, so as to share the transmission of the proposed data, with a small network bandwidth and storage space overhead to achieve fault tolerance for transmitting proposed data.
  • the consensus backup node 220 that receives the data block fails to verify the erasure code, it will broadcast a pre-vote nil message to other consensus nodes during the Pre-vote phase of the TendermintBFT protocol, and the pre-vote nil Messages are used to vote for empty blocks.
  • the consensus backup node 220 restores the obtained data block in the pre-vote message back to the mentioned data based on the erasure code algorithm, including: consensus backup After the node 220 obtains at least N-f Prevote messages including those provided by itself, based on the erasure code algorithm, the data in the obtained Prevote messages are quickly restored to the proposed data.
  • the consensus backup node 220 executes the consensus logic of the TendermintBFT protocol on the restored proposed data in the Pre-vote phase of the TendermintBFT protocol, including: if the consensus backup node 220 is based on the erasure code algorithm To restore the mentioned data, broadcast Pre-commit messages to other consensus nodes of the blockchain during the Pre-vote phase of the TendermintBFT protocol; wherein, when the current round of consensus generates N-f Pre-commit messages, then The proposed data reaches a consensus of adoption.
  • the consensus backup node 220 fails to restore the mentioned data, then in the Pre-vote phase of the TendermintBFT protocol, broadcast a Pre-commit nil message to other consensus nodes of the blockchain; wherein, When the current round of consensus generates f Pre-commit nil messages, the proposed data directly confirms that a failed consensus has been reached.
  • the data block into which the proposed data is split corresponds to the Merkle tree path information obtained based on the erasure code algorithm, and the consensus master node 210 also splits the proposed data into The Merkle tree path information matched by the data block is sent to the corresponding consensus backup node 220 in the blockchain; the consensus backup node 220 that receives the data block performs erasure on the data block provided by the consensus master node 210 Code verification, including: the consensus backup node 220 that receives the data block performs Merkel tree reconstruction on the data block provided by the consensus master node 210 based on the erasure code algorithm, if the Merkle tree provided by the consensus node If the path information matches the reconstructed Merkle tree, the erasure code verification succeeds, otherwise the erasure code verification fails.
  • 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, including: if the proposed data is not initiated in the previous round of consensus, then receiving The consensus backup node 220 of the data block performs erasure code verification on the data block provided by the consensus master node 210; Data blocks are checked for matching instead of erasure code checking.
  • FIG. 3 is a structural diagram of a block chain node 300 in the embodiment of this specification, including: an erasure code module 310.
  • the erasure code algorithm will The proposed data of this round of consensus is split into data blocks corresponding to the consensus backup nodes of the blockchain, wherein the blockchain uses the TendermintBFT Byzantine protocol for consensus; the sending module 320, if the blockchain node it belongs to is When the consensus master node is in the Propose stage of the TendermintBFT protocol, the proposed data is split into data blocks and sent to the corresponding consensus backup node in the block chain through the Propose message; When the block chain node is a consensus backup node, the erasure code verification is performed on the data block provided by the consensus master node, so that in the Pre-vote stage of the Tender
  • the blockchain node in the embodiment of this specification can be the consensus master node or the consensus backup node in the consensus method shown in Figure 1, so it can realize the functions realized by the consensus method in Figure 1. Since the principle is the same, this article will not repeat them.
  • Fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present specification.
  • the electronic device includes a processor, and optionally also includes an internal bus, a network interface, and a memory.
  • the memory may include a memory, such as a high-speed random-access memory (Random-Access Memory, RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
  • RAM random-Access Memory
  • non-volatile memory such as at least one disk memory.
  • the electronic device may also include hardware required by other services.
  • the processor, the network interface and the memory can be connected to each other through an internal bus, which can be an ISA (Industry Standard Architecture, industry standard architecture) bus, a PCI (Peripheral Component Interconnect, peripheral component interconnection standard) bus or an EISA (Extended Industry Standard Architecture, extended industry standard architecture) bus, etc.
  • the bus can be divided into address bus, data bus, control bus and so on. For ease of representation, only one double-headed arrow is used in FIG. 4 , but it does not mean that there is only one bus or one type of bus.
  • Memory for storing programs.
  • the program may include program code, and the program code includes computer operation instructions.
  • Storage which can include internal memory and nonvolatile storage, provides instructions and data to the processor.
  • the processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it to form a consensus device on the logical level.
  • the consensus device can be the consensus master node or the consensus backup node of the above-mentioned blockchain system, or it can It is a component in the consensus master node or consensus backup node of the blockchain system.
  • the processor executes the program stored in the memory, and is specifically used to perform the following operations: when the current round of consensus is initiated, if it is used as the consensus master node, based on the erasure code algorithm, the proposed data of the current round of consensus is split into The data block corresponding to the consensus backup node of the blockchain, wherein, the blockchain adopts the TendermintBFT Byzantine protocol for consensus; if it is used as a consensus backup node, in the Propose stage of the TendermintBFT protocol, the Propose message will pass the The data block into which the proposed data is split is sent to the corresponding consensus backup node in the block chain; if it is used as a consensus backup node, the data block provided by the consensus master node is verified by erasure code to In the Pre-vote stage of the TendermintBFT protocol, the data blocks whose erasure code verification is successful are broadcast to other consensus backup nodes through the pre-vote message; if used as a consensus backup node, based on
  • a processor may be an integrated circuit chip with signal processing capabilities.
  • each step of the above method can be completed by an integrated logic circuit of hardware in a processor or an instruction in the form of software.
  • the above-mentioned processor can be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU), a network processor (Network Processor, NP), etc.; it can also be a digital signal processor (Digital Signal Processor, DSP), an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), field programmable gate array (Field-Programmable GateArray, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
  • DSP Digital Signal Processor
  • ASIC Application Specific Integrated Circuit
  • FPGA Field-Programmable GateArray
  • a general-purpose processor may be a microprocessor, or the processor may be any conventional processor, or the like.
  • the steps of the method disclosed in the embodiments of this specification may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor.
  • the software module can be located in a mature storage medium in the field such as random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, register.
  • the storage medium is located in the memory, and the processor reads the information in the memory, and completes the steps of the above method in combination with its hardware.
  • the electronic equipment in this specification does not exclude other implementations, such as logic devices or the combination of software and hardware, etc., that is to say, the execution subject of the following processing flow is not limited to each logic unit, It can also be a hardware or logic device.
  • the embodiment of this specification also proposes a computer-readable storage medium, where the computer-readable storage medium stores one or more programs, and the one or more programs include instructions.
  • the electronic device executes, it can make the portable electronic device execute the method of the embodiment shown in Figure 1, and is specifically used to perform the following method: when the current round of consensus is initiated, if it is used as the consensus master node, based on the erasure code algorithm, the The proposed data of this round of consensus is split into data blocks corresponding to the consensus backup nodes of the blockchain, wherein the blockchain adopts the TendermintBFT Byzantine protocol for consensus; In the Propose phase of the protocol, the proposed data is split into data blocks and sent to the corresponding consensus backup node in the blockchain through the Propose message; if it is used as a consensus backup node, the data blocks provided by the consensus master node Perform erasure code verification, so that in the Pre-vote stage of the TendermintBFT protocol, broadcast the data block with successful erasure code verification to other consensus backup

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Quality & Reliability (AREA)
  • Databases & Information Systems (AREA)
  • Computer Security & Cryptography (AREA)
  • Computing Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

Provided in the embodiments of the present description are a consensus method for a blockchain, and a system, a node and an electronic device. The method comprises: when the present round of consensus is initiated, a consensus master node splitting, on the basis of an erasure coding algorithm, propose data of the present round of consensus into data blocks corresponding to consensus backup nodes, wherein a blockchain performs consensus by using a TendermintBFT protocol; the consensus master node sending, in a propose stage, the split data blocks to the corresponding consensus backup nodes by means of propose messages; the consensus backup nodes that receive the data blocks performing erasure coding checking on the data blocks provided by the consensus master node, so as to broadcast, to the other consensus backup nodes, in a pre-vote stage and by means of pre-vote messages, the data blocks, the erasure coding checking of which is successful; and the consensus backup nodes restoring the data blocks in at least N-2f obtained pre-vote messages to the propose data on the basis of the erasure coding algorithm, so as to execute, in a pre-commit stage, consensus logic on the restored propose data, thereby completing consensus, wherein N is the number of consensus nodes of the blockchain, f is the number of tolerable faults of the consensus nodes, and N is greater than or equal to 3f+1.

Description

区块链的共识Blockchain Consensus 技术领域technical field
本文件属于区块链技术领域,尤其涉及一种区块链的共识方法、系统、节点及电子设备。This document belongs to the field of blockchain technology, and in particular relates to a blockchain consensus method, system, nodes and electronic equipment.
背景技术Background technique
现阶段,很多区块链系统基采用拜占庭容错(BFT,Byzantine FaultTolerant)算法完成共识。而TendermintBFT就是其中一种常用的拜占庭容错协议。TendermintBFT协议,在执行共识前,共识主节点需要将提议数据(交易集)发送给共识备份节点。为了保证提议数据的传输具有容错性,共识主节点需要发送冗余的提议数据。而冗余的提议数据则会导致共识阶段占用共识主节点过多的网络带宽和存储空间。At this stage, many blockchain systems basically use the Byzantine Fault Tolerant (BFT) algorithm to complete consensus. TendermintBFT is one of the commonly used Byzantine fault-tolerant protocols. In the TendermintBFT protocol, before the consensus is executed, the consensus master node needs to send the proposed data (transaction set) to the consensus backup node. In order to ensure that the transmission of proposed data is fault-tolerant, the consensus master node needs to send redundant proposed data. Redundant proposal data will cause the consensus stage to occupy too much network bandwidth and storage space of the consensus master node.
为此,当前亟需一种针对TendermintBFT协议的优化方案,能够有效减少共识过程中的网络带宽和存储空间的开销。For this reason, there is an urgent need for an optimization scheme for the TendermintBFT protocol, which can effectively reduce the overhead of network bandwidth and storage space during the consensus process.
发明内容Contents of the invention
本说明书实施例目的是提供一种区块链的共识方法、系统、节点及电子设备,能够减少TendermintBFT协议共识过程中的网络带宽和存储空间的开销。The purpose of the embodiments of this specification is to provide a blockchain consensus method, system, nodes and electronic equipment, which can reduce the overhead of network bandwidth and storage space during the consensus process of the TendermintBFT protocol.
为了实现上述目的,本说明书实施例是如下实现的。In order to achieve the above purpose, the embodiments of this specification are implemented as follows.
第一方面,提供一种区块链的共识方法,包括:区块链的共识主节点在本轮共识发起时,基于纠删码算法将本轮共识的提议数据拆分成与所述区块链的共识备份节点相对应的数据块,其中,所述区块链采用TendermintBFT拜占庭协议进行共识;所述共识主节点在所述TendermintBFT协议的Propose阶段,通过Propose消息将所述提议数据拆分成的数据块发送至所述区块链中对应的共识备份节点;接收到数据块的共识备份节点对所述共识主节点提供的数据块进行纠删码校验,以在所述TendermintBFT协议的Pre-vote阶段,通过pre-vote消息将纠删码校验成功的数据块广播至其他共识备份节点;共识备份节点基于所述纠删码算法,将获得至少N-2f个的pre-vote消息中的数据块还原回所述提议数据,以在所述TendermintBFT协议的Pre-commit阶段,对还原回的所述提议数据执行所述TendermintBFT协议的共识逻辑,完成本轮共识,其中,N为所述区块链的共识节点数量,f为所述TendermintBFT协议设置的共识节点的容错数,N大于等于3f+1。In the first aspect, a blockchain consensus method is provided, including: when the consensus master node of the blockchain initiates the current round of consensus, based on the erasure code algorithm, the proposed data of the current round of consensus is split into The data block corresponding to the consensus backup node of the chain, wherein, the blockchain uses the TendermintBFT Byzantine protocol for consensus; the consensus master node splits the proposed data into The data block is sent to the corresponding consensus backup node in the blockchain; the consensus backup node that receives the data block performs erasure code verification on the data block provided by the consensus master node, so that it can be verified in the Pre In the -vote stage, broadcast the data block with successful erasure code verification to other consensus backup nodes through the pre-vote message; the consensus backup node will obtain at least N-2f pre-vote messages based on the erasure code algorithm The data block is restored back to the proposed data, so that in the Pre-commit phase of the TendermintBFT protocol, the consensus logic of the TendermintBFT protocol is executed on the restored proposed data to complete the current round of consensus, where N is the The number of consensus nodes in the blockchain, f is the fault-tolerant number of consensus nodes set by the TendermintBFT protocol, and N is greater than or equal to 3f+1.
第二方面,提供一种区块链系统,包括:共识主节点和共识备份节点;其中:所述共识主节点在本轮共识发起时,基于纠删码算法将本轮共识的提议数据拆分成与所述区块链的共识备份节点相对应的数据块,其中,所述区块链采用TendermintBFT拜占庭协议进行共识;所述共识主节点在所述TendermintBFT协议的Propose阶段,通过Propose消息将所述提议数据拆分成的数据块发送至所述区块链中对应的共识备份节点;接收到数据块的共识备份节点对所述共识主节点提供的数据块进行纠删码校验,以在所述TendermintBFT协议的Pre-vote阶段,通过pre-vote消息将纠删码校验成功的数据块广播至其他共识备份节点;所述共识备份节点基于所述纠删码算法,将获得至少N-2f个的pre-vote消息中的数据块还原回所述提议数据,以在所述TendermintBFT协议的Pre-commit阶段,对还原回的所述提议数据执行所述TendermintBFT协议的共识逻辑,完成本轮共识,其中,N为所述区块链的共识节点数量,f为所述TendermintBFT协议设置的共识节点的容错数,N大于等于3f+1。In the second aspect, a blockchain system is provided, including: a consensus master node and a consensus backup node; wherein: the consensus master node splits the proposed data of the current round of consensus based on an erasure code algorithm when the current round of consensus is initiated into a data block corresponding to the consensus backup node of the block chain, wherein the block chain uses the TendermintBFT Byzantine protocol for consensus; the consensus master node passes the Propose message to the The data block divided into the proposed data is sent to the corresponding consensus backup node in the blockchain; the consensus backup node that receives the data block performs erasure code verification on the data block provided by the consensus master node, so as to In the Pre-vote stage of the TendermintBFT protocol, the data block whose erasure code verification is successful is broadcast to other consensus backup nodes through the pre-vote message; the consensus backup node will obtain at least N- The data blocks in the 2f pre-vote messages are restored to the proposed data, so that in the Pre-commit phase of the TendermintBFT protocol, the consensus logic of the TendermintBFT protocol is executed on the restored proposed data to complete this round Consensus, where N is the number of consensus nodes in the blockchain, f is the fault-tolerant number of consensus nodes set by the TendermintBFT protocol, and N is greater than or equal to 3f+1.
第三方面,提供一种区块链节点,包括:纠删码模块,在本轮共识发起时,若所属区块链节点为共识主节点时,则基于纠删码算法将本轮共识的提议数据拆分成与所述区块链的共识备份节点相对应的数据块,其中,所述区块链采用TendermintBFT拜占庭协议进行共识;发送模块,若所属区块链节点为共识主节点时,在所述TendermintBFT协议的Propose阶段,通过Propose消息将所述提议数据拆分成的数据块发送至所述区块链中对应的共识备份节点;校验模块,若所属区块链节点为共识备份节点时,对所述共识主节点提供的数据块进行纠删码校验,以在所述TendermintBFT协议的Pre-vote阶段,通过pre-vote消息将纠删码校验成功的数据块广播至其他共识备份节点;还原模块,若所属区块链节点为共识备份节点时,基于所述纠删码算法,将获得至少N-2f个的pre-vote消息中的数据块还原回所述提议数据,以在所述TendermintBFT协议的Pre-commit阶段,对还原回的所述提议数据执行所述TendermintBFT协议的共识逻辑,完成本轮共识,其中,N为所述区块链的共识节点数量,f为所述TendermintBFT协议设置的共识节点的容错数,N大于等于3f+1。In the third aspect, a blockchain node is provided, including: an erasure code module. When the current round of consensus is initiated, if the blockchain node to which it belongs is the consensus master node, the proposal of this round of consensus will be converted based on the erasure code algorithm. The data is split into data blocks corresponding to the consensus backup nodes of the blockchain, wherein the blockchain adopts the TendermintBFT Byzantine protocol for consensus; the sending module, if the blockchain node it belongs to is the consensus master node, In the Propose phase of the TendermintBFT protocol, the proposed data is split into data blocks and sent to the corresponding consensus backup node in the blockchain through the Propose message; the verification module, if the blockchain node it belongs to is a consensus backup node , the erasure code verification is performed on the data block provided by the consensus master node, so that in the Pre-vote stage of the TendermintBFT protocol, the data block whose erasure code verification succeeds is broadcast to other consensuses through the pre-vote message backup node; restore module, if the block chain node to which it belongs is a consensus backup node, based on the erasure code algorithm, restore the data blocks in the pre-vote messages obtained at least N-2f back to the proposed data, so as to In the Pre-commit phase of the TendermintBFT protocol, execute the consensus logic of the TendermintBFT protocol on the restored proposed data to complete the current round of consensus, where N is the number of consensus nodes in the blockchain, and f is the The fault-tolerant number of consensus nodes set by the TendermintBFT protocol, N is greater than or equal to 3f+1.
第四方面,提供一种电子设备包括:存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机程序,所述计算机程序被所述处理器执行:在本轮共识发起时,若作为共识主节点时,则基于纠删码算法将本轮共识的提议数据拆分成与所述区块链的共识备份节点相对应的数据块,其中,所述区块链采用TendermintBFT拜占庭协议进行共识;若作为共识备份节点,则在所述TendermintBFT协议的Propose阶段,通过Propose消息将所述提议数据拆分成的数据块发送至所述区块链中对应的共识备份节点; 若作为共识备份节点,则对所述共识主节点提供的数据块进行纠删码校验,以在所述TendermintBFT协议的Pre-vote阶段,通过pre-vote消息将纠删码校验成功的数据块广播至其他共识备份节点;若作为共识备份节点,则基于所述纠删码算法,将获得至少N-2f个的pre-vote消息中的数据块还原回所述提议数据,以在所述TendermintBFT协议的Pre-commit阶段,对还原回的所述提议数据执行所述TendermintBFT协议的共识逻辑,完成本轮共识,其中,N为所述区块链的共识节点数量,f为所述TendermintBFT协议设置的共识节点的容错数,N大于等于3f+1。In a fourth aspect, an electronic device is provided including: a memory, a processor, and a computer program stored on the memory and operable on the processor, the computer program being executed by the processor: in this round of consensus At the time of initiation, if it is used as the consensus master node, the proposed data of the current round of consensus will be split into data blocks corresponding to the consensus backup nodes of the blockchain based on the erasure code algorithm, wherein the blockchain adopts TendermintBFT Byzantine protocol for consensus; if it is used as a consensus backup node, then in the Propose phase of the TendermintBFT protocol, the proposed data is split into data blocks and sent to the corresponding consensus backup node in the blockchain through the Propose message; If it is used as a consensus backup node, it will perform erasure code verification on the data blocks provided by the consensus master node, so that in the Pre-vote stage of the TendermintBFT protocol, the data that has been successfully verified by the erasure code through the pre-vote message The block is broadcast to other consensus backup nodes; if it is used as a consensus backup node, based on the erasure code algorithm, the data blocks in the pre-vote messages obtained at least N-2f will be restored to the proposed data, so as to be used in the In the Pre-commit phase of the TendermintBFT protocol, the consensus logic of the TendermintBFT protocol is executed on the restored proposed data to complete the current round of consensus, where N is the number of consensus nodes in the blockchain, and f is the TendermintBFT protocol The fault-tolerant number of consensus nodes set, N is greater than or equal to 3f+1.
第五方面,提供一种算机可读存储介质,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现如下步骤:在本轮共识发起时,若作为共识主节点时,则基于纠删码算法将本轮共识的提议数据拆分成与所述区块链的共识备份节点相对应的数据块,其中,所述区块链采用TendermintBFT拜占庭协议进行共识;若作为共识备份节点,则在所述TendermintBFT协议的Propose阶段,通过Propose消息将所述提议数据拆分成的数据块发送至所述区块链中对应的共识备份节点;若作为共识备份节点,则对所述共识主节点提供的数据块进行纠删码校验,以在所述TendermintBFT协议的Pre-vote阶段,通过pre-vote消息将纠删码校验成功的数据块广播至其他共识备份节点;若作为共识备份节点,则基于所述纠删码算法,将获得至少N-2f个的pre-vote消息中的数据块还原回所述提议数据,以在所述TendermintBFT协议的Pre-commit阶段,对还原回的所述提议数据执行所述TendermintBFT协议的共识逻辑,完成本轮共识,其中,N为所述区块链的共识节点数量,f为所述TendermintBFT协议设置的共识节点的容错数,N大于等于3f+1。In the fifth aspect, a computer-readable storage medium is provided. A computer program is stored on the computer-readable storage medium. When the computer program is executed by a processor, the following steps are implemented: when the current round of consensus is initiated, if the consensus When the master node, based on the erasure code algorithm, the proposed data of this round of consensus is split into data blocks corresponding to the consensus backup nodes of the blockchain, wherein the blockchain adopts the TendermintBFT Byzantine protocol for consensus; If it is used as a consensus backup node, in the Propose phase of the TendermintBFT protocol, the proposed data will be split into data blocks and sent to the corresponding consensus backup node in the blockchain through the Propose message; if it is used as a consensus backup node, Then perform erasure code verification on the data blocks provided by the consensus master node, so that in the Pre-vote stage of the TendermintBFT protocol, the data blocks with successful erasure code verification are broadcast to other consensus backups through the pre-vote message Node; if it is a consensus backup node, based on the erasure code algorithm, the data blocks in the pre-vote messages obtained at least N-2f are restored back to the proposed data, so as to be used in the Pre-commit of the TendermintBFT protocol stage, execute the consensus logic of the TendermintBFT protocol on the restored proposed data, and complete the current round of consensus, where N is the number of consensus nodes in the blockchain, and f is the fault tolerance of the consensus nodes set by the TendermintBFT protocol Number, N greater than or equal to 3f+1.
基于本说明书实施例的方案,区块链的共识主节点在执行TendermintBFT的共识时,使用纠删码算法将提议数据拆分成与共识备份节点相对应的数据块,并将拆分成的数据块发送至对应的共识备份节点。之后,共识备份节点基于纠删码技术对共识主节点提供的数据块进行纠删码校验,并在校验成功后将数据块转发至其他共识备份节点,使得区块链的各共识备份节点在获得一定数量的数据块后,即可通过纠删码算法将获得的数据块还原回提议数据,以对提议数据执行共识逻辑。整个方案中,共识主节点仅需要向共识备份节点发送对应的数据块即可,而共识备份节点之间相互转发各自的数据块,从而分摊提议数据的传输,以较小的网络带宽和存储空间开销,实现传输提议数据的容错性。Based on the scheme of the embodiment of this specification, when the consensus master node of the blockchain executes the consensus of TendermintBFT, it uses the erasure code algorithm to split the proposed data into data blocks corresponding to the consensus backup nodes, and the split data The block is sent to the corresponding consensus backup node. Afterwards, the consensus backup node performs erasure code verification on the data blocks provided by the consensus master node based on the erasure code technology, and forwards the data block to other consensus backup nodes after the verification is successful, so that each consensus backup node of the blockchain After obtaining a certain number of data blocks, the obtained data blocks can be restored back to the proposed data through the erasure code algorithm to perform consensus logic on the proposed data. In the whole scheme, the consensus master node only needs to send the corresponding data blocks to the consensus backup nodes, and the consensus backup nodes forward their respective data blocks to each other, so as to share the transmission of the proposed data, with a smaller network bandwidth and storage space Overhead, to achieve fault tolerance for transmitting proposed data.
附图说明Description of drawings
为了更清楚地说明本说明书实施例或现有技术中的技术方案,下面将对实施例或现 有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本说明书实施例中记载的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of this specification or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only These are some embodiments described in the embodiments of this specification. For those skilled in the art, other drawings can also be obtained based on these drawings without any creative effort.
图1为本说明书实施例提供的区块链的共识方法的流程示意图。Fig. 1 is a schematic flow chart of the blockchain consensus method provided by the embodiment of this specification.
图2为本说明书实施例提供的区块链系统的结构示意图。Fig. 2 is a schematic structural diagram of the blockchain system provided by the embodiment of this specification.
图3为本说明书实施例提供的区块链节点的结构示意图。Fig. 3 is a schematic structural diagram of a blockchain node provided by an embodiment of this specification.
图4为本说明书实施例提供的电子设备的结构示意图。FIG. 4 is a schematic structural diagram of an electronic device provided by an embodiment of this specification.
具体实施方式Detailed ways
为了使本技术领域的人员更好地理解本说明书中的技术方案,下面将结合本说明书实施例中的附图,对本说明书实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本说明书一部分实施例,而不是全部的实施例。基于本说明书中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都应当属于本说明书保护的范围。In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described The embodiments are only some of the embodiments in this specification, not all of them. Based on the embodiments in this specification, all other embodiments obtained by persons of ordinary skill in the art without creative efforts shall fall within the protection scope of this specification.
如前所述,目前TendermintBFT协议的共识机制下,共识主节点需要将冗余的提议数据发送给各共识备份节点,以使共识备份节点对提议数据执行共识逻辑。冗余的提议数据会占用共识主节点过多网络带宽和存储空间。为此,本文件旨在提供一种TendermintBFT协议的优化方案,能够有效减少共识过程中共识主节点传输提议数据所占用网络带宽和存储空间。As mentioned earlier, under the current consensus mechanism of the TendermintBFT protocol, the consensus master node needs to send redundant proposal data to each consensus backup node, so that the consensus backup node can execute consensus logic on the proposed data. Redundant proposal data will occupy too much network bandwidth and storage space of the consensus master node. To this end, this document aims to provide an optimization scheme for the TendermintBFT protocol, which can effectively reduce the network bandwidth and storage space occupied by the consensus master node for transmitting proposed data during the consensus process.
图1是本说明书实施例区块链的共识方法的流程图。图1所示的方法可以由下文相对应的装置执行,包括如下步骤。Fig. 1 is a flow chart of the consensus method of the block chain in the embodiment of this specification. The method shown in FIG. 1 may be executed by corresponding devices below, and includes the following steps.
S102,区块链的共识主节点在本轮共识发起时,基于纠删码算法将本轮共识的提议数据拆分成与区块链的共识备份节点相对应的数据块,其中,区块链采用TendermintBFT拜占庭协议进行共识。S102. When the current round of consensus is initiated, the consensus master node of the blockchain splits the proposed data of the current round of consensus into data blocks corresponding to the consensus backup nodes of the blockchain based on the erasure code algorithm. Adopt TendermintBFT Byzantine agreement for consensus.
纠删码(erasure coding,EC)是一种数据容错保护方法,它将数据分割成片段,把冗余数据块扩展、编码,并将其存储在不同的位置,比如磁盘、存储节点或者其它地理位置。从数据函数角度来说,纠删码提供的保护可以用下面公式:n=k+m来表示。变量“k”代表原始数据或符号的值。变量“m”代表故障后添加的提供保护的额外或冗余符号的值。变量“n”代表纠删码过程后创建的符号的总值。举个例子来说,在一个EC 10/16的配置中,会有6个额外的符号(变量m)被添加到10个原始符号(变量k)中。这16个数据片段(变量n)可以遍布16个驱动器、节点或地理位置中,而原始文件可以从 10个验证片段中重建。也就是说,即使有6个驱动器、节点或者地理位置丢失或不可用,而原始文件还是可以恢复。可以看出,纠删码仅需要数据量较少的冗余就能实现数据的还原。Erasure coding (EC) is a data fault-tolerant protection method. It divides data into fragments, expands and encodes redundant data blocks, and stores them in different locations, such as disks, storage nodes or other geographic locations. Location. From the perspective of data functions, the protection provided by erasure codes can be expressed by the following formula: 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 symbols added after the failure to provide protection. The variable "n" represents the total value of symbols created after the erasure coding process. For example, in an EC 10/16 configuration, 6 additional symbols (variable m) are added to the 10 original symbols (variable k). These 16 pieces of data (variable n) can be spread across 16 drives, nodes or geographic locations, and the original file can be reconstructed from the 10 validation pieces. That is, even if 6 drives, nodes or geographic locations are lost or unavailable, the original file can still be recovered. It can be seen that the erasure code only requires a small amount of data redundancy to restore data.
在本说明书实施例中,利用纠删码技术,将待共识的提议数据拆分成与共识备份节点相对应的数据块,后续由共识备份节点进行保存。In the embodiment of this specification, the erasure code technology is used to split the proposed data to be consensus into data blocks corresponding to the consensus backup nodes, which are subsequently stored by the consensus backup nodes.
S104,共识主节点在TendermintBFT协议的Propose阶段,通过Propose消息将提议数据拆分成的数据块发送至区块链中对应的共识备份节点。S104. In the Propose phase of the TendermintBFT protocol, the consensus master node sends the data blocks into which the proposed data is split to the corresponding consensus backup node in the blockchain through the Propose message.
在传统的TendermintBFT协议的Propose阶段,共识主节点会通过Propose消息向每个共识备份节点发送全量的具有冗余的提议数据。而本步骤通过纠删码算法仅向共识备份节点发送其对应的数据块则可以有效降低共识主节点的传输开销。In the Propose phase of the traditional TendermintBFT protocol, the consensus master node will send a full amount of redundant proposal data to each consensus backup node through the Propose message. In this step, only the corresponding data block is sent to the consensus backup node through the erasure code algorithm, which can effectively reduce the transmission overhead of the consensus master node.
这里需要说明的是,提议数据拆分成的多个数据块可以与区块链的共识备份节点一一对应;或者,提议数据拆分成的多个数据块的数量小于区块链的共识备份节点的数量,一个共识备份节点最多对应一个数据块。因此,本步骤中,共识主节点可以但不一定向区块链的每个共识备份节点都发送数据块,这取决于纠删码的算法设置。What needs to be explained here is that the multiple data blocks into which the proposed data is split can correspond to the consensus backup nodes of the blockchain; or, the number of multiple data blocks into which the proposed data is split is smaller than the consensus backup nodes of the blockchain The number of nodes, a consensus backup node corresponds to at most one data block. Therefore, in this step, the consensus master node can but not necessarily send data blocks to each consensus backup node of the blockchain, which depends on the algorithm settings of the erasure code.
S106,接收到数据块的共识备份节点对共识主节点提供的数据块进行纠删码校验,以在TendermintBFT协议的Pre-vote阶段,通过pre-vote消息将纠删码校验成功的数据块广播至其他共识备份节点。S106, the consensus backup node that receives the data block performs erasure code verification on the data block provided by the consensus master node, so as to verify the successful erasure code of the data block through the pre-vote message in the Pre-vote stage of the TendermintBFT protocol Broadcast to other consensus backup nodes.
具体地,提议数据拆分成的数据块对应有基于纠删码算法得到的默克尔树路径信息。共识主节点通过Propose消息还将提议数据拆分成的数据块所匹配的默克尔树路径信息发送至区块链中对应的共识备份节点。本步骤中,接收到数据块的共识备份节点基于纠删码算法对共识主节点提供数据块进行默克尔树重建,若共识节点提供的默克尔树路径信息与重建的默克尔树匹配,则纠删码校验成功,否则纠删码校验失败。Specifically, the data blocks into which the proposed data is split correspond to the Merkle tree path information obtained based on the erasure code algorithm. The consensus master node also sends the Merkle tree path information matched by the data blocks that the proposed data is split into to the corresponding consensus backup node in the blockchain through the Propose message. In this step, the consensus backup node that receives the data block reconstructs the Merkle tree on the data block provided by the consensus master node based on the erasure code algorithm. If the Merkle tree path information provided by the consensus node matches the reconstructed Merkle tree , the erasure code verification succeeds, otherwise the erasure code verification fails.
此外,作为优选方案,如果本轮共识的提议数据已在之前轮次的共识也发起过,则表示共识备份节点在执行之前轮次的共识时,已经缓存有提议数据,此时本步骤可以直接基于缓存的提议数据共识主节点提供的数据块进行速度更快的匹配校验,以代替纠删码校验。如果本轮共识的提议数据未在之前轮次的共识也发起过,则接收到数据块的共识备份节点再对共识主节点提供的数据块进行纠删码校验。In addition, as a preferred solution, if the proposed data of this round of consensus has been initiated in the previous round of consensus, it means that the consensus backup node has already cached the proposed data when executing the previous round of consensus. At this time, this step can directly Based on the cached proposed data consensus, the data blocks provided by the master node perform faster matching verification instead of erasure code verification. If the proposed data of this round of consensus has not been initiated in the previous round of consensus, the consensus backup node that receives the data block will perform erasure code verification on the data block provided by the consensus master node.
S108,共识备份节点点基于纠删码算法,将获得至少N-2f个的pre-vote消息中的数据块还原回所述提议数据,以在TendermintBFT协议的Pre-commit阶段,对还原回的提议数据执行TendermintBFT协议的共识逻辑,完成本轮共识,其中,N为区块链的共识节点数量,f为TendermintBFT协议设置的共识节点的容错数,N大于等于3f+1。S108, based on the erasure code algorithm, the consensus backup node restores the data blocks in the pre-vote messages obtained at least N-2f back to the proposed data, so as to restore the proposed data in the Pre-commit phase of the TendermintBFT protocol The data executes the consensus logic of the TendermintBFT protocol to complete this round of consensus, where N is the number of consensus nodes in the blockchain, f is the fault-tolerant number of consensus nodes set by the TendermintBFT protocol, and N is greater than or equal to 3f+1.
其中,N-2f还原回提议数据所需要的数据块的最小数量。Among them, N-2f is the minimum number of data blocks required to restore the proposed data.
具体地,本步骤中,若共识备份节点基于所述纠删码算法还原回所述提数据,则在Pre-vote阶段,向区块链的其他共识节点广播Pre-commit消息;其中,当本轮共识产生N-f个Pre-commit消息,则提议数据达成通过的共识。Specifically, in this step, if the consensus backup node restores the mentioned data based on the erasure code algorithm, then in the Pre-vote stage, broadcast the Pre-commit message to other consensus nodes of the blockchain; The round of consensus generates N-f Pre-commit messages, and the proposed data reaches a consensus.
基于图1所示的共识方法可以知道:本说明书实施例的方案中,区块链的共识主节点在执行TendermintBFT的共识时,使用纠删码算法将提议数据拆分成与共识备份节点相对应的数据块,并将拆分成的数据块发送至对应的共识备份节点。之后,共识备份节点基于纠删码技术对共识主节点提供的数据块进行纠删码校验,并在校验成功后将数据块转发至其他共识备份节点,使得区块链的各共识备份节点在获得一定数量的数据块后,即可通过纠删码算法将获得的数据块还原回提议数据,以对提议数据执行共识逻辑。整个方案中,共识主节点仅需要向共识备份节点发送对应的数据块即可,而共识备份节点之间相互转发各自的数据块,从而分摊提议数据的传输,以较小的网络带宽和存储空间开销,实现传输提议数据的容错性。Based on the consensus method shown in Figure 1, it can be known that in the scheme of the embodiment of this specification, when the consensus master node of the blockchain executes the TendermintBFT consensus, it uses the erasure code algorithm to split the proposed data into , and send the split data blocks to the corresponding consensus backup nodes. Afterwards, the consensus backup node performs erasure code verification on the data blocks provided by the consensus master node based on the erasure code technology, and forwards the data block to other consensus backup nodes after the verification is successful, so that each consensus backup node of the blockchain After obtaining a certain number of data blocks, the obtained data blocks can be restored back to the proposed data through the erasure code algorithm to perform consensus logic on the proposed data. In the whole scheme, the consensus master node only needs to send the corresponding data blocks to the consensus backup nodes, and the consensus backup nodes forward their respective data blocks to each other, so as to share the transmission of the proposed data, with a smaller network bandwidth and storage space Overhead, to achieve fault tolerance for transmitting proposed data.
下面对本说明书实施例的共识方法进行详细介绍。The consensus method of the embodiment of this specification will be introduced in detail below.
本说明书实施例的方法中,区块链基于TendermintBFT协议执行共识。设区块链的共识节点数量为N,拜占庭的共识节点容错数量为f,N大于等于3f+1。对应的共识流程如下:区块链中的提议节点根据当前共识区块高度,初始化待共识高度hp,和其他参数。对当前待共识高度,发起本轮共识。共识包括以下阶段。In the method of the embodiment of this specification, the blockchain implements consensus based on the TendermintBFT protocol. Assuming that the number of consensus nodes in the blockchain is N, the number of fault-tolerant Byzantine consensus nodes is f, and N is greater than or equal to 3f+1. The corresponding consensus process is as follows: the proposed node in the blockchain initializes the consensus height hp and other parameters according to the current consensus block height. For the current consensus height, initiate this round of consensus. Consensus includes the following stages.
Propose阶段:各共识节点根据本轮共识发起的信息共识高度hp和共识轮roundp,判断是否作为本轮共识的共识主节点。Propose stage: Each consensus node judges whether it is the consensus master node of this round of consensus according to the information consensus height hp and consensus round roundp initiated by this round of consensus.
若作为共识主节点,则获取提议数据(先查看是否之前round已经有缓存数据,若有则使用缓存数据;若无则获取新的提议数据),然后对提议数据做(N-2f,N)纠删码,得到与共识备份节点对应的数据块和数据块的默克尔树路径信息(即纠删码计算得到的根哈希值);然后在Propose阶段,通过Propose消息<Propose,hp,roundp,r,bi,si,-1>将提议数据拆分成的数据块发送至区块链中对应的共识备份节点。其中,i表示第i个共识备份节点,si是第i个共识备份节点对应的数据块,bi是针对第i个共识备份节点的默克尔树merkle路径信息。If it is a consensus master node, get the proposed data (first check whether there is cached data in the previous round, if there is, use the cached data; if not, get new proposed data), and then do (N-2f, N) on the proposed data Erasure code to obtain the data block corresponding to the consensus backup node and the Merkle tree path information of the data block (that is, the root hash value calculated by the erasure code); then in the Propose stage, pass the Propose message <Propose,hp, roundp,r,bi,si,-1>Send the data blocks that the proposed data is divided into to the corresponding consensus backup nodes in the blockchain. Among them, i represents the i-th consensus backup node, si is the data block corresponding to the i-th consensus backup node, and bi is the Merkle tree merkle path information for the i-th consensus backup node.
若作为共识备份节点,则等待收集Propose消息的数据,并当接收到共识主节点发送的<Propose,hp,roundp,r,bi,si,-1>消息时,对Propose消息中的信息进行校验。应理解,对Propose消息中的信息进行校验包括:基于si和bi进行纠删码校验。If it is used as a consensus backup node, it waits to collect the data of the Propose message, and when it receives the <Propose, hp, roundp, r, bi, si, -1> message sent by the consensus master node, it corrects the information in the Propose message test. It should be understood that verifying the information in the Propose message includes: performing erasure code verification based on si and bi.
Pre-vote阶段:若Propose消息通过校验,向其他共识备份节点广播pre-vote消息 <Pre-vote,hp,roundp,r,bi,si>,若Propose消息未通过校验,则向其他共识备份节点广播pre-vote nil消息<Pre-vote,hp,roundp,nil,nil,nil>消息,这里pre-vote nil消息用于投票空区块。Pre-vote stage: If the Propose message passes the verification, broadcast the pre-vote message <Pre-vote, hp, roundp, r, bi, si> to other consensus backup nodes; if the Propose message fails the verification, broadcast the pre-vote message to other consensus backup nodes The backup node broadcasts the pre-vote nil message <Pre-vote, hp, roundp, nil, nil, nil> message, where the pre-vote nil message is used to vote for empty blocks.
其中,当任意共识备份节点收到N-F个有效的Pre-vote消息时:使用至少N-2f各Pre-vote消息中的si进行纠删码计算,还原回提议数据。Among them, when any consensus backup node receives N-F valid Pre-vote messages: use at least N-2f si in each Pre-vote message to perform erasure code calculation and restore the proposed data.
Pre-commit阶段:任意共识节点若得到有效的提议数据,则向其他共识节点广播Pre-commit消息<Precommit,hp,roundp,r>;否则,广播Pre-commit nil消息。其中,共识备份节点广播Pre-commit nil消息的原因可能是共识备份节点未收集到到达N-F个Pre-vote消息,或者,共识备份节点收集到到达N-F个Pre-vote消息,但通过纠删码计算未还原得到有效的提议数据。Pre-commit stage: If any consensus node obtains valid proposal data, it broadcasts a Pre-commit message <Precommit, hp, roundp, r> to other consensus nodes; otherwise, it broadcasts a Pre-commit nil message. Among them, the reason why the consensus backup node broadcasts the Pre-commit nil message may be that the consensus backup node has not collected N-F Pre-vote messages, or the consensus backup node has collected N-F Pre-vote messages, but through erasure code calculation Valid proposed data was not restored.
其中,当本轮共识产生N-f个Pre-commit消息,则提议数据达成通过的共识。当本轮共识产生f个Pre-commit nil消息,则提议数据直接确定达成未通过的共识。Among them, when the current round of consensus generates N-f Pre-commit messages, the proposed data reaches a consensus. When the current round of consensus generates f Pre-commit nil messages, the proposed data directly confirms that a failed consensus has been reached.
综上所述,本说明书实施例的方法将基于纠删码实现数据容错发送融入到了TendermintBFT协议中,相对于传统的TendermintBFT协议,并未增加额外的信令开销,但在提议数据的传输效率上得到明显提升,对于TendermintBFT协议共识而言,提高了共识效率。To sum up, the method in the embodiment of this specification integrates data error-tolerant transmission based on erasure codes into the TendermintBFT protocol. Compared with the traditional TendermintBFT protocol, no additional signaling overhead is added, but the proposed data transmission efficiency It has been significantly improved, and for the TendermintBFT protocol consensus, the consensus efficiency has been improved.
以上是对本说明书实施例的方法的介绍。应理解,在不脱离本文上述原理基础之上,还可以进行适当的变化,这些变化也应视为本说明书实施例的保护范围。The above is the introduction to the method in the embodiment of this specification. It should be understood that appropriate changes can also be made without departing from the above-mentioned principles herein, and these changes should also be regarded as the protection scope of the embodiments of this specification.
与上述图1所示共识方法相对应地,本说明书实施例还提供一种区块链系统。图2是本说明书实施例区块链系统200的结构图,包括:共识主节点210和多个共识备份节点220。其中:所述共识主节点210在本轮共识发起时,基于纠删码算法将本轮共识的提议数据拆分成与所述区块链的共识备份节点220相对应的数据块,其中,所述区块链采用TendermintBFT拜占庭协议进行共识;所述共识主节点210在所述TendermintBFT协议的Propose阶段,通过Propose消息将所述提议数据拆分成的数据块发送至所述区块链中对应的共识备份节点220;接收到数据块的共识备份节点220对所述共识主节点210提供的数据块进行纠删码校验,以在所述TendermintBFT协议的Pre-vote阶段,通过pre-vote消息将纠删码校验成功的数据块广播至其他共识备份节点220;所述共识备份节点220基于所述纠删码算法,将获得至少N-2f个的pre-vote消息中的数据块还原回所述提议数据,以在所述TendermintBFT协议的Pre-commit阶段,对还原回的所述提议数据执行所述TendermintBFT协议的共识逻辑,完成本轮共识,其中,N为所述区块链的共识节点数量,f为所述TendermintBFT协议设置的共识节点的容错数,N大于等于 3f+1。Corresponding to the consensus method shown in FIG. 1 above, the embodiment of this specification also provides a blockchain system. FIG. 2 is a structural diagram of a blockchain system 200 according to an embodiment of this specification, including: a consensus master node 210 and multiple consensus backup nodes 220 . Wherein: when the consensus master node 210 initiates the current round of consensus, based on the erasure code algorithm, the proposal data of the current round of consensus is split into data blocks corresponding to the consensus backup node 220 of the blockchain, wherein the The block chain adopts the TendermintBFT Byzantine protocol for consensus; the consensus master node 210 sends the data blocks into which the proposed data is split to the corresponding block in the block chain through the Propose message in the Propose phase of the TendermintBFT protocol Consensus backup node 220; 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-vote stage of the TendermintBFT protocol, the pre-vote message will The data block with successful erasure code verification is broadcast to other consensus backup nodes 220; the consensus backup node 220 restores the data blocks in the pre-vote messages obtained at least N-2f based on the erasure code algorithm to the The proposed data is used to execute the consensus logic of the TendermintBFT protocol on the restored proposed data in the Pre-commit phase of the TendermintBFT protocol to complete the current round of consensus, where N is the consensus node of the blockchain Number, f is the fault-tolerant number of consensus nodes set by the TendermintBFT protocol, and N is greater than or equal to 3f+1.
在本实施例的区块链系统中,共识主节点210在执行TendermintBFT的共识时,使用纠删码算法将提议数据拆分成与共识备份节点220相对应的数据块,并将拆分成的数据块发送至对应的共识备份节点220。之后,共识备份节点220基于纠删码技术对共识主节点210提供的数据块进行纠删码校验,并在校验成功后将数据块转发至其他共识备份节点220,使得区块链的各共识备份节点220在获得一定数量的数据块后,即可通过纠删码算法将获得的数据块还原回提议数据,以对提议数据执行共识逻辑。整个方案中,共识主节点210仅需要向共识备份节点220发送对应的数据块即可,而共识备份节点220之间相互转发各自的数据块,从而分摊提议数据的传输,以较小的网络带宽和存储空间开销,实现传输提议数据的容错性。In the blockchain system of this embodiment, when executing the TendermintBFT consensus, the consensus master node 210 uses an erasure code algorithm to split the proposed data into data blocks corresponding to the consensus backup node 220, and split the The data block is sent to the corresponding consensus backup node 220. Afterwards, the consensus backup node 220 performs erasure code verification on the data block provided by the consensus master node 210 based on the erasure code technology, and forwards the data block to other consensus backup nodes 220 after the verification is successful, so that each block chain After obtaining a certain number of data blocks, the consensus backup node 220 can restore the obtained data blocks back to the proposed data through an erasure code algorithm, so as to execute consensus logic on the proposed data. In the whole scheme, the consensus master node 210 only needs to send the corresponding data block to the consensus backup node 220, and the consensus backup nodes 220 forward their respective data blocks to each other, so as to share the transmission of the proposed data, with a small network bandwidth and storage space overhead to achieve fault tolerance for transmitting proposed data.
可选地,接收到数据块的共识备份节点220若纠删码校验失败,则在所述TendermintBFT协议的Pre-vote阶段,向其他共识节点广播pre-vote nil消息,所述pre-vote nil消息用于投票空区块。Optionally, if the consensus backup node 220 that receives the data block fails to verify the erasure code, it will broadcast a pre-vote nil message to other consensus nodes during the Pre-vote phase of the TendermintBFT protocol, and the pre-vote nil Messages are used to vote for empty blocks.
可选地,共识备份节点220在所述TendermintBFT协议的Pre-vote阶段,基于所述纠删码算法,将已获得的pre-vote消息中的数据块还原回所述提数据,包括:共识备份节点220在至少获得包含自身提供在内的N-f个Prevote消息后,基于所述纠删码算法,将已获得的Prevote消息中的数据快恢复成所述提议数据。Optionally, in the Pre-vote phase of the TendermintBFT protocol, the consensus backup node 220 restores the obtained data block in the pre-vote message back to the mentioned data based on the erasure code algorithm, including: consensus backup After the node 220 obtains at least N-f Prevote messages including those provided by itself, based on the erasure code algorithm, the data in the obtained Prevote messages are quickly restored to the proposed data.
可选地,共识备份节点220在所述TendermintBFT协议的Pre-vote阶段,对还原回的所述提议数据执行所述TendermintBFT协议的共识逻辑,包括:若共识备份节点220基于所述纠删码算法还原回所述提数据,则在所述TendermintBFT协议的Pre-vote阶段,向所述区块链的其他共识节点广播Pre-commit消息;其中,当本轮共识产生N-f个Pre-commit消息,则所述提议数据达成通过的共识。Optionally, the consensus backup node 220 executes the consensus logic of the TendermintBFT protocol on the restored proposed data in the Pre-vote phase of the TendermintBFT protocol, including: if the consensus backup node 220 is based on the erasure code algorithm To restore the mentioned data, broadcast Pre-commit messages to other consensus nodes of the blockchain during the Pre-vote phase of the TendermintBFT protocol; wherein, when the current round of consensus generates N-f Pre-commit messages, then The proposed data reaches a consensus of adoption.
可选地,若共识备份节点220未能还原回的所述提数据,则在所述TendermintBFT协议的Pre-vote阶段,向所述区块链的其他共识节点广播Pre-commit nil消息;其中,当本轮共识产生f个Pre-commit nil消息,则所述提议数据直接确定达成未通过的共识。Optionally, if the consensus backup node 220 fails to restore the mentioned data, then in the Pre-vote phase of the TendermintBFT protocol, broadcast a Pre-commit nil message to other consensus nodes of the blockchain; wherein, When the current round of consensus generates f Pre-commit nil messages, the proposed data directly confirms that a failed consensus has been reached.
可选地,所述提议数据拆分成的数据块对应有基于所述纠删码算法得到的默克尔树路径信息,所述共识主节点210通过Propose消息还将所述提议数据拆分成的数据块所匹配的默克尔树路径信息发送至所述区块链中对应的共识备份节点220;接收到数据块的共识备份节点220对所述共识主节点210提供的数据块进行纠删码校验,包括:接收到数据块的共识备份节点220基于所述纠删码算法对所述共识主节点210提供数据块进行默克尔树重建,若所述共识节点提供的默克尔树路径信息与重建的默克尔树匹配,则 纠删码校验成功,否则纠删码校验失败。Optionally, the data block into which the proposed data is split corresponds to the Merkle tree path information obtained based on the erasure code algorithm, and the consensus master node 210 also splits the proposed data into The Merkle tree path information matched by the data block is sent to the corresponding consensus backup node 220 in the blockchain; the consensus backup node 220 that receives the data block performs erasure on the data block provided by the consensus master node 210 Code verification, including: the consensus backup node 220 that receives the data block performs Merkel tree reconstruction on the data block provided by the consensus master node 210 based on the erasure code algorithm, if the Merkle tree provided by the consensus node If the path information matches the reconstructed Merkle tree, the erasure code verification succeeds, otherwise the erasure code verification fails.
可选地,接收到数据块的共识备份节点220对所述共识主节点210提供的数据块进行纠删码校验,包括:若所述提议数据未在之前轮次的共识发起,则接收到数据块的共识备份节点220对所述共识主节点210提供的数据块进行纠删码校验,否则,直接通过之前轮次的共识缓存的所述提议数据,对所述共识主节点210提供的数据块进行匹配校验,以代替纠删码校验。Optionally, 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, including: if the proposed data is not initiated in the previous round of consensus, then receiving The consensus backup node 220 of the data block performs erasure code verification on the data block provided by the consensus master node 210; Data blocks are checked for matching instead of erasure code checking.
显然,本说明书实施例的区块链系统可以作为上述图1所示的共识方法的执行主体,因此能够实现共识方法在图1所实现的功能。由于原理相同,本文不再赘述。Obviously, the blockchain system in the embodiment of this specification can be used as the executive body of the consensus method shown in Figure 1 above, so it can realize the functions realized by the consensus method in Figure 1 . Since the principle is the same, this article will not repeat them.
与上述图1所示共识方法相对应地,本说明书实施例还提供一种区块链节点。图3是本说明书实施例区块链节点300的结构图,包括:纠删码模块310,在本轮共识发起时,若所属区块链节点为共识主节点时,则基于纠删码算法将本轮共识的提议数据拆分成与所述区块链的共识备份节点相对应的数据块,其中,所述区块链采用TendermintBFT拜占庭协议进行共识;发送模块320,若所属区块链节点为共识主节点时,在所述TendermintBFT协议的Propose阶段,通过Propose消息将所述提议数据拆分成的数据块发送至所述区块链中对应的共识备份节点;校验模块330,若所属区块链节点为共识备份节点时,对所述共识主节点提供的数据块进行纠删码校验,以在所述TendermintBFT协议的Pre-vote阶段,通过pre-vote消息将纠删码校验成功的数据块广播至其他共识备份节点;还原模块340,若所属区块链节点为共识备份节点时,基于所述纠删码算法,将获得至少N-2f个的pre-vote消息中的数据块还原回所述提议数据,以在所述TendermintBFT协议的Pre-commit阶段,对还原回的所述提议数据执行所述TendermintBFT协议的共识逻辑,完成本轮共识,其中,N为所述区块链的共识节点数量,f为所述TendermintBFT协议设置的共识节点的容错数,N大于等于3f+1。Corresponding to the consensus method shown in FIG. 1 above, the embodiment of this specification also provides a blockchain node. FIG. 3 is a structural diagram of a block chain node 300 in the embodiment of this specification, including: an erasure code module 310. When the current round of consensus is initiated, if the block chain node to which it belongs is the consensus master node, the erasure code algorithm will The proposed data of this round of consensus is split into data blocks corresponding to the consensus backup nodes of the blockchain, wherein the blockchain uses the TendermintBFT Byzantine protocol for consensus; the sending module 320, if the blockchain node it belongs to is When the consensus master node is in the Propose stage of the TendermintBFT protocol, the proposed data is split into data blocks and sent to the corresponding consensus backup node in the block chain through the Propose message; When the block chain node is a consensus backup node, the erasure code verification is performed on the data block provided by the consensus master node, so that in the Pre-vote stage of the TendermintBFT protocol, the erasure code verification is successful through the pre-vote message The data block broadcast to other consensus backup nodes; the restore module 340, if the block chain node it belongs to is a consensus backup node, based on the erasure code algorithm, it will obtain at least N-2f data blocks in the pre-vote message Restore the proposed data, so that in the Pre-commit phase of the TendermintBFT protocol, execute the consensus logic of the TendermintBFT protocol on the restored proposed data to complete the current round of consensus, where N is the blockchain The number of consensus nodes, f is the fault-tolerant number of consensus nodes set by the TendermintBFT protocol, and N is greater than or equal to 3f+1.
显然,本说明书实施例的区块链节点可以是图1所示共识方法中的共识主节点或共识备份节点,因此能够实现该共识方法在图1所实现的功能。由于原理相同,本文不再赘述。Obviously, the blockchain node in the embodiment of this specification can be the consensus master node or the consensus backup node in the consensus method shown in Figure 1, so it can realize the functions realized by the consensus method in Figure 1. Since the principle is the same, this article will not repeat them.
图4是本说明书的一个实施例电子设备的结构示意图。请参考图4,在硬件层面,该电子设备包括处理器,可选地还包括内部总线、网络接口、存储器。其中,存储器可能包含内存,例如高速随机存取存储器(Random-AccessMemory,RAM),也可能还包括非易失性存储器(non-volatilememory),例如至少1个磁盘存储器等。当然,该电子设备还可能包括其他业务所需要的硬件。Fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present specification. Please refer to FIG. 4 , at the hardware level, the electronic device includes a processor, and optionally also includes an internal bus, a network interface, and a memory. Wherein, the memory may include a memory, such as a high-speed random-access memory (Random-Access Memory, RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory. Of course, the electronic device may also include hardware required by other services.
处理器、网络接口和存储器可以通过内部总线相互连接,该内部总线可以是 ISA(Industry Standard Architecture,工业标准体系结构)总线、PCI(Peripheral Component Interconnect,外设部件互连标准)总线或EISA(Extended Industry Standard Architecture,扩展工业标准结构)总线等。所述总线可以分为地址总线、数据总线、控制总线等。为便于表示,图4中仅用一个双向箭头表示,但并不表示仅有一根总线或一种类型的总线。The processor, the network interface and the memory can be connected to each other through an internal bus, which can be an ISA (Industry Standard Architecture, industry standard architecture) bus, a PCI (Peripheral Component Interconnect, peripheral component interconnection standard) bus or an EISA (Extended Industry Standard Architecture, extended industry standard architecture) bus, etc. The bus can be divided into address bus, data bus, control bus and so on. For ease of representation, only one double-headed arrow is used in FIG. 4 , but it does not mean that there is only one bus or one type of bus.
存储器,用于存放程序。具体地,程序可以包括程序代码,所述程序代码包括计算机操作指令。存储器可以包括内存和非易失性存储器,并向处理器提供指令和数据。Memory for storing programs. Specifically, the program may include program code, and the program code includes computer operation instructions. Storage, which can include internal memory and nonvolatile storage, provides instructions and data to the processor.
处理器从非易失性存储器中读取对应的计算机程序到内存中然后运行,在逻辑层面上形成共识装置,该共识装置可以是上述区块链系统的共识主节点或者共识备份节点,也可以是述区块链系统的共识主节点或者共识备份节点中的部件。处理器,执行存储器所存放的程序,并具体用于执行以下操作:在本轮共识发起时,若作为共识主节点时,则基于纠删码算法将本轮共识的提议数据拆分成与所述区块链的共识备份节点相对应的数据块,其中,所述区块链采用TendermintBFT拜占庭协议进行共识;若作为共识备份节点,则在所述TendermintBFT协议的Propose阶段,通过Propose消息将所述提议数据拆分成的数据块发送至所述区块链中对应的共识备份节点;若作为共识备份节点,则对所述共识主节点提供的数据块进行纠删码校验,以在所述TendermintBFT协议的Pre-vote阶段,通过pre-vote消息将纠删码校验成功的数据块广播至其他共识备份节点;若作为共识备份节点,则基于所述纠删码算法,将获得至少N-2f个的pre-vote消息中的数据块还原回所述提议数据,以在所述TendermintBFT协议的Pre-commit阶段,对还原回的所述提议数据执行所述TendermintBFT协议的共识逻辑,完成本轮共识,其中,N为所述区块链的共识节点数量,f为所述TendermintBFT协议设置的共识节点的容错数,N大于等于3f+1。The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it to form a consensus device on the logical level. The consensus device can be the consensus master node or the consensus backup node of the above-mentioned blockchain system, or it can It is a component in the consensus master node or consensus backup node of the blockchain system. The processor executes the program stored in the memory, and is specifically used to perform the following operations: when the current round of consensus is initiated, if it is used as the consensus master node, based on the erasure code algorithm, the proposed data of the current round of consensus is split into The data block corresponding to the consensus backup node of the blockchain, wherein, the blockchain adopts the TendermintBFT Byzantine protocol for consensus; if it is used as a consensus backup node, in the Propose stage of the TendermintBFT protocol, the Propose message will pass the The data block into which the proposed data is split is sent to the corresponding consensus backup node in the block chain; if it is used as a consensus backup node, the data block provided by the consensus master node is verified by erasure code to In the Pre-vote stage of the TendermintBFT protocol, the data blocks whose erasure code verification is successful are broadcast to other consensus backup nodes through the pre-vote message; if used as a consensus backup node, based on the erasure code algorithm, at least N- The data blocks in the 2f pre-vote messages are restored to the proposed data, so that in the Pre-commit phase of the TendermintBFT protocol, the consensus logic of the TendermintBFT protocol is executed on the restored proposed data to complete this round Consensus, where N is the number of consensus nodes in the blockchain, f is the fault-tolerant number of consensus nodes set by the TendermintBFT protocol, and N is greater than or equal to 3f+1.
上述如本说明书图1所示实施例揭示的共识方法可以应用于处理器中,或者由处理器实现。处理器可能是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法的各步骤可以通过处理器中的硬件的集成逻辑电路或者软件形式的指令完成。上述的处理器可以是通用处理器,包括中央处理器(Central Processing Unit,CPU)、网络处理器(Network Processor,NP)等;还可以是数字信号处理器(DigitalSignal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列(Field-Programmable GateArray,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。可以实现或者执行本说明书实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本说明书实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成, 或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器,处理器读取存储器中的信息,结合其硬件完成上述方法的步骤。The above-mentioned consensus method disclosed in the embodiment shown in FIG. 1 of this specification can be applied to or implemented by a processor. A processor may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in a processor or an instruction in the form of software. The above-mentioned processor can be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU), a network processor (Network Processor, NP), etc.; it can also be a digital signal processor (Digital Signal Processor, DSP), an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), field programmable gate array (Field-Programmable GateArray, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of this specification can be realized or executed. A general-purpose processor may be a microprocessor, or the processor may be any conventional processor, or the like. The steps of the method disclosed in the embodiments of this specification may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software module can be located in a mature storage medium in the field such as random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, register. The storage medium is located in the memory, and the processor reads the information in the memory, and completes the steps of the above method in combination with its hardware.
应理解,本说明书实施例的电子设备可以实现上述共识方法在图1所示的实施例的功能。由于原理相同,本文不再赘述。It should be understood that the electronic device in the embodiment of this specification can implement the functions of the above-mentioned consensus method shown in the embodiment shown in FIG. 1 . Since the principle is the same, this article will not repeat them.
当然,除了软件实现方式之外,本说明书的电子设备并不排除其他实现方式,比如逻辑器件抑或软硬件结合的方式等等,也就是说以下处理流程的执行主体并不限定于各个逻辑单元,也可以是硬件或逻辑器件。Of course, in addition to the software implementation, the electronic equipment in this specification does not exclude other implementations, such as logic devices or the combination of software and hardware, etc., that is to say, the execution subject of the following processing flow is not limited to each logic unit, It can also be a hardware or logic device.
此外,本说明书实施例还提出了一种计算机可读存储介质,该计算机可读存储介质存储一个或多个程序,该一个或多个程序包括指令,该指令当被包括多个应用程序的便携式电子设备执行时,能够使该便携式电子设备执行图1所示实施例的方法,并具体用于执行以下方法:在本轮共识发起时,若作为共识主节点时,则基于纠删码算法将本轮共识的提议数据拆分成与所述区块链的共识备份节点相对应的数据块,其中,所述区块链采用TendermintBFT拜占庭协议进行共识;若作为共识备份节点,则在所述TendermintBFT协议的Propose阶段,通过Propose消息将所述提议数据拆分成的数据块发送至所述区块链中对应的共识备份节点;若作为共识备份节点,则对所述共识主节点提供的数据块进行纠删码校验,以在所述TendermintBFT协议的Pre-vote阶段,通过pre-vote消息将纠删码校验成功的数据块广播至其他共识备份节点;若作为共识备份节点,则基于所述纠删码算法,将获得至少N-2f个的pre-vote消息中的数据块还原回所述提议数据,以在所述TendermintBFT协议的Pre-commit阶段,对还原回的所述提议数据执行所述TendermintBFT协议的共识逻辑,完成本轮共识,其中,N为所述区块链的共识节点数量,f为所述TendermintBFT协议设置的共识节点的容错数,N大于等于3f+1。In addition, the embodiment of this specification also proposes a computer-readable storage medium, where the computer-readable storage medium stores one or more programs, and the one or more programs include instructions. When the electronic device executes, it can make the portable electronic device execute the method of the embodiment shown in Figure 1, and is specifically used to perform the following method: when the current round of consensus is initiated, if it is used as the consensus master node, based on the erasure code algorithm, the The proposed data of this round of consensus is split into data blocks corresponding to the consensus backup nodes of the blockchain, wherein the blockchain adopts the TendermintBFT Byzantine protocol for consensus; In the Propose phase of the protocol, the proposed data is split into data blocks and sent to the corresponding consensus backup node in the blockchain through the Propose message; if it is used as a consensus backup node, the data blocks provided by the consensus master node Perform erasure code verification, so that in the Pre-vote stage of the TendermintBFT protocol, broadcast the data block with successful erasure code verification to other consensus backup nodes through the pre-vote message; if it is used as a consensus backup node, based on the The erasure code algorithm is used to restore the data blocks in at least N-2f pre-vote messages back to the proposed data, so as to execute the restored proposed data in the Pre-commit phase of the TendermintBFT protocol The consensus logic of the TendermintBFT protocol completes this round of consensus, where N is the number of consensus nodes in the blockchain, f is the fault-tolerant number of consensus nodes set by the TendermintBFT protocol, and N is greater than or equal to 3f+1.
本领域技术人员应明白,本说明书的实施例可提供为方法、系统或计算机程序产品。因此,本说明书可采用完全硬件实施例、完全软件实施例或结合软件和硬件方面的实施例的形式。而且,本说明书可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art should understand that the embodiments of this specification may be provided as methods, systems or computer program products. Accordingly, this description 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 may take the form of a computer program product embodied 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 this specification. Other implementations are within the scope of the following claims. In some cases, the actions or steps recited in the claims can be performed in an order different from that 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. Multitasking and parallel processing are also possible or may be advantageous in certain embodiments.
以上仅为本说明书的实施例而已,并不用于限制本说明书。对于本领域技术人员来说,本说明书可以有各种更改和变化。凡在本说明书的精神和原理之内所作的任何修改、等同替换、改进等,均应包含在本说明书的权利要求范围之内。此外,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都应当属于本文件的保护范围。The above are only examples of this specification, and are not intended to limit this specification. For those skilled in the art, various modifications and changes may occur in this description. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of this specification shall be included within the scope of the claims of this specification. In addition, all other embodiments obtained by persons of ordinary skill in the art without creative efforts shall fall within the scope of protection of this document.

Claims (11)

  1. 一种区块链的共识方法,包括:A blockchain consensus method, comprising:
    区块链的共识主节点在本轮共识发起时,基于纠删码算法将本轮共识的提议数据拆分成与所述区块链的共识备份节点相对应的数据块,其中,所述区块链采用TendermintBFT拜占庭协议进行共识;When the consensus master node of the blockchain initiates the current round of consensus, based on the erasure code algorithm, the proposed data of the current round of consensus is split into data blocks corresponding to the consensus backup nodes of the blockchain. The block chain adopts TendermintBFT Byzantine agreement for consensus;
    所述共识主节点在所述TendermintBFT协议的Propose阶段,通过Propose消息将所述提议数据拆分成的数据块发送至所述区块链中对应的共识备份节点;In the Propose phase of the TendermintBFT protocol, the consensus master node sends the data blocks into which the proposed data is split to the corresponding consensus backup node in the block chain through a Propose message;
    接收到数据块的共识备份节点对所述共识主节点提供的数据块进行纠删码校验,以在所述TendermintBFT协议的Pre-vote阶段,通过pre-vote消息将纠删码校验成功的数据块广播至其他共识备份节点;The consensus backup node that received the data block performs erasure code verification on the data block provided by the consensus master node, so that in the Pre-vote stage of the TendermintBFT protocol, the pre-vote message will pass the erasure code verification success The data block is broadcast to other consensus backup nodes;
    共识备份节点基于所述纠删码算法,将获得至少N-2f个的pre-vote消息中的数据块还原回所述提议数据,以在所述TendermintBFT协议的Pre-commit阶段,对还原回的所述提议数据执行所述TendermintBFT协议的共识逻辑,完成本轮共识,其中,N为所述区块链的共识节点数量,f为所述TendermintBFT协议设置的共识节点的容错数,N大于等于3f+1。Based on the erasure code algorithm, the consensus backup node restores the data blocks in the pre-vote messages obtained at least N-2f back to the proposed data, so that in the Pre-commit phase of the TendermintBFT protocol, the restored The proposed data executes the consensus logic of the TendermintBFT protocol to complete the current round of consensus, where N is the number of consensus nodes in the blockchain, f is the fault-tolerant number of consensus nodes set by the TendermintBFT protocol, and N is greater than or equal to 3f +1.
  2. 根据权利要求1所述的方法,还包括:The method according to claim 1, further comprising:
    接收到数据块的共识备份节点若纠删码校验失败,则在所述TendermintBFT协议的Pre-vote阶段,向其他共识节点广播pre-vote nil消息,所述pre-vote nil消息用于投票空区块。If the consensus backup node that receives the data block fails to verify the erasure code, it will broadcast a pre-vote nil message to other consensus nodes in the Pre-vote phase of the TendermintBFT protocol, and the pre-vote nil message is used to vote empty blocks.
  3. 根据权利要求2所述的方法,The method of claim 2,
    共识备份节点在所述TendermintBFT协议的Pre-vote阶段,基于所述纠删码算法,将已获得的pre-vote消息中的数据块还原回所述提议数据,包括:In the Pre-vote phase of the TendermintBFT protocol, the consensus backup node restores the data block in the obtained pre-vote message back to the proposed data based on the erasure code algorithm, including:
    共识备份节点在至少获得包含自身提供在内的N-f个Prevote消息后,基于所述纠删码算法,将已获得的Prevote消息中的数据快恢复成所述提议数据。After the consensus backup node obtains at least N-f Prevote messages including those provided by itself, based on the erasure code algorithm, quickly restore the data in the obtained Prevote messages to the proposed data.
  4. 根据权利要求3所述的方法,The method according to claim 3,
    共识备份节点在所述TendermintBFT协议的Pre-vote阶段,对还原回的所述提议数据执行所述TendermintBFT协议的共识逻辑,包括:In the Pre-vote phase of the TendermintBFT protocol, the consensus backup node executes the consensus logic of the TendermintBFT protocol on the restored proposed data, including:
    若共识备份节点基于所述纠删码算法还原回所述提议数据,则在所述TendermintBFT协议的Pre-vote阶段,向所述区块链的其他共识节点广播Pre-commit消息;其中,当本轮共识产生N-f个Pre-commit消息,则所述提议数据达成通过的共识。If the consensus backup node restores the proposed data based on the erasure code algorithm, then in the Pre-vote phase of the TendermintBFT protocol, broadcast a Pre-commit message to other consensus nodes of the blockchain; A round of consensus generates N-f Pre-commit messages, and the proposed data reaches a consensus.
  5. 根据权利要求3所述的方法,还包括:The method according to claim 3, further comprising:
    若共识备份节点未能还原回的所述提议数据,则在所述TendermintBFT协议的Pre-vote阶段,向所述区块链的其他共识节点广播Pre-commit nil消息;其中,当本轮共识产生f个Pre-commit nil消息,则所述提议数据直接确定达成未通过的共识。If the consensus backup node fails to restore the proposed data, it will broadcast the Pre-commit nil message to other consensus nodes of the blockchain during the Pre-vote phase of the TendermintBFT protocol; If there are f Pre-commit nil messages, the proposed data will directly determine that a failed consensus has been reached.
  6. 根据权利要求1-5中任一项所述的方法,The method according to any one of claims 1-5,
    所述提议数据拆分成的数据块对应有基于所述纠删码算法得到的默克尔树路径信息,所述共识主节点通过Propose消息还将所述提议数据拆分成的数据块所匹配的默克尔树路径信息发送至所述区块链中对应的共识备份节点;The data blocks into which the proposed data is split correspond to the Merkle tree path information obtained based on the erasure code algorithm, and the consensus master node also matches the data blocks into which the proposed data is split through the Propose message The Merkle tree path information is sent to the corresponding consensus backup node in the blockchain;
    接收到数据块的共识备份节点对所述共识主节点提供的数据块进行纠删码校验,包括:The consensus backup node that receives the data block performs erasure code verification on the data block provided by the consensus master node, including:
    接收到数据块的共识备份节点基于所述纠删码算法对所述共识主节点提供数据块进行默克尔树重建,若所述共识节点提供的默克尔树路径信息与重建的默克尔树匹配,则纠删码校验成功,否则纠删码校验失败。The consensus backup node that receives the data block performs Merkle tree reconstruction on the data block provided by the consensus master node based on the erasure code algorithm. If the Merkle tree path information provided by the consensus node is consistent with the reconstructed Merkle tree If the trees match, the erasure code verification succeeds, otherwise the erasure code verification fails.
  7. 根据权利要求1-5中任一项所述的方法,还包括:The method according to any one of claims 1-5, further comprising:
    接收到数据块的共识备份节点对所述共识主节点提供的数据块进行纠删码校验,包括:The consensus backup node that receives the data block performs erasure code verification on the data block provided by the consensus master node, including:
    若所述提议数据未在之前轮次的共识发起,则接收到数据块的共识备份节点对所述共识主节点提供的数据块进行纠删码校验,否则,直接通过之前轮次的共识缓存的所述提议数据,对所述共识主节点提供的数据块进行匹配校验,以代替纠删码校验。If the proposed data is not initiated in the consensus of the previous round, the consensus backup node that received the data block will perform erasure code verification on the data block provided by the consensus master node, otherwise, it will directly pass the consensus cache of the previous round The proposed data of the consensus master node performs a matching check on the data block provided by the consensus master node to replace the erasure code check.
  8. 一种区块链系统,包括:共识主节点和共识备份节点;其中:A blockchain system, including: a consensus master node and a consensus backup node; wherein:
    所述共识主节点在本轮共识发起时,基于纠删码算法将本轮共识的提议数据拆分成与所述区块链的共识备份节点相对应的数据块,其中,所述区块链采用TendermintBFT拜占庭协议进行共识;When the consensus master node initiates the current round of consensus, based on the erasure code algorithm, the proposed data of the current round of consensus is split into data blocks corresponding to the consensus backup nodes of the blockchain, wherein the blockchain Adopt TendermintBFT Byzantine agreement for consensus;
    所述共识主节点在所述TendermintBFT协议的Propose阶段,通过Propose消息将所述提议数据拆分成的数据块发送至所述区块链中对应的共识备份节点;In the Propose phase of the TendermintBFT protocol, the consensus master node sends the data blocks into which the proposed data is split to the corresponding consensus backup node in the block chain through a Propose message;
    接收到数据块的共识备份节点对所述共识主节点提供的数据块进行纠删码校验,以在所述TendermintBFT协议的Pre-vote阶段,通过pre-vote消息将纠删码校验成功的数据块广播至其他共识备份节点;The consensus backup node that received the data block performs erasure code verification on the data block provided by the consensus master node, so that in the Pre-vote stage of the TendermintBFT protocol, the pre-vote message will pass the erasure code verification success The data block is broadcast to other consensus backup nodes;
    所述共识备份节点基于所述纠删码算法,将获得至少N-2f个的pre-vote消息中的数据块还原回所述提议数据,以在所述TendermintBFT协议的Pre-commit阶段,对还原回的所述提议数据执行所述TendermintBFT协议的共识逻辑,完成本轮共识,其中,N为所述区块链的共识节点数量,f为所述TendermintBFT协议设置的共识节点的容错数, N大于等于3f+1。Based on the erasure code algorithm, the consensus backup node restores the data blocks in the pre-vote messages obtained at least N-2f back to the proposed data, so that in the Pre-commit phase of the TendermintBFT protocol, the restoration The proposed data returned executes the consensus logic of the TendermintBFT protocol to complete the current round of consensus, where N is the number of consensus nodes in the blockchain, f is the fault-tolerant number of consensus nodes set by the TendermintBFT protocol, and N is greater than It is equal to 3f+1.
  9. 一种区块链节点,包括:A blockchain node, comprising:
    纠删码模块,在本轮共识发起时,若所属区块链节点为共识主节点时,则基于纠删码算法将本轮共识的提议数据拆分成与所述区块链的共识备份节点相对应的数据块,其中,所述区块链采用TendermintBFT拜占庭协议进行共识;The erasure code module, when the current round of consensus is initiated, if the blockchain node to which it belongs is the consensus master node, then based on the erasure code algorithm, the proposed data of the current round of consensus is split into consensus backup nodes with the blockchain Corresponding data blocks, wherein, the blockchain adopts TendermintBFT Byzantine agreement for consensus;
    发送模块,若所属区块链节点为共识主节点时,在所述TendermintBFT协议的Propose阶段,通过Propose消息将所述提议数据拆分成的数据块发送至所述区块链中对应的共识备份节点;The sending module, if the block chain node to which it belongs is the consensus master node, in the Propose phase of the TendermintBFT protocol, send the data blocks into which the proposed data is split to the corresponding consensus backup in the block chain through the Propose message node;
    校验模块,若所属区块链节点为共识备份节点时,对所述共识主节点提供的数据块进行纠删码校验,以在所述TendermintBFT协议的Pre-vote阶段,通过pre-vote消息将纠删码校验成功的数据块广播至其他共识备份节点;The verification module, if the block chain node to which it belongs is a consensus backup node, performs erasure code verification on the data block provided by the consensus master node, so as to pass the pre-vote message in the Pre-vote stage of the TendermintBFT protocol Broadcast the data block with successful erasure code verification to other consensus backup nodes;
    还原模块,若所属区块链节点为共识备份节点时,基于所述纠删码算法,将获得至少N-2f个的pre-vote消息中的数据块还原回所述提议数据,以在所述TendermintBFT协议的Pre-commit阶段,对还原回的所述提议数据执行所述TendermintBFT协议的共识逻辑,完成本轮共识,其中,N为所述区块链的共识节点数量,f为所述TendermintBFT协议设置的共识节点的容错数,N大于等于3f+1。The restoration module, if the block chain node to which it belongs is a consensus backup node, based on the erasure code algorithm, restores the data blocks in the pre-vote messages obtained at least N-2f back to the proposed data, so as to In the Pre-commit phase of the TendermintBFT protocol, the consensus logic of the TendermintBFT protocol is executed on the restored proposed data to complete the current round of consensus, where N is the number of consensus nodes in the blockchain, and f is the TendermintBFT protocol The fault-tolerant number of consensus nodes set, N is greater than or equal to 3f+1.
  10. 一种电子设备包括:存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机程序,所述计算机程序被所述处理器执行:An electronic device includes: a memory, a processor, and a computer program stored on the memory and operable on the processor, the computer program being executed by the processor:
    在本轮共识发起时,若作为共识主节点时,则基于纠删码算法将本轮共识的提议数据拆分成与区块链的共识备份节点相对应的数据块,其中,所述区块链采用TendermintBFT拜占庭协议进行共识;When this round of consensus is initiated, if it is used as the consensus master node, the proposed data of this round of consensus will be split into data blocks corresponding to the consensus backup nodes of the blockchain based on the erasure code algorithm, wherein the block The chain adopts TendermintBFT Byzantine agreement for consensus;
    若作为共识备份节点,则在所述TendermintBFT协议的Propose阶段,通过Propose消息将所述提议数据拆分成的数据块发送至所述区块链中对应的共识备份节点;If it is used as a consensus backup node, in the Propose phase of the TendermintBFT protocol, the proposed data is split into data blocks and sent to the corresponding consensus backup node in the blockchain through a Propose message;
    若作为共识备份节点,则对所述共识主节点提供的数据块进行纠删码校验,以在所述TendermintBFT协议的Pre-vote阶段,通过pre-vote消息将纠删码校验成功的数据块广播至其他共识备份节点;If it is used as a consensus backup node, it will perform erasure code verification on the data blocks provided by the consensus master node, so that in the Pre-vote stage of the TendermintBFT protocol, the data that has been successfully verified by the erasure code through the pre-vote message The block is broadcast to other consensus backup nodes;
    若作为共识备份节点,则基于所述纠删码算法,将获得至少N-2f个的pre-vote消息中的数据块还原回所述提议数据,以在所述TendermintBFT协议的Pre-commit阶段,对还原回的所述提议数据执行所述TendermintBFT协议的共识逻辑,完成本轮共识,其中,N为所述区块链的共识节点数量,f为所述TendermintBFT协议设置的共识节点的容错数,N大于等于3f+1。If it is used as a consensus backup node, based on the erasure code algorithm, the data blocks in the pre-vote messages obtained at least N-2f will be restored to the proposed data, so that in the Pre-commit phase of the TendermintBFT protocol, Execute the consensus logic of the TendermintBFT protocol on the restored proposed data to complete the current round of consensus, where N is the number of consensus nodes in the blockchain, f is the fault tolerance number of consensus nodes set by the TendermintBFT protocol, N is greater than or equal to 3f+1.
  11. 一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现如下步骤:A computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the following steps are implemented:
    在本轮共识发起时,若作为共识主节点时,则基于纠删码算法将本轮共识的提议数据拆分成与区块链的共识备份节点相对应的数据块,其中,所述区块链采用TendermintBFT拜占庭协议进行共识;When this round of consensus is initiated, if it is used as the consensus master node, the proposed data of this round of consensus will be split into data blocks corresponding to the consensus backup nodes of the blockchain based on the erasure code algorithm, wherein the block The chain adopts TendermintBFT Byzantine agreement for consensus;
    若作为共识备份节点,则在所述TendermintBFT协议的Propose阶段,通过Propose消息将所述提议数据拆分成的数据块发送至所述区块链中对应的共识备份节点;If it is used as a consensus backup node, in the Propose phase of the TendermintBFT protocol, the proposed data is split into data blocks and sent to the corresponding consensus backup node in the blockchain through a Propose message;
    若作为共识备份节点,则对所述共识主节点提供的数据块进行纠删码校验,以在所述TendermintBFT协议的Pre-vote阶段,通过pre-vote消息将纠删码校验成功的数据块广播至其他共识备份节点;If it is used as a consensus backup node, it will perform erasure code verification on the data blocks provided by the consensus master node, so that in the Pre-vote stage of the TendermintBFT protocol, the data that has been successfully verified by the erasure code through the pre-vote message The block is broadcast to other consensus backup nodes;
    若作为共识备份节点,则基于所述纠删码算法,将获得至少N-2f个的pre-vote消息中的数据块还原回所述提议数据,以在所述TendermintBFT协议的Pre-commit阶段,对还原回的所述提议数据执行所述TendermintBFT协议的共识逻辑,完成本轮共识,其中,N为所述区块链的共识节点数量,f为所述TendermintBFT协议设置的共识节点的容错数,N大于等于3f+1。If it is used as a consensus backup node, based on the erasure code algorithm, the data blocks in the pre-vote messages obtained at least N-2f will be restored to the proposed data, so that in the Pre-commit phase of the TendermintBFT protocol, Execute the consensus logic of the TendermintBFT protocol on the restored proposed data to complete the current round of consensus, where N is the number of consensus nodes in the blockchain, f is the fault tolerance number of consensus nodes set by the TendermintBFT protocol, N is greater than or equal to 3f+1.
PCT/CN2022/107791 2021-09-24 2022-07-26 Consensus on blockchain WO2023045533A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111124489.XA CN113761069A (en) 2021-09-24 2021-09-24 Block chain consensus method, system, node and electronic equipment
CN202111124489.X 2021-09-24

Publications (1)

Publication Number Publication Date
WO2023045533A1 true WO2023045533A1 (en) 2023-03-30

Family

ID=78797332

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/107791 WO2023045533A1 (en) 2021-09-24 2022-07-26 Consensus on blockchain

Country Status (2)

Country Link
CN (1) CN113761069A (en)
WO (1) WO2023045533A1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113761069A (en) * 2021-09-24 2021-12-07 支付宝(杭州)信息技术有限公司 Block chain consensus method, system, node and electronic equipment
CN114710512B (en) * 2022-03-30 2023-09-29 蚂蚁区块链科技(上海)有限公司 Method for distributing consensus result, node and blockchain system

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109345386A (en) * 2018-08-31 2019-02-15 阿里巴巴集团控股有限公司 Transaction common recognition processing method and processing device, electronic equipment based on block chain
CN109379397A (en) * 2018-08-31 2019-02-22 阿里巴巴集团控股有限公司 Transaction common recognition processing method and processing device, electronic equipment based on block chain
CN111526217A (en) * 2020-07-03 2020-08-11 支付宝(杭州)信息技术有限公司 Consensus method and system in block chain
CN111526219A (en) * 2020-07-03 2020-08-11 支付宝(杭州)信息技术有限公司 Alliance chain consensus method and alliance chain system
CN113761069A (en) * 2021-09-24 2021-12-07 支付宝(杭州)信息技术有限公司 Block chain consensus method, system, node and electronic equipment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109345386A (en) * 2018-08-31 2019-02-15 阿里巴巴集团控股有限公司 Transaction common recognition processing method and processing device, electronic equipment based on block chain
CN109379397A (en) * 2018-08-31 2019-02-22 阿里巴巴集团控股有限公司 Transaction common recognition processing method and processing device, electronic equipment based on block chain
CN111526217A (en) * 2020-07-03 2020-08-11 支付宝(杭州)信息技术有限公司 Consensus method and system in block chain
CN111526219A (en) * 2020-07-03 2020-08-11 支付宝(杭州)信息技术有限公司 Alliance chain consensus method and alliance chain system
CN113761069A (en) * 2021-09-24 2021-12-07 支付宝(杭州)信息技术有限公司 Block chain consensus method, system, node and electronic equipment

Also Published As

Publication number Publication date
CN113761069A (en) 2021-12-07

Similar Documents

Publication Publication Date Title
CN111526219B (en) Alliance chain consensus method and alliance chain system
WO2023045533A1 (en) Consensus on blockchain
TWI698767B (en) Blockchain-based transaction consensus processing method and device, and electronic equipment
US11327840B1 (en) Multi-stage data recovery in a distributed storage network
US9710346B2 (en) Decoupled reliability groups
WO2020151323A1 (en) Data slicing-based data storage method, device, and medium
CN106776130B (en) Log recovery method, storage device and storage node
CN109783014B (en) Data storage method and device
US20030066010A1 (en) Xor processing incorporating error correction code data protection
US11366932B2 (en) Consensus method and data verification method, apparatus, and system of consortium blockchain
US7836387B1 (en) System and method for protecting data across protection domain boundaries
EP3934163A1 (en) Methods and consensus nodes for block generation
CN114584312B (en) Consensus method, block chain system and consensus node
CN113849564B (en) Block chain consensus method, consensus node and electronic equipment
CN113852691A (en) Block chain consensus method, consensus node and electronic equipment
CN113326006A (en) Distributed block storage system based on erasure codes
CN113873030A (en) Block chain consensus method, consensus node and electronic equipment
CN112835743A (en) Distributed account book data storage optimization method and device, electronic equipment and medium
WO2023056967A1 (en) Consensus method, blockchain system and consensus nodes
CN111782152A (en) Data storage method, data recovery device, server and storage medium
CN111090540A (en) Data processing method and device based on erasure codes
CN112543920B (en) Data reconstruction method, device, computer equipment, storage medium and system
CN110442601B (en) Openstack mirror image data parallel acceleration method and device
WO2021190031A1 (en) Wdm-based data transmission method, apparatus, and system, and storage medium
CN111522696B (en) Downtime processing method, data persistence method and hardware of block chain common identification node

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22871592

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE