Movatterモバイル変換


[0]ホーム

URL:


CN111147261B - Method and system for using HotStuff consensus algorithm in block chain - Google Patents

Method and system for using HotStuff consensus algorithm in block chain
Download PDF

Info

Publication number
CN111147261B
CN111147261BCN201911414474.XACN201911414474ACN111147261BCN 111147261 BCN111147261 BCN 111147261BCN 201911414474 ACN201911414474 ACN 201911414474ACN 111147261 BCN111147261 BCN 111147261B
Authority
CN
China
Prior art keywords
block
stage
node
submission
certificate
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201911414474.XA
Other languages
Chinese (zh)
Other versions
CN111147261A (en
Inventor
石宁
杨昕
甘子荣
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nanjing Trusted Blockchain And Algorithm Economics Research Institute Co ltd
Original Assignee
Nanjing Trusted Blockchain And Algorithm Economics Research Institute Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Nanjing Trusted Blockchain And Algorithm Economics Research Institute Co ltdfiledCriticalNanjing Trusted Blockchain And Algorithm Economics Research Institute Co ltd
Priority to CN201911414474.XApriorityCriticalpatent/CN111147261B/en
Publication of CN111147261ApublicationCriticalpatent/CN111147261A/en
Application grantedgrantedCritical
Publication of CN111147261BpublicationCriticalpatent/CN111147261B/en
Activelegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Images

Classifications

Landscapes

Abstract

The invention discloses a method and a system for using a HotStuff consensus algorithm in a block chain, wherein the method comprises the following steps: initiating a proposal through a leader node, broadcasting the proposal to a copy node, and generating a prepared certificate; the leader node broadcasts the prepared certificate to the replica node to generate a pre-submitted certificate; the leader node broadcasts the pre-submitted certificate to the replica nodes to generate submitted certificates; the leader node broadcasts the submission certificate to the replica nodes, and all the replica nodes execute the proposal; restarting the nodes according to the flow table and the block data table; and carrying out initial starting of the nodes according to the flow table and the block data table. The invention adds the steps of initial node starting and node restarting, improves the completeness of the engineering process, perfects the normal operation of the block chain system, can ensure the data integrity of the consensus certification process, is convenient for the synchronization and verification of the subsequent node data, and can be widely applied to the technical field of block chains.

Description

Translated fromChinese
在区块链中使用HotStuff共识算法的方法及系统Method and system for using HotStuff consensus algorithm in blockchain

技术领域technical field

本发明涉及区块链技术领域,尤其是一种在区块链中使用HotStuff共识算法的方法及系统。The present invention relates to the technical field of blockchain, in particular to a method and system for using the HotStuff consensus algorithm in the blockchain.

背景技术Background technique

HotStuff算法是一个针对区块链的PBFT类共识算法,比如Facebook的区块链项目Libra采用的共识算法就是基于HotStuff算法,该算法通过聚合签名和流水线设计,使得算法的通信复杂度和计算复杂度都下降到O(n)。The HotStuff algorithm is a PBFT-type consensus algorithm for blockchain. For example, the consensus algorithm used by Facebook's blockchain project Libra is based on the HotStuff algorithm. The algorithm uses aggregated signatures and pipeline design to make the algorithm communication complexity and computational complexity. Both drop to O(n).

在HotStuff算法下,针对每一个区块的共识,分为四个阶段:预备阶段(Prepare),预提交阶段(Pre-commit),提交阶段(Commit),决定阶段(Decide),其中前三个阶段本质上都是通过“投票”动作来实现,即在Prepare,Pre-commit,Commit阶段都进行一次投票,当且仅当投票票数超过节点总数的2/3表示该阶段共识成功,并进入下一个阶段。每一个阶段的投票结果用QC(Quorum Certificate)来表示。在流水线设计中,将相邻区块的共识阶段的“投票”动作进行复用,即第一个区块的Pre-commit阶段同时完成第二个区块的Prepare阶段,第一个区块的Commit阶段同时完成第二个区块的Pre-commit阶段以及第三个区块的Prepare阶段,第一个区块的Decide阶段同时是第二个区块的Commit阶段,第三个区块的Pre-commit阶段以及第四个区块的Prepare阶段,并以此类推,相邻区块使用区块哈希值作为指向关系。在具体的流水线设计中,共识过程由多个轮次组成,每一个轮次称作一个视图(View),每一个View有一个Leader节点,每一个View中重复相同的动作,即每一个View的Leader节点将上一个View中的投票结果和本阶段的提出的区块同时广播给其他节点,本View中的Leader收集本阶段的投票结果然后发送给下一轮的Leader节点。每一个投票表示对提出的区块以及祖先区块(通过哈希值追溯)的“投票”,也就是确认投票结果或者是确认提交。Under the HotStuff algorithm, the consensus for each block is divided into four stages: preparation stage (Prepare), pre-commit stage (Pre-commit), commit stage (Commit), decision stage (Decide), of which the first three The stage is essentially achieved through the "voting" action, that is, a vote is carried out in the Prepare, Pre-commit, and Commit stages. If and only if the number of votes exceeds 2/3 of the total number of nodes, the consensus at this stage is successful, and the next stage is entered. a stage. The voting result of each stage is represented by QC (Quorum Certificate). In the pipeline design, the "voting" action of the consensus stage of adjacent blocks is reused, that is, the Pre-commit stage of the first block completes the Prepare stage of the second block at the same time, and the first block's Pre-commit stage The Commit stage simultaneously completes the Pre-commit stage of the second block and the Prepare stage of the third block, the Decide stage of the first block is also the Commit stage of the second block, and the Pre-commit stage of the third block -commit phase and the Prepare phase of the fourth block, and so on, adjacent blocks use the block hash value as the pointing relationship. In the specific pipeline design, the consensus process consists of multiple rounds, each round is called a View, each View has a Leader node, and the same actions are repeated in each View, that is, each View’s The leader node broadcasts the voting results in the previous view and the proposed blocks in this stage to other nodes at the same time. The leader in this view collects the voting results in this stage and sends them to the next round of leader nodes. Each vote represents a "vote" for the proposed block and ancestor blocks (traced back by hash), ie confirming the result of the vote or confirming the commit.

在HotStuff共识算法中,当且仅当一个区块到了Decide阶段,该区块才算真正意义上的被共识完成。而每一个区块需要经历四个阶段才能最终被共识,在现有技术的HotStuff算法中只提供了使用算法的分布式系统的初次启动以及正常运行的过程的实现,但是并没有分布式系统节点全部重启的处理方法。在实际的情况中,特别是区块链中的联盟链中,存在节点重启的问题,如果没有针对节点重启的考虑,在工程化过程中就会存在不完备的情况,最终导致整个区块链系统无法正常运行。In the HotStuff consensus algorithm, if and only when a block reaches the Decide stage, the block is considered to be completed by consensus in the true sense. Each block needs to go through four stages before it can be finally reached consensus. In the prior art HotStuff algorithm, only the initial startup of the distributed system using the algorithm and the realization of the normal operation process are provided, but there is no distributed system node. How to do all restarts. In the actual situation, especially in the alliance chain in the blockchain, there is the problem of node restart. If there is no consideration for node restart, there will be incompleteness in the engineering process, which will eventually lead to the entire blockchain. The system is not functioning properly.

发明内容SUMMARY OF THE INVENTION

有鉴于此,本发明实施例提供一种能够进行节点重启以及节点初次启动的,在区块链中使用HotStuff共识算法的方法及系统。In view of this, the embodiments of the present invention provide a method and system for using the HotStuff consensus algorithm in a blockchain that can restart a node and start a node for the first time.

本发明的第一方面提供了一种在区块链中使用HotStuff共识算法的方法,包括预备阶段、预提交阶段、提交阶段和决定阶段;其中,A first aspect of the present invention provides a method for using the HotStuff consensus algorithm in a blockchain, including a preparatory phase, a pre-commit phase, a commit phase and a decision phase; wherein,

所述预备阶段包括:通过领导节点发起提案,并将该提案广播给副本节点,生成预备证书;所述预提交阶段包括:领导节点将所述预备证书广播给副本节点,生成预提交证书;The pre-submission stage includes: initiating a proposal through the leader node, and broadcasting the proposal to the replica nodes to generate a pre-submission certificate; the pre-submission stage includes: the leader node broadcasting the pre-submission certificate to the replica nodes to generate a pre-submission certificate;

所述提交阶段包括:领导节点将所述预提交证书广播给副本节点,生成提交证书;The submission stage includes: the leader node broadcasts the pre-submission certificate to the replica nodes, and generates a submission certificate;

所述决定阶段包括:领导节点将所述提交证书广播给副本节点,由所有副本节点执行所述提案;The decision stage includes: the leader node broadcasts the submission certificate to the replica nodes, and all the replica nodes execute the proposal;

其中,当区块处于预提交阶段时,将该区块持久化存储到流水表中;当区块处于决定阶段时,将该区块持久化存储到区块数据表中;Among them, when the block is in the pre-commit stage, the block is persistently stored in the flow table; when the block is in the decision stage, the block is persistently stored in the block data table;

根据所述流水表和所述区块数据表,进行节点重启;Restart the node according to the flow table and the block data table;

根据所述流水表和所述区块数据表,进行节点的初次启动。According to the flow table and the block data table, the initial startup of the node is performed.

进一步,所述通过领导节点发起提案,并将该提案广播给副本节点,生成预备证书,包括:Further, the proposal is initiated through the leader node, and the proposal is broadcast to the replica nodes to generate a preliminary certificate, including:

通过可验证随机的方式确定领导节点;Determine the leader node in a verifiably random way;

通过领导节点发起提案;Initiate proposals through the leader node;

将所述提案广播给区块链中的所有副本节点;broadcast the proposal to all replica nodes in the blockchain;

所述副本节点根据所述提案的合法性,向领导节点反馈第一签名信息;The replica node feeds back the first signature information to the leader node according to the validity of the proposal;

将所有副本节点的第一签名信息打包得到预备证书。The first signature information of all replica nodes is packaged to obtain a preliminary certificate.

进一步,所述领导节点将所述预备证书广播给副本节点,生成预提交证书,包括:Further, the leader node broadcasts the preliminary certificate to the replica nodes, and generates a pre-submission certificate, including:

领导节点将预备证书广播给所有副本节点;The leader node broadcasts the prepared certificate to all replica nodes;

副本节点根据预备证书的合法性,向领导节点反馈第二签名信息;The replica node feeds back the second signature information to the leader node according to the validity of the prepared certificate;

将所有副本节点的第二签名信息打包得到预提交证书。Package the second signature information of all replica nodes to obtain a pre-submission certificate.

进一步,所述领导节点将所述预提交证书广播给副本节点,生成提交证书,包括:Further, the leader node broadcasts the pre-submission certificate to the replica nodes, and generates a submission certificate, including:

领导节点将预提交证书广播给所有副本节点;The leader node broadcasts the pre-commit certificate to all replica nodes;

副本节点根据预提交证书的合法性,向领导节点反馈第三签名信息;The replica node feeds back the third signature information to the leader node according to the validity of the pre-submitted certificate;

将所有副本节点的第三签名信息打包得到提交证书。Package the third signature information of all replica nodes to obtain the submission certificate.

进一步,所述领导节点将所述提交证书广播给副本节点,由所有副本节点执行所述提案,包括:Further, the leader node broadcasts the submission certificate to the replica nodes, and all the replica nodes execute the proposal, including:

领导节点将所述提交证书广播给所有副本节点;The leader node broadcasts the submission certificate to all replica nodes;

副本节点根据所述提交证书的合法性,确定所述提案已经在区块链中达成共识,执行所述提案。The replica node determines that the proposal has reached a consensus in the blockchain according to the validity of the submitted certificate, and executes the proposal.

进一步,所述根据所述流水表和所述区块数据表,进行节点重启,包括:Further, performing node restart according to the flow table and the block data table, including:

从区块数据表中读取最新处于决定阶段的区块的信息;Read the latest block information in the decision stage from the block data table;

根据该区块的信息从流水表中读取对应的预提交阶段和提交阶段的区块的信息;According to the information of the block, read the information of the corresponding pre-commit stage and the block in the commit stage from the flow table;

生成一个空白区块来代替最新处于预备阶段的区块;Generate a blank block to replace the latest block in the preparatory stage;

以及,as well as,

所述节点基于所述提交阶段、预提交阶段以及预备阶段的区块进行数据同步并在完成后参与共识。The nodes perform data synchronization based on the blocks in the commit phase, the pre-commit phase, and the preliminary phase, and participate in consensus after completion.

进一步,所述节点基于所述提交阶段、预提交阶段以及预备阶段的区块进行数据同步并在完成后参与共识这一步骤,包括:Further, the node performs data synchronization based on the blocks in the submission stage, the pre-submission stage and the preparatory stage and participates in the consensus step after completion, including:

若区块链中存在正在共识的节点,则直接同步最新的提交阶段、预提交阶段以及预备阶段区块和所有已经执行的区块数据后,参与共识流程;If there is a consensus node in the blockchain, it will directly synchronize the latest submission stage, pre-submission stage and pre-stage block data and all executed block data, and then participate in the consensus process;

若区块链中不存在正在共识的节点,则直接基于上述的预提交阶段,提交阶段以及预备阶段的区块开始进行共识。If there is no consensus node in the blockchain, consensus will be started directly based on the above-mentioned pre-commit stage, blocks in the submission stage and the pre-stage stage.

进一步,所述根据所述流水表和所述区块数据表,进行节点的初次启动,包括:Further, the initial startup of the node according to the flow table and the block data table includes:

当区块链中只存在初次启动的节点时:When there are only nodes that are started for the first time in the blockchain:

生成三个创世块;其中第一创世块作为决定阶段的区块,第二创世块作为提交阶段的区块,第三创世块作为预提交阶段的区块;生成空白区块作为预备阶段的区块;根据所述三个创世块和空白区块,然后执行根据所述流水表和所述区块数据表进行节点重启的步骤;Three genesis blocks are generated; the first genesis block is used as a block in the decision stage, the second genesis block is used as a block in the submission stage, and the third genesis block is used as a block in the pre-commit stage; a blank block is generated as The block in the preparatory stage; according to the three genesis blocks and the blank block, then perform the steps of restarting the node according to the flow table and the block data table;

当区块链中存在非初次启动的节点时:When there are non-initially started nodes in the blockchain:

将区块链中初次启动节点同步所述非初次启动节点上的区块数据,然后执行根据所述流水表和所述区块数据表进行节点重启的步骤。Synchronize the block data on the non-initially started node in the block chain with the initial startup node, and then perform the steps of restarting the node according to the flow table and the block data table.

第二方面,本发明实施例还提供了一种在区块链中使用HotStuff共识算法的系统,包括:In a second aspect, an embodiment of the present invention also provides a system for using the HotStuff consensus algorithm in a blockchain, including:

预备模块,用于通过领导节点发起提案,并将该提案广播给副本节点,生成预备证书;The preparatory module is used to initiate a proposal through the leader node, broadcast the proposal to the replica nodes, and generate a preparatory certificate;

预提交模块,用于领导节点将所述预备证书广播给副本节点,生成预提交证书;A pre-submission module, used for the leader node to broadcast the pre-submission certificate to the replica nodes to generate a pre-submission certificate;

提交模块,用于领导节点将所述预提交证书广播给副本节点,生成提交证书;A submission module, used for the leader node to broadcast the pre-submission certificate to the replica nodes to generate a submission certificate;

决定模块,用于领导节点将所述提交证书广播给副本节点,由所有副本节点执行所述提案;a decision module, used for the leader node to broadcast the submission certificate to the replica nodes, and all the replica nodes execute the proposal;

其中,当区块处于预提交阶段时,将该区块持久化存储到流水表中;当区块处于决定阶段时,将该区块持久化存储到区块数据表中;Among them, when the block is in the pre-commit stage, the block is persistently stored in the flow table; when the block is in the decision stage, the block is persistently stored in the block data table;

重启模块,用于根据所述流水表和所述区块数据表,进行节点重启;a restart module, configured to restart the node according to the flow table and the block data table;

初次启动模块,用于根据所述流水表和所述区块数据表,进行节点的初次启动。The initial startup module is used for initial startup of the node according to the flow table and the block data table.

第三方面,本发明实施例还提供了一种在区块链中使用HotStuff共识算法的系统,包括:In a third aspect, an embodiment of the present invention also provides a system for using the HotStuff consensus algorithm in a blockchain, including:

至少一个处理器;at least one processor;

至少一个存储器,用于存储至少一个程序;at least one memory for storing at least one program;

当所述至少一个程序被所述至少一个处理器执行,使得所述至少一个处理器实现所述的方法。The at least one program, when executed by the at least one processor, causes the at least one processor to implement the method.

第四方面,本发明实施例还提供了一种存储介质,其中存储有处理器可执行的指令,所述处理器可执行的指令在由处理器执行时用于执行所述的方法。In a fourth aspect, an embodiment of the present invention further provides a storage medium, in which processor-executable instructions are stored, and the processor-executable instructions are used to execute the method when executed by the processor.

上述本发明实施例中的一个或多个技术方案具有如下优点:本发明的实施例在HotStuff共识算法的流程下加入了节点初次启动和节点重启的步骤,提高了工程化过程中的完备程度,完善整个区块链系统的正常运行;另外,本发明增设了流水表和区块数据表,能够保证共识证明过程的数据完整性,以及便于后续节点数据的同步和验证。One or more of the technical solutions in the above embodiments of the present invention have the following advantages: the embodiments of the present invention add steps of initial node startup and node restart in the process of the HotStuff consensus algorithm, which improves the degree of completeness in the engineering process, Improve the normal operation of the entire blockchain system; in addition, the present invention adds a running water table and a block data table, which can ensure the data integrity of the consensus proof process and facilitate the synchronization and verification of subsequent node data.

附图说明Description of drawings

为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to illustrate the technical solutions in the embodiments of the present application more clearly, the following briefly introduces the drawings that are used in the description of the embodiments. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can also be obtained from these drawings without creative effort.

图1为HotStuff共识算法流水线示意图;Figure 1 is a schematic diagram of the HotStuff consensus algorithm pipeline;

图2为HotStuff共识算法流程图;Figure 2 is the flowchart of the HotStuff consensus algorithm;

图3为共识过程中数据持久化示意图;Figure 3 is a schematic diagram of data persistence in the consensus process;

图4为HotStuff共识节点启动处理流程图。Figure 4 is a flowchart of the HotStuff consensus node startup process.

具体实施方式Detailed ways

下面结合说明书附图和具体实施例对本发明作进一步解释和说明。对于本发明实施例中的步骤编号,其仅为了便于阐述说明而设置,对步骤之间的顺序不做任何限定,实施例中的各步骤的执行顺序均可根据本领域技术人员的理解来进行适应性调整。The present invention will be further explained and illustrated below in conjunction with the accompanying drawings and specific embodiments of the description. The step numbers in the embodiments of the present invention are set only for the convenience of elaboration, and the sequence between the steps is not limited, and the execution sequence of the steps in the embodiments can be performed according to the understanding of those skilled in the art Adaptive adjustment.

在共识过程中,每一个节点需要依靠最新的决定区块,提交区块,预提交区块及预备区块来进行后续的共识操作,上述四种区块分别对应决定,提交,预提交,预备这四个共识阶段,本申请实施例假设共有n=3f+1个节点,则共识过程中,参照图1和图2,四个阶段中进行的操作步骤如下:In the consensus process, each node needs to rely on the latest decision block, commit block, pre-commit block and preparatory block for subsequent consensus operations. The above four blocks correspond to decision, commit, pre-commit, and prep For these four consensus stages, the embodiment of the present application assumes that there are n=3f+1 nodes in total. In the consensus process, referring to FIG. 1 and FIG. 2 , the operation steps performed in the four stages are as follows:

S1:预备阶段(Prepare):按照可验证随机方式来挑选一个领导节点(Leader),Leader负责提出一个提案(Proposal),并将该Proposal广播给所有其他副本节点(Replica);其他副本节点(Replica)在接受到所述Proposal后,如果确认合法,则使用Replica的私钥对Proposal进行签名并发送给Leader,一个签名(即第一签名信息)表示一个投票,如果确认Proposal非法,则忽略;Leader在接收到至少n-f个节点的针对Prepare中提出的Proposal的签名后,将这n-f个签名打包成一个法定人数证书(QuorumCertificate),简称QC,在Prepare阶段生成的QC也称作预备证书(PrepareQC);S1: Preparing stage (Prepare): select a leader node (Leader) in a verifiable random way, the leader is responsible for making a proposal (Proposal), and broadcasting the proposal to all other replica nodes (Replica); other replica nodes (Replica) ) After receiving the Proposal, if it is confirmed to be legal, use the Replica's private key to sign the Proposal and send it to the Leader. One signature (ie, the first signature information) represents a vote. If it is confirmed that the Proposal is illegal, ignore it; the Leader After receiving the signatures of at least n-f nodes for the proposal proposed in Prepare, the n-f signatures are packaged into a QuorumCertificate (QC for short), and the QC generated in the Prepare stage is also called Prepare QC (PrepareQC) ;

S2:预提交阶段(Pre-commit):Leader将PrepareQC广播给所有Replica,Replica在接收到PrepareQC后,如果确认合法,则使用私钥对PrepareQC签名,并将签名发送给Leader。Leader在接收到至少n-f个针对PrepareQC的签名(即第二签名信息)后,将其打包成一个新的QC,这个阶段的QC也称预提交证书(PreCommitQC);S2: Pre-commit stage: The Leader broadcasts PrepareQC to all Replicas. After Replica receives PrepareQC, if it is confirmed to be legal, it signs PrepareQC with its private key and sends the signature to the Leader. After the Leader receives at least n-f signatures for PrepareQC (that is, the second signature information), it packages it into a new QC. The QC at this stage is also called a pre-commit certificate (PreCommitQC);

S3:提交阶段(Commit):Leader将PreCommitQC广播给所有Replica,Replica在接收到PreCommitQC后,如果确认合法,则使用私钥对PreCommitQC签名,并将签名发送给Leader。Leader在接收到至少n-f个针对PreCommitQC的签名(即第三签名信息)后,将其打包成一个新的QC,这个阶段的QC也称提交证书(CommitQC);S3: Commit stage (Commit): Leader broadcasts PreCommitQC to all Replica. After Replica receives PreCommitQC, if it confirms that it is legal, it signs PreCommitQC with its private key and sends the signature to Leader. After the Leader receives at least n-f signatures for PreCommitQC (that is, the third signature information), it packages it into a new QC. The QC at this stage is also called the CommitQC;

S4:决定阶段(Decide):Leader将CommitQC广播给所有Replica,Replica在接收到CommitQC后,如果确认合法,则表示Prepare阶段中的Proposal已经达成共识,执行Proposal中的交易。S4: Decision stage (Decide): The Leader broadcasts CommitQC to all Replica. After Replica receives CommitQC, if it confirms that it is legal, it means that the Proposal in the Prepare stage has reached a consensus and executes the transaction in the Proposal.

上述共识流程在HotStuff共识算法中,进一步用“流水线”的方式来改进,改进方式如下:The above consensus process is further improved by the "pipeline" method in the HotStuff consensus algorithm. The improvement method is as follows:

1、每一个Proposal会指定一个上一个Proposal,在区块链中就是每一个Proposal对应一个区块,每一个区块都会之指定父区块;1. Each Proposal will specify a previous Proposal. In the blockchain, each Proposal corresponds to a block, and each block will specify the parent block;

2、整个共识过程由持续的轮组成,每一轮中做同样的动作:Leader提出一个Proposal,将Proposal和上一轮中生成的QC一起打包广播给Replica,Replica节点在确认Proposal以及QC的合法性后,用私钥对Proposal签名,Leader收集至少n-f个签名后打包成一个通用证书(Generic QC),这个通用证书就是下一轮Leader广播中的QC;2. The entire consensus process consists of continuous rounds, and the same action is performed in each round: the leader proposes a proposal, and packages the proposal and the QC generated in the previous round to Replica, and the Replica node confirms the validity of the Proposal and QC. After sex, use the private key to sign the Proposal, and the leader collects at least n-f signatures and packages them into a general certificate (Generic QC). This general certificate is the QC in the next round of leader broadcasting;

3、在逻辑上,每一轮生成的QC是本轮Proposal的PrepareQC,同时是上一轮的Proposal的PreCommitQC,同时是上上一轮的Proposal的CommitQC,指向关系由Proposal中指定的上一个Proposal来指定,因此可以通过回溯来确定一个Proposal在逻辑上的CommitQC是否以及生成,如果Replica接收到一个Proposal在逻辑上对应的CommitQC,则执行该Proposal;3. Logically, the QC generated in each round is the PrepareQC of the current Proposal, the PreCommitQC of the Proposal of the previous round, and the CommitQC of the Proposal of the previous round, pointing to the previous Proposal whose relationship is specified in the Proposal Therefore, it can be determined by backtracking whether the logical CommitQC of a Proposal is generated and generated. If Replica receives a CommitQC logically corresponding to a Proposal, the Proposal is executed;

参照图1和图2,在“流水线”的设计中可以看到,一个区块(即区块链语境下的Proposal)是否已经达成共识,需要依赖后续的两个区块及其两个区块各自的GenericQC来证明,为了保证节点能够在初次启动或者重启时能够正常运行,需要对这些区块数据进行适当存储,具体如下:Referring to Figures 1 and 2, it can be seen in the design of the "pipeline" that whether a block (that is, a proposal in the context of blockchain) has reached a consensus depends on the subsequent two blocks and their two blocks The GenericQC of each block is used to prove that in order to ensure that the node can operate normally when it is initially started or restarted, it is necessary to properly store these block data, as follows:

1、当一个区块处于Pre-commit阶段时,参照图3,将该区块持久化到一个“流水表”中,所谓流水表,该流水表中的区块不一定最终会被Decide,但是都是节点进行后续共识的根据;1. When a block is in the Pre-commit stage, referring to Figure 3, the block is persisted to a "flow meter", the so-called flow meter, the block in the flow meter may not be Decide in the end, but All are the basis for the subsequent consensus of nodes;

2、当一个区块处于Decide阶段时,将该区块持久化到“区块数据表”中,该数据表中的数据表示达到了确定性的一致性;该区块数据表存储的就是已经达成共识的区块本身。2. When a block is in the Decide stage, the block is persisted to the "block data table", and the data representation in the data table has reached deterministic consistency; The consensus block itself.

3、当节点重启时,首先从“区块数据表”中读取最新被Decide的区块数据,然后根据该区块数据从流水表中读取相邻的处于Pre-commit阶段和Commit阶段的区块数据,并生成一个空块来代替最新的处于Prepare阶段的区块。此时节点可能面临两种情况:3. When the node restarts, first read the latest Decide block data from the "block data table", and then read the adjacent blocks in the Pre-commit stage and the Commit stage from the flow table according to the block data. block data, and generate an empty block to replace the latest block in the Prepare phase. At this point, the node may face two situations:

a)、系统中存在正在共识的其他节点,此时,重启的节点只需要同步其他节点的所有已经Decide的区块数据和当前Prepare,Pre-commit,Commit的区块数据即可,因为在HotStuff中只处于Prepare阶段的区块可以被轻松丢弃,因此,此处的“空块”不会影响重启节点的后续的共识;a) There are other nodes in the system that are in the process of consensus. At this time, the restarted node only needs to synchronize all the Decide block data of other nodes and the current Prepare, Pre-commit, Commit block data, because in HotStuff Blocks that are only in the Prepare stage can be easily discarded, so the "empty blocks" here will not affect the subsequent consensus of restarting nodes;

b)、系统中共识已经停止,即所有的节点都在等待状态同步然后再开始共识,当状态完成同步后,所有节点的状态除了Prepare的区块以外都一样,但是按照HotStuff的共识过程算法,此时的Leader节点只会基于Pre-commit阶段的区块提出新的区块,然后进行后续的共识,因此,此处的“空块”同样不会影响重启后节点的后续共识。b) The consensus in the system has stopped, that is, all nodes are waiting for state synchronization before starting consensus. When the state is synchronized, the state of all nodes is the same except for the Prepare block, but according to HotStuff's consensus process algorithm, At this time, the leader node will only propose a new block based on the block in the Pre-commit stage, and then carry out the subsequent consensus. Therefore, the "empty block" here will also not affect the subsequent consensus of the node after restart.

4、当节点初次启动时,参照图4,也存在两种情况:4. When the node is started for the first time, referring to Figure 4, there are also two situations:

a)、系统中都是初次启动的节点,此时系统约定生成三个创世块(包括第一创世块、第二创世块和第三创世块),这三个创世块使用写在代码中的方式在开发阶段就确定,不需要节点的“投票”来确定合法性,第一个创世块充当最新被Decide的区块,第二,三个创世块分别充当处于Commit和Pre-commit阶段的区块,然后节点再生成一个空块来充当处于Prepare阶段的区块,此时节点的状态就可以和3中重启节点的一致,后续处理逻辑也一致;a) The nodes in the system are all started for the first time. At this time, the system agrees to generate three genesis blocks (including the first genesis block, the second genesis block and the third genesis block). These three genesis blocks use The method written in the code is determined in the development stage, and does not require the "voting" of the nodes to determine the legitimacy. The first genesis block acts as the latest Decide block, and the second and three genesis blocks act as Commit. And the block in the Pre-commit stage, and then the node generates an empty block to act as the block in the Prepare stage. At this time, the state of the node can be the same as that of the restarted node in 3, and the subsequent processing logic is also the same;

b)、如果系统中存在非初次启动的节点,则初次启动节点直接同步该节点的所有已经Decide的区块数据和当前处于Commit,Pre-commit和Prepare的区块数据,同步完成后,节点的状态也和3中节点重启一致,后续处理逻辑也一致。b) If there is a node that is not started for the first time in the system, the node that is started for the first time directly synchronizes all the Decide block data of the node and the block data currently in Commit, Pre-commit and Prepare. After the synchronization is completed, the node's The state is also consistent with the node restart in 3, and the subsequent processing logic is also consistent.

本发明实施例还提供了一种在区块链中使用HotStuff共识算法的系统,包括:The embodiment of the present invention also provides a system for using the HotStuff consensus algorithm in the blockchain, including:

预备模块,用于通过领导节点发起提案,并将该提案广播给副本节点,生成预备证书;The preparatory module is used to initiate a proposal through the leader node, broadcast the proposal to the replica nodes, and generate a preparatory certificate;

预提交模块,用于领导节点将所述预备证书广播给副本节点,生成预提交证书;A pre-submission module, used for the leader node to broadcast the pre-submission certificate to the replica nodes to generate a pre-submission certificate;

提交模块,用于领导节点将所述预提交证书广播给副本节点,生成提交证书;A submission module, used for the leader node to broadcast the pre-submission certificate to the replica nodes to generate a submission certificate;

决定模块,用于领导节点将所述提交证书广播给副本节点,由所有副本节点执行所述提案;a decision module, used for the leader node to broadcast the submission certificate to the replica nodes, and all the replica nodes execute the proposal;

其中,当区块处于预提交阶段时,将该区块持久化存储到流水表中;当区块处于决定阶段时,将该区块持久化存储到区块数据表中;Among them, when the block is in the pre-commit stage, the block is persistently stored in the flow table; when the block is in the decision stage, the block is persistently stored in the block data table;

重启模块,用于根据所述流水表和所述区块数据表,进行节点重启;a restart module, configured to restart the node according to the flow table and the block data table;

初次启动模块,用于根据所述流水表和所述区块数据表,进行节点的初次启动。The initial startup module is used for initial startup of the node according to the flow table and the block data table.

本发明实施例还提供了一种在区块链中使用HotStuff共识算法的系统,包括:The embodiment of the present invention also provides a system for using the HotStuff consensus algorithm in the blockchain, including:

至少一个处理器;at least one processor;

至少一个存储器,用于存储至少一个程序;at least one memory for storing at least one program;

当所述至少一个程序被所述至少一个处理器执行,使得所述至少一个处理器实现所述的方法。The at least one program, when executed by the at least one processor, causes the at least one processor to implement the method.

本发明实施例还提供了一种存储介质,其中存储有处理器可执行的指令,所述处理器可执行的指令在由处理器执行时用于执行所述的方法。Embodiments of the present invention further provide a storage medium, in which processor-executable instructions are stored, and the processor-executable instructions are used to execute the method when executed by the processor.

综上所述,本发明从两个方面来完善了HotStuff共识算法在区块链下的工程化实现:一个是完善了节点初次启动,节点重启以及节点正常参与共识的处理逻辑,使得HotStuff算法能够真正的落地实现使用;另一方面,因为HotStuff共识算法的流水线设计,一个区块是否达成共识,需要后续区块数据的证明,本发明通过额外设计一个流水表来保证最新被Commit的区块的共识证明的完整,同时保证了区块数据表中的区块数据都是已经共识的且不存在冲突分叉,方便后续的节点数据同步和验证。In summary, the present invention improves the engineering implementation of the HotStuff consensus algorithm under the blockchain from two aspects: one is to improve the processing logic of the initial startup of the node, the restart of the node and the normal participation of the node in the consensus, so that the HotStuff algorithm can On the other hand, because of the pipeline design of the HotStuff consensus algorithm, whether a block reaches a consensus requires the proof of subsequent block data. The integrity of the consensus proof also ensures that the block data in the block data table has been agreed and there is no conflicting fork, which is convenient for subsequent node data synchronization and verification.

在一些可选择的实施例中,在方框图中提到的功能/操作可以不按照操作示图提到的顺序发生。例如,取决于所涉及的功能/操作,连续示出的两个方框实际上可以被大体上同时地执行或所述方框有时能以相反顺序被执行。此外,在本发明的流程图中所呈现和描述的实施例以示例的方式被提供,目的在于提供对技术更全面的理解。所公开的方法不限于本文所呈现的操作和逻辑流程。可选择的实施例是可预期的,其中各种操作的顺序被改变以及其中被描述为较大操作的一部分的子操作被独立地执行。In some alternative implementations, the functions/operations noted in the block diagrams may occur out of the order noted in the operational diagrams. For example, two blocks shown in succession may, in fact, be executed substantially concurrently or the blocks may sometimes be executed in the reverse order, depending upon the functionality/operations involved. Furthermore, the embodiments presented and described in the flowcharts of the present invention are provided by way of example in order to provide a more comprehensive understanding of the technology. The disclosed methods are not limited to the operations and logic flows presented herein. Alternative embodiments are contemplated in which the order of the various operations are altered and in which sub-operations described as part of larger operations are performed independently.

此外,虽然在功能性模块的背景下描述了本发明,但应当理解的是,除非另有相反说明,所述的功能和/或特征中的一个或多个可以被集成在单个物理装置和/或软件模块中,或者一个或多个功能和/或特征可以在单独的物理装置或软件模块中被实现。还可以理解的是,有关每个模块的实际实现的详细讨论对于理解本发明是不必要的。更确切地说,考虑到在本文中公开的装置中各种功能模块的属性、功能和内部关系的情况下,在工程师的常规技术内将会了解该模块的实际实现。因此,本领域技术人员运用普通技术就能够在无需过度试验的情况下实现在权利要求书中所阐明的本发明。还可以理解的是,所公开的特定概念仅仅是说明性的,并不意在限制本发明的范围,本发明的范围由所附权利要求书及其等同方案的全部范围来决定。Furthermore, while the invention is described in the context of functional modules, it is to be understood that, unless stated to the contrary, one or more of the described functions and/or features may be integrated in a single physical device and/or or software modules, or one or more functions and/or features may be implemented in separate physical devices or software modules. It will also be appreciated that a detailed discussion of the actual implementation of each module is not necessary to understand the present invention. Rather, given the attributes, functions, and internal relationships of the various functional modules in the apparatus disclosed herein, the actual implementation of the modules will be within the routine skill of the engineer. Accordingly, those skilled in the art, using ordinary skill, can implement the invention as set forth in the claims without undue experimentation. It is also to be understood that the specific concepts disclosed are illustrative only and are not intended to limit the scope of the invention, which is to be determined by the appended claims along with their full scope of equivalents.

在本说明书的描述中,参考术语“一个实施例”、“一些实施例”、“示例”、“具体示例”、或“一些示例”等的描述意指结合该实施例或示例描述的具体特征、结构、材料或者特点包含于本发明的至少一个实施例或示例中。在本说明书中,对上述术语的示意性表述不一定指的是相同的实施例或示例。而且,描述的具体特征、结构、材料或者特点可以在任何的一个或多个实施例或示例中以合适的方式结合。In the description of this specification, description with reference to the terms "one embodiment," "some embodiments," "example," "specific example," or "some examples", etc., mean specific features described in connection with the embodiment or example , structure, material or feature is included in at least one embodiment or example of the present invention. In this specification, schematic representations of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.

尽管已经示出和描述了本发明的实施例,本领域的普通技术人员可以理解:在不脱离本发明的原理和宗旨的情况下可以对这些实施例进行多种变化、修改、替换和变型,本发明的范围由权利要求及其等同物限定。Although embodiments of the present invention have been shown and described, it will be understood by those of ordinary skill in the art that various changes, modifications, substitutions and alterations can be made in these embodiments without departing from the principles and spirit of the invention, The scope of the invention is defined by the claims and their equivalents.

以上是对本发明的较佳实施进行了具体说明,但本发明并不限于所述实施例,熟悉本领域的技术人员在不违背本发明精神的前提下还可做作出种种的等同变形或替换,这些等同的变形或替换均包含在本申请权利要求所限定的范围内。The above is a specific description of the preferred implementation of the present invention, but the present invention is not limited to the described embodiments, and those skilled in the art can also make various equivalent deformations or replacements without departing from the spirit of the present invention, These equivalent modifications or substitutions are all included within the scope defined by the claims of the present application.

Claims (7)

Translated fromChinese
1.一种在区块链中使用HotStuff共识算法的方法,其特征在于,包括预备阶段、预提交阶段、提交阶段和决定阶段;其中,1. A method for using the HotStuff consensus algorithm in a blockchain, characterized in that it comprises a preparatory stage, a pre-submission stage, a submission stage and a decision stage; wherein,所述预备阶段包括:通过领导节点发起提案,并将该提案广播给副本节点,生成预备证书;The preparatory stage includes: initiating a proposal through the leader node, broadcasting the proposal to the replica nodes, and generating a preparatory certificate;所述预提交阶段包括:领导节点将所述预备证书广播给副本节点,生成预提交证书;The pre-submission stage includes: the leader node broadcasts the pre-submission certificate to the replica nodes, and generates a pre-submission certificate;所述提交阶段包括:领导节点将所述预提交证书广播给副本节点,生成提交证书;The submission stage includes: the leader node broadcasts the pre-submission certificate to the replica nodes, and generates a submission certificate;所述决定阶段包括:领导节点将所述提交证书广播给副本节点,由所有副本节点执行所述提案;The decision stage includes: the leader node broadcasts the submission certificate to the replica nodes, and all the replica nodes execute the proposal;其中,当区块处于预提交阶段时,将该区块持久化存储到流水表中;当区块处于决定阶段时,将该区块持久化存储到区块数据表中;Among them, when the block is in the pre-commit stage, the block is persistently stored in the flow table; when the block is in the decision stage, the block is persistently stored in the block data table;根据所述流水表和所述区块数据表,进行节点重启;Restart the node according to the flow table and the block data table;根据所述流水表和所述区块数据表,进行节点的初次启动;According to the flow table and the block data table, the initial startup of the node is performed;所述根据所述流水表和所述区块数据表,进行节点重启,包括:The performing node restart according to the flow table and the block data table includes:从区块数据表中读取最新处于决定阶段的区块的信息;Read the latest block information in the decision stage from the block data table;根据该区块的信息从流水表中读取对应的预提交阶段和提交阶段的区块的信息;According to the information of the block, read the information of the corresponding pre-commit stage and the block in the commit stage from the flow table;生成一个空白区块来代替最新处于预备阶段的区块;Generate a blank block to replace the latest block in the preparatory stage;以及,as well as,所述节点基于所述提交阶段、预提交阶段以及预备阶段的区块进行数据同步并在完成后参与共识;The node performs data synchronization based on the blocks in the commit phase, the pre-commit phase, and the preliminary phase, and participates in consensus after completion;所述节点基于所述提交阶段、预提交阶段以及预备阶段的区块进行数据同步并在完成后参与共识这一步骤,包括:The node performs data synchronization based on the blocks in the submission phase, the pre-submission phase and the preparatory phase and participates in the consensus step after completion, including:若区块链中存在正在共识的节点,则直接同步最新的提交阶段、预提交阶段以及预备阶段区块和所有已经执行的区块数据后,参与共识流程;If there is a consensus node in the blockchain, it will directly synchronize the latest submission stage, pre-submission stage and pre-stage block data and all executed block data, and then participate in the consensus process;若区块链中不存在正在共识的节点,则直接基于上述的预提交阶段,提交阶段以及预备阶段的区块开始进行共识;If there is no consensus node in the blockchain, consensus will be started directly based on the above-mentioned pre-commit stage, blocks in the submission stage and the pre-stage stage;所述根据所述流水表和所述区块数据表,进行节点的初次启动,包括:The initial startup of the node according to the flow table and the block data table includes:当区块链中只存在初次启动的节点时:When there are only nodes that are started for the first time in the blockchain:生成三个创世块;其中第一创世块作为决定阶段的区块,第二创世块作为提交阶段的区块,第三创世块作为预提交阶段的区块;生成空白区块作为预备阶段的区块;根据所述三个创世块和空白区块,然后执行根据所述流水表和所述区块数据表进行节点重启的步骤;Three genesis blocks are generated; the first genesis block is used as a block in the decision stage, the second genesis block is used as a block in the submission stage, and the third genesis block is used as a block in the pre-commit stage; a blank block is generated as The block in the preparatory stage; according to the three genesis blocks and the blank block, then perform the steps of restarting the node according to the flow table and the block data table;当区块链中存在非初次启动的节点时:When there are non-initially started nodes in the blockchain:将区块链中初次启动节点同步所述非初次启动节点上的区块数据,然后执行根据所述流水表和所述区块数据表进行节点重启的步骤。Synchronize the block data on the non-initially started node in the block chain with the initial startup node, and then perform the steps of restarting the node according to the flow table and the block data table.2.根据权利要求1所述的一种在区块链中使用HotStuff共识算法的方法,其特征在于,所述通过领导节点发起提案,并将该提案广播给副本节点,生成预备证书,包括:2. The method for using the HotStuff consensus algorithm in a blockchain according to claim 1, wherein the proposal is initiated by the leader node, and the proposal is broadcast to the replica nodes to generate a preliminary certificate, comprising:通过可验证随机的方式确定领导节点;Determine the leader node in a verifiably random way;通过领导节点发起提案;Initiate proposals through the leader node;将所述提案广播给区块链中的所有副本节点;broadcast the proposal to all replica nodes in the blockchain;所述副本节点根据所述提案的合法性,向领导节点反馈第一签名信息;The replica node feeds back the first signature information to the leader node according to the validity of the proposal;将所有副本节点的第一签名信息打包得到预备证书。The first signature information of all replica nodes is packaged to obtain a preliminary certificate.3.根据权利要求1所述的一种在区块链中使用HotStuff共识算法的方法,其特征在于,所述领导节点将所述预备证书广播给副本节点,生成预提交证书,包括:3. The method for using the HotStuff consensus algorithm in a blockchain according to claim 1, wherein the leader node broadcasts the preliminary certificate to the replica nodes, and generates a pre-submission certificate, comprising:领导节点将预备证书广播给所有副本节点;The leader node broadcasts the prepared certificate to all replica nodes;副本节点根据预备证书的合法性,向领导节点反馈第二签名信息;The replica node feeds back the second signature information to the leader node according to the validity of the prepared certificate;将所有副本节点的第二签名信息打包得到预提交证书。Package the second signature information of all replica nodes to obtain a pre-submission certificate.4.根据权利要求1所述的一种在区块链中使用HotStuff共识算法的方法,其特征在于,所述领导节点将所述预提交证书广播给副本节点,生成提交证书,包括:4. The method for using the HotStuff consensus algorithm in a blockchain according to claim 1, wherein the leader node broadcasts the pre-submission certificate to the replica nodes, and generates a submission certificate, comprising:领导节点将预提交证书广播给所有副本节点;The leader node broadcasts the pre-commit certificate to all replica nodes;副本节点根据预提交证书的合法性,向领导节点反馈第三签名信息;The replica node feeds back the third signature information to the leader node according to the validity of the pre-submitted certificate;将所有副本节点的第三签名信息打包得到提交证书。Package the third signature information of all replica nodes to obtain the submission certificate.5.根据权利要求1所述的一种在区块链中使用HotStuff共识算法的方法,其特征在于,所述领导节点将所述提交证书广播给副本节点,由所有副本节点执行所述提案,包括:5. The method for using the HotStuff consensus algorithm in a blockchain according to claim 1, wherein the leader node broadcasts the submission certificate to the replica nodes, and all the replica nodes execute the proposal, include:领导节点将所述提交证书广播给所有副本节点;The leader node broadcasts the submission certificate to all replica nodes;副本节点根据所述提交证书的合法性,确定所述提案已经在区块链中达成共识,执行所述提案。The replica node determines that the proposal has reached a consensus in the blockchain according to the validity of the submitted certificate, and executes the proposal.6.一种在区块链中使用HotStuff共识算法的系统,其特征在于,包括:6. A system for using the HotStuff consensus algorithm in a blockchain, comprising:预备模块,用于通过领导节点发起提案,并将该提案广播给副本节点,生成预备证书;The preparatory module is used to initiate a proposal through the leader node, broadcast the proposal to the replica nodes, and generate a preparatory certificate;预提交模块,用于领导节点将所述预备证书广播给副本节点,生成预提交证书;A pre-submission module, used for the leader node to broadcast the pre-submission certificate to the replica nodes to generate a pre-submission certificate;提交模块,用于领导节点将所述预提交证书广播给副本节点,生成提交证书;A submission module, used for the leader node to broadcast the pre-submission certificate to the replica nodes to generate a submission certificate;决定模块,用于领导节点将所述提交证书广播给副本节点,由所有副本节点执行所述提案;a decision module, used for the leader node to broadcast the submission certificate to the replica nodes, and all the replica nodes execute the proposal;其中,当区块处于预提交阶段时,将该区块持久化存储到流水表中;当区块处于决定阶段时,将该区块持久化存储到区块数据表中;Among them, when the block is in the pre-commit stage, the block is persistently stored in the flow table; when the block is in the decision stage, the block is persistently stored in the block data table;重启模块,用于根据所述流水表和所述区块数据表,进行节点重启;a restart module, configured to restart the node according to the flow table and the block data table;初次启动模块,用于根据所述流水表和所述区块数据表,进行节点的初次启动;an initial startup module, used for initial startup of the node according to the flow meter and the block data table;所述重启模块具体用于:从区块数据表中读取最新处于决定阶段的区块的信息;根据该区块的信息从流水表中读取对应的预提交阶段和提交阶段的区块的信息;生成一个空白区块来代替最新处于预备阶段的区块;以及,所述节点基于所述提交阶段、预提交阶段以及预备阶段的区块进行数据同步并在完成后参与共识;The restarting module is specifically used to: read the information of the latest block in the decision stage from the block data table; read the corresponding pre-submission stage and the submission stage of the block from the flow table according to the information of the block. information; generate a blank block to replace the latest block in the preliminary stage; and, the node performs data synchronization based on the block in the submission stage, the pre-submission stage and the preliminary stage and participates in consensus after completion;其中,若区块链中存在正在共识的节点,则直接同步最新的提交阶段、预提交阶段以及预备阶段区块和所有已经执行的区块数据后,参与共识流程;Among them, if there is a consensus node in the blockchain, it will directly synchronize the latest submission stage, pre-submission stage and pre-stage block data and all executed block data, and then participate in the consensus process;若区块链中不存在正在共识的节点,则直接基于上述的预提交阶段,提交阶段以及预备阶段的区块开始进行共识;If there is no consensus node in the blockchain, consensus will be started directly based on the above-mentioned pre-commit stage, blocks in the submission stage and the pre-stage stage;所述初次启动模块具体用于:当区块链中只存在初次启动的节点时:生成三个创世块;其中第一创世块作为决定阶段的区块,第二创世块作为提交阶段的区块,第三创世块作为预提交阶段的区块;生成空白区块作为预备阶段的区块;根据所述三个创世块和空白区块,然后执行根据所述流水表和所述区块数据表进行节点重启的步骤;当区块链中存在非初次启动的节点时:将区块链中初次启动节点同步所述非初次启动节点上的区块数据,然后执行根据所述流水表和所述区块数据表进行节点重启的步骤。The initial startup module is specifically used for: when there are only initial startup nodes in the blockchain: three genesis blocks are generated; the first genesis block is used as the block in the decision stage, and the second genesis block is used as the submission stage The third genesis block is used as the block in the pre-submission stage; the blank block is generated as the block in the preparatory stage; according to the three genesis blocks and the blank block, the execution The step of restarting the node according to the block data table; when there is a node that is not started for the first time in the blockchain: synchronize the block data on the node that is not started for the first time in the block chain for the first time, and then execute according to the The flow meter and the block data table perform the steps of node restarting.7.一种在区块链中使用HotStuff共识算法的系统,其特征在于,包括:7. A system for using the HotStuff consensus algorithm in a blockchain, comprising:至少一个处理器;at least one processor;至少一个存储器,用于存储至少一个程序;at least one memory for storing at least one program;当所述至少一个程序被所述至少一个处理器执行,使得所述至少一个处理器实现如权利要求1-5中任一项所述的方法。When the at least one program is executed by the at least one processor, the at least one processor is caused to implement the method of any one of claims 1-5.
CN201911414474.XA2019-12-312019-12-31Method and system for using HotStuff consensus algorithm in block chainActiveCN111147261B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN201911414474.XACN111147261B (en)2019-12-312019-12-31Method and system for using HotStuff consensus algorithm in block chain

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN201911414474.XACN111147261B (en)2019-12-312019-12-31Method and system for using HotStuff consensus algorithm in block chain

Publications (2)

Publication NumberPublication Date
CN111147261A CN111147261A (en)2020-05-12
CN111147261Btrue CN111147261B (en)2022-07-12

Family

ID=70522644

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN201911414474.XAActiveCN111147261B (en)2019-12-312019-12-31Method and system for using HotStuff consensus algorithm in block chain

Country Status (1)

CountryLink
CN (1)CN111147261B (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN112182113B (en)*2020-10-232024-06-25网易(杭州)网络有限公司Block chain consensus method, system, electronic equipment and storage medium
CN112381649B (en)*2020-11-172024-06-18深圳前海微众银行股份有限公司Transaction consensus method, device and equipment based on blockchain
CN112991067B (en)*2021-04-282021-08-03支付宝(杭州)信息技术有限公司Block chain consensus method, device and system
CN112887436B (en)*2021-04-282021-08-03支付宝(杭州)信息技术有限公司Consensus method, consensus node and block chain system of pipeline mode
CN114047899B (en)*2022-01-122022-03-18南京金宁汇科技有限公司View synchronization method and system of block chain
CN115052017A (en)*2022-06-142022-09-13上海交通大学Layered consensus method and system based on dynamic reputation mechanism in Internet of vehicles environment
CN115186035B (en)*2022-09-132022-11-22腾讯科技(深圳)有限公司Block processing method, related system, storage medium and server
CN119227146A (en)*2023-06-282024-12-31腾讯科技(深圳)有限公司 Block data processing method, device, electronic device and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN107368507A (en)*2017-03-282017-11-21阿里巴巴集团控股有限公司 A blockchain-based consensus method and device
CN108182635A (en)*2017-12-182018-06-19深圳前海微众银行股份有限公司Block chain common recognition method, system and computer readable storage medium
CN108667614A (en)*2018-04-192018-10-16上海分布信息科技有限公司A kind of Byzantine failure tolerance method and its realize system
CN110032436A (en)*2019-04-042019-07-19杭州秘猿科技有限公司Support the block chain of pause and starting common recognition method, system and electronic equipment
CN110618841A (en)*2019-09-102019-12-27杭州秘猿科技有限公司Internal loose coupling consensus method and system and electronic equipment

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US8627135B2 (en)*2010-08-142014-01-07Teradata Us, Inc.Management of a distributed computing system through replication of write ahead logs

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN107368507A (en)*2017-03-282017-11-21阿里巴巴集团控股有限公司 A blockchain-based consensus method and device
CN108182635A (en)*2017-12-182018-06-19深圳前海微众银行股份有限公司Block chain common recognition method, system and computer readable storage medium
CN108667614A (en)*2018-04-192018-10-16上海分布信息科技有限公司A kind of Byzantine failure tolerance method and its realize system
CN110032436A (en)*2019-04-042019-07-19杭州秘猿科技有限公司Support the block chain of pause and starting common recognition method, system and electronic equipment
CN110618841A (en)*2019-09-102019-12-27杭州秘猿科技有限公司Internal loose coupling consensus method and system and electronic equipment

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
HotStuff: BFT Consensus with Linearity and Responsiveness;Maofan Yin等;《In 2019 ACM Symposium on Principles of Distributed Computing (PODC 19)》;20190802;第347-356页*

Also Published As

Publication numberPublication date
CN111147261A (en)2020-05-12

Similar Documents

PublicationPublication DateTitle
CN111147261B (en)Method and system for using HotStuff consensus algorithm in block chain
CN111183625B (en) System and method for deleting nodes in a blockchain network
CN109313752B (en)Method and system for forming an efficient consensus mechanism for licensed blockchains using audit guarantees
CN110727731A (en)Method for adding node in block chain network and block chain system
CN110602148A (en)Method and device for generating state tree of block and verifying data on chain
JP2020522778A (en) System and method for terminating view modification protocol
CN112700248B (en)Block chain consensus method, device and system based on Byzantine fault-tolerant algorithm
CN114398519A (en)Method and system for desynchronized recovery of licensed blockchains using bloom filters
TW202037116A (en)System and method for ending view change protocol
CN109214818A (en)Across the chain method of commerce of one kind and device
CN113610531B (en)Consensus method, block chain system and consensus node
CN111241589A (en) A database system, node and method
CN111105222A (en)Block chain cross-chain operation method and device
US20240097919A1 (en)Consensus trusted cluster changing method, computer device and computer-readable storage medium
WO2023231337A1 (en)Method for executing transaction in blockchain, and master node and slave node of blockchain
WO2023184881A1 (en)Proposal consensus execution method, blockchain system, device and storage medium
CN110235162A (en) Blockchain system data processing method and block generation method
CN109992624A (en) A synchronous storage method, device and computer equipment for block chain Block chain
CN111640018A (en)Block chain transaction existence verification method and device
CN111061813B (en)Method, apparatus and computing device for data synchronization in blockchain network
CN109586949A (en)Block generation method and computer storage medium
CN114912587A (en) Neural network distributed training system, method, device, computing unit and medium
CN111596937B (en)Method and system for realizing synchronous validation of new features of nodes in block chain
WO2020073246A1 (en)Blockchain-based transaction data processing method and device, and storage medium
CN116846916B (en)Data synchronization method, device, electronic equipment and computer readable storage medium

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
GR01Patent grant
GR01Patent grant

[8]ページ先頭

©2009-2025 Movatter.jp