Consensus acceleration method based on re-voting

By introducing a revoting mechanism and rolling leader selection in the blockchain consensus protocol, the inefficiency of traditional consensus protocols in massive transaction processing is solved, transaction throughput and latency performance are improved, and system activity is maintained.

CN118944888AInactive Publication Date: 2024-11-12BEIJING INST OF TECH +1

Patent Information

Application Number
CN202410424245.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-04-10
Publication Date
2024-11-12
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The traditional distributed consistency consensus protocol is inefficient when handling massive transactions, especially in the multi-stage communication model. The complexity of message transmission between nodes and network delay leads to slow consensus process, and the delay problem is more significant when the number of nodes increases. .

Method used

Introducing a consensus acceleration method based on revoting, by introducing a revoting mechanism in the blockchain system, allowing replica nodes to change voting, allowing the master node to collect enough voting earlier, and adopting a roll-based leader selection mechanism to select leaders in a loop to improve the performance of consensus protocols.

Benefits of technology

It improves the performance of the alliance chain consensus protocol, solves the inefficiency problem of traditional distributed consistency protocols when processing massive transactions, improves transaction throughput and consensus latency performance, and maintains the activity and high availability of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118944888A_ABST
    Figure CN118944888A_ABST
Patent Text Reader

Abstract

The invention provides a consensus acceleration method based on re-voting, which comprises the following steps: after transaction information of a node passes validity verification, a main node under a current view collects votes of not less than a preset number of nodes for a preorder block Bk-1 to generate an aggregation signature, packaging the aggregated signature, the hash value of the preorder block Bk-1 and the transaction to be linked into a block Bk, and broadcasting the block Bk; when the vote number obtained by not proposing is greater than or equal to a preset threshold value, the block chain system enters a re-voting stage; and after the effective block Bk is generated, submitting the block Bk-2, and continuing to execute the next consensus process by the block chain system. According to the invention, a re-voting mechanism is introduced into the consensus protocol, so that the replica nodes can be allowed to change votes thereof in the vote collection process of the master node, the master node can collect enough votes earlier, and the problem of low efficiency of a traditional distributed consistency protocol in processing massive transactions is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of blockchain consensus protocols, and in particular to a consensus acceleration method based on re-voting. Background Art

[0002] Blockchain is a unique public ledger held by network participants. Each participant executes a consensus protocol to package transaction events into blocks. These blocks are linked one by one through hash functions to form a chain structure, namely blockchain. In the blockchain, all participants have the same ledger.

[0003] However, traditional distributed consensus protocols are not satisfactory in terms of efficiency, especially when dealing with massive transactions. The main problem is that these protocols rely on the exchange of messages for finalized blocks, which leads to significant communication complexity. Taking the Byzantine Fault Tolerant (BFT) algorithm as an example, if the total number of nodes is N, and the number of Byzantine nodes is F, the Byzantine Fault Tolerant algorithm can ensure that the honest nodes of the Byzantine system reach a consensus if and only if N>=3F+1. However, voting between nodes requires a lot of communication overhead.

[0004] Although some consensus protocols such as Tendermint use methods such as gossip protocols to propagate consensus messages or apply efficient encryption primitives to reduce communication bandwidth, there are still serious transaction delays in blockchain networks due to the large amount of data transmission caused by multi-stage communication. Therefore, the performance bottleneck problem of blockchain consensus protocols still exists and needs to be solved urgently.

[0005] In order to solve the problem of low efficiency of the above-mentioned traditional distributed consistency consensus protocol when processing massive transactions, some existing technical solutions have provided different solutions.

[0006] Solution 1: In the Tendermint consensus protocol, state replication is used instead of the traditional global broadcast method. In the process of generating each block, only the current proposer communicates directly with other nodes and sends the proposal information of the block directly to other nodes. This effectively reduces the amount of message transmission and reduces the burden on communication bandwidth. In addition, Tendermint adopts a method of sharing verification information to reduce the transmission volume of each block by introducing some shared verification metadata in the block header, such as the signature of the validator, the hash of the public part, etc. Since this information remains unchanged for a period of time, it can be shared by multiple blocks, thereby reducing communication overhead. The above first solution, the Tendermint consensus protocol, has the following technical disadvantages:

[0007] In the Tendermint consensus protocol, the consensus process of each block is divided into multiple stages, and nodes are required to transmit information and wait for confirmation between these stages. This increases the complexity of message transmission in the system and may cause the entire consensus process to take a long time.

[0008] In the multi-stage communication model, nodes need to wait for messages from other nodes to reach the next consensus. If the network delay is large, the entire consensus process will become slow.

[0009] Tendermint's performance may be affected by the number of nodes in the network. As the number of nodes increases, the complexity of message transmission and confirmation will also increase, which may cause latency issues to become more significant.

[0010] Solution 2: The HotStuff consensus protocol introduces a pipeline mechanism that divides the consensus process into several stages, allowing these stages to be executed in parallel to improve overall efficiency. This includes the proposal stage (Propose), the preparation stage (Prevote / Precommit), the submission stage (Commit), etc. This pipeline mechanism allows different nodes to execute different consensus steps at the same time, thereby advancing the entire consensus process faster. At the same time, the view switching mechanism in HotStuff adopts a partial synchronization method. During the view switching process, the node only needs to synchronize the latest view information instead of the entire historical record, thereby reducing the synchronization burden between nodes and improving the efficiency of view switching, thereby improving the efficiency of the entire blockchain system. The above second solution, the HotStuff consensus protocol, has the following technical disadvantages:

[0011] HotStuff introduced Fast Path to improve the consensus speed under good network conditions. However, when the network conditions are poor or there is congestion, the Fast Path may be affected, resulting in a decrease in consensus performance.

[0012] The view switching mechanism in HotStuff is designed to cope with situations where the master node fails or Byzantine nodes attack. However, frequent view switching may lead to system performance degradation, especially when the network environment is unstable. Summary of the invention

[0013] In order to overcome the deficiencies of the prior art, the object of the present invention is to provide a consensus acceleration method based on re-voting.

[0014] To achieve the above object, the present invention provides the following solutions:

[0015] A consensus acceleration method based on re-voting, comprising:

[0016] Initialize the blockchain system and add all nodes to the blockchain network. The nodes in the current view include the primary node and the replica node. When all nodes complete a vote, the view number will increase by 1, and a new replica node will be selected as the primary node in a cyclic manner.

[0017] When any node initiates a new transaction, the node broadcasts the transaction information to the entire blockchain network;

[0018] When the transaction information passes the legitimacy verification, the master node under the current view collects no less than a preset number of nodes for the previous block B k-1 The vote generates an aggregate signature, and the aggregate signature and the previous block B k-1 The hash value and the transaction to be uploaded are packaged into a block B k , and at the same time, the block B k Broadcast to replica nodes;

[0019] When the replica node receives a valid block B before the timer expires, k , then send the block B k The confirmation information is sent to the master node of the next view and the timer is reset;

[0020] When the replica node does not receive a valid block B before the timer expires, k , then send the previous block B k-1 Votes for the next view's master node and resets the timer;

[0021] Use the master node of the next view to sort out the voting results from the previous view. When no proposal receives votes greater than or equal to the preset threshold, the blockchain system enters the re-voting phase.

[0022] When the valid block B k After generation, block B k-2 Submit, the blockchain system continues to execute the next round of consensus process.

[0023] Preferably, the block B k It is broadcast to each replica node in a P2P manner, and the block: B k =<PROPOSE,transactions,view,previous_hash,aggregate_signature> L1, where PROPOSE is the message identifier, indicating that this message is a proposal message, the proposal is broadcast in blocks, transactions are the transactions to be uploaded to the chain, view is the current view, previous_hash is the hash value of the previous block, and aggregate_signature is the aggregate signature.

[0024] Preferably, when the replica node receives a valid block B before the timer expires, k , then send the block B k The confirmation information is sent to the master node of the next view and the timer is reset, including:

[0025] When the replica node r receives a valid block B before the timer expires, k , then send the block B k Confirmation information <VOTE,view+1,hash k > r Give the next view's master node L2 and reset the timer; VOTE is the message identifier, indicating that this message is a voting message, and hash k For block B k The hash value of .

[0026] Preferably, when the replica node does not receive a valid block B before the timer expires, k , then send the previous block B k-1 The vote for the next view master node and reset the timer include:

[0027] When the replica node r does not receive a valid block B before the timer expires, k , then send the previous block B k-1 Voting <VOTE,view+1,hash k-1 > r Give the next view's master node L2 and reset the timer; where hash k-1 For block B k-1 The hash value of .

[0028] Preferably, after the blockchain system enters the re-voting phase, the master node L1 in the current view will send <RECALL,view+1,m * > L1 To the replica node, call on the replica node to re-vote. When the replica node receives the re-vote message, the replica node compares the proposal m * and m'''s block height, view number size, and hash value size. If m * The replica node with the largest block height, view number size, or hash value size sends a proposal m* Re-vote To the master node L2 of the next view; where m' is the last proposal voted by the replica node last time, m * For proposals that need to be re-voted, selected by the master node L1, For proposal * RECALL is the message identifier, indicating that the message type is the recall type, which is used to call for re-voting.

[0029] The present invention also provides an electronic device, comprising a bus, a transceiver, a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the transceiver, the memory, and the processor are connected via the bus, and wherein the computer program, when executed by the processor, implements the steps in the above-mentioned consensus acceleration method based on re-voting.

[0030] The present invention also provides a computer-readable storage medium having a computer program stored thereon, characterized in that when the computer program is executed by a processor, the steps in the above-mentioned consensus acceleration method based on re-voting are implemented.

[0031] The beneficial effect of the consensus acceleration method based on re-voting provided by the present invention is that: compared with the prior art, the present invention introduces the re-voting mechanism into the consensus protocol, and allows the replica nodes to change their votes during the process of the master node collecting votes, so that the master node can collect enough votes earlier. This move improves the performance of the existing consensus protocol of the alliance chain and solves the problem of low efficiency of the traditional distributed consistency protocol when processing massive transactions. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0033] Figure 1 It is a schematic diagram of a system flow of a consensus protocol based on blockchain and re-voting provided in an embodiment;

[0034] Figure 2 It is a schematic diagram of the communication mode of a four-node blockchain system based on the HCA protocol under normal circumstances provided in an embodiment;

[0035] Figure 3 It is a schematic diagram of the communication mode of a four-node blockchain system based on the HCA protocol in the case of a fork provided in an embodiment. DETAILED DESCRIPTION

[0036] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0037] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0038] The terms "first", "second", "third" and "fourth" in the specification and claims of the present application and the drawings are used to distinguish different objects rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a series of steps, processes, methods, etc. are not limited to the listed steps, but may optionally include steps that are not listed, or may optionally include other step elements inherent to these processes, methods, products or devices.

[0039] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.

[0040] The purpose of the present invention is to solve the problem of low efficiency of traditional distributed consensus protocols when processing massive transactions, and creatively propose a consensus acceleration protocol and system based on re-voting.

[0041] Due to the chain structure supported by the hash function, the blockchain can show the self-evident fact that each block obtains multiple rounds of valid votes. The present invention designs a consensus acceleration protocol based on re-voting to ensure that there is only one main chain in the blockchain network. By integrating the chain structure into the traditional distributed consensus algorithm, the performance of the blockchain in terms of transaction throughput and consensus latency is improved. The protocol proposed by the present invention enables each proposal to act as a block, which contains the legal number of votes for the previous block and allows accelerated re-voting. In addition, the present invention also uses a rolling-based leader selection mechanism to further optimize the process of the protocol. In the rolling-based leader selection mechanism, the leader is replaced in a cyclic manner. This can further improve the performance of the consensus protocol and maintain activity.

[0042] In order to better understand the present invention, the technical terms involved in the present invention are explained below:

[0043] Blockchain network: refers to the blockchain network used to transmit data. There are three types of blockchain networks, namely public blockchain (Public Blockchain), consortium blockchain (Consortium Blockchain), and private blockchain (Private Blockchain).

[0044] Blockchain transaction: refers to a blockchain transaction used to store data. Blockchain transaction is a data structure used by different nodes in the blockchain network to complete data interaction. Each blockchain transaction contains a sending address field, a receiving address field, a data storage field, and other field information. Blockchain transactions are transmitted to each node in the network in a flood broadcast mode.

[0045] Consensus Protocol: A consensus protocol is a mechanism in a distributed system that ensures that all nodes in the system agree on a transaction or state. In a distributed environment, there may be inconsistencies between nodes due to network delays, failures, or malicious behavior. Consensus protocols maintain the consistency of the entire system by specifying the rules for communication and collaboration between nodes to ensure that the majority of nodes in the network agree on a specific decision. This includes applications in blockchain technology, where nodes need to reach a consensus on the addition of new blocks to ensure data consistency and credibility across different copies. Consensus protocols play an important role in building decentralized systems, ensuring data security, and improving system reliability.

[0046] Re-voting: While the master is collecting votes, if replicas are allowed to change their votes, it may allow the master to collect enough votes earlier.

[0047] Rolling-based leader selection: Rolling-based leader selection is used to select leaders in a dynamic system. Unlike traditional election methods, the rolling-based mechanism is continuous, and the selection of leaders does not rely on a static election process, but is achieved through a rolling cycle that is updated regularly. In each rolling cycle, nodes have the opportunity to compete for the leader position, and the most suitable node is selected as the leader. This mechanism can adapt to dynamic changes, failures or other unstable factors of nodes in the system, providing a more flexible and real-time leader election method, which helps to maintain high availability and adaptability of the system.

[0048] Pipeline: Pipeline means splitting a task into several fixed stages so that each stage can be executed in parallel, thereby improving the efficiency and performance of the system. Some methods use pipelines to simplify the voting stage and shorten transaction delays. The paxos algorithm proposed in 1990 was the first to combine the idea of ​​pipelines, but paxos is only effective for crash tolerance problems. In 2019, Maofan Yin et al. used pipelines to simplify the voting stage of hotstuff. The preparation stage of view v+1 also serves as the pre-commit stage of view v. The preparation stage of view v+2 also serves as the pre-commit stage of view v+1 and the commit stage of view v. This not only simplifies the voting stage, but also integrates view switching into the normal consensus process.

[0049] See also Figure 1-3 , a consensus acceleration method based on re-voting in the present invention comprises:

[0050] Step 1: Initialize the blockchain system and add all nodes to the blockchain network. The nodes in the current view include the master node and the replica node. When all nodes complete a vote, the view number will increase by 1, and a new replica node will be selected as the master node in a cyclic manner.

[0051] Step 2: When any node initiates a new transaction, the node broadcasts the transaction information to the entire blockchain network;

[0052] Step 3: When the transaction information passes the legitimacy verification, the master node in the current view collects no less than a preset number of nodes for the previous block B. k-1 The vote generates an aggregate signature, and the aggregate signature and the previous block B k-1 The hash value and the transaction to be uploaded are packaged into a block B k , and at the same time, the block B k Broadcast to replica nodes;

[0053] In step 3, the master node L1 needs to collect no less than 2f+1 votes for the previous block, where f represents the number of malicious nodes that the system can tolerate, and aggregate them into an aggregate signature aggregate_signature. Then, the master node packages the transactions to be uploaded into transactions and calculates the hash value of the previous block previous_hash. Finally, the master node assembles these data into a block B k And sign it, and broadcast it via P2P:

[0054] B k=<PROPOSE,transactions,view,previous_hash,aggregate_signature> L1 To each replica node;

[0055] Step 4: When the replica node receives a valid block B before the timer expires k , then send the block B k The confirmation information is sent to the master node of the next view and the timer is reset;

[0056] Step 5: When the replica node does not receive a valid block B before the timer expires k , then send the previous block B k-1 Votes for the next view's master node and resets the timer;

[0057] It should be noted that all replica nodes (including the master node) maintain a timer, which starts when entering a new view. If the replica node r can receive a valid block B before the timer times out k (Block B k Passed the node validity verification), it will send <VOTE,view+1,hash k > r Give the next view's master node L2 to indicate its confirmation of the block, where hash k It is block B k If it has not received it after the timer times out, it will send its vote for the previous block. <VOTE,view+1,hash k-1 > r Give it to the next master node L2. In any case, after sending the vote message, replica r will enter the next view and reset the timer.

[0058] Step 6: Use the master node of the next view to sort out the voting results from the previous view. When no proposal receives votes greater than or equal to the preset threshold, the blockchain system enters the re-voting phase.

[0059] If L2 sorts out the votes from the previous view and no proposal (in each proposal in the previous view) has received votes greater than or equal to 2f+1, the blockchain system enters the re-voting phase. After the blockchain system enters the re-voting phase, the master node L1 in the current view will send <RECALL,view+1,m * > L1 To the replica node, call on the replica node to re-vote. When the replica node receives the re-vote message, the replica node compares the proposal m *and m'''s block height, view number size, and hash value size. If m * The replica node with the largest block height, view number size, or hash value size sends a proposal m * Re-vote To the master node L2 of the next view; where m' is the proposal that the replica node voted on last time, RECALL is the message identifier, indicating that the message type is the recall type calling for re-voting, and m * For proposals that need to be re-voted, selected by the master node L1, For proposal * The hash value of .

[0060] Step 7: When valid block B k After generation, block B k-2 Submit, the blockchain system continues to execute the next round of consensus process.

[0061] In step 7, since each block contains the aggregate signature of the previous block, when the valid block B k When generated, it means that a master node has collected block B k-1 At least 2f+1 valid votes, indicating that block B k-2 It has been confirmed twice by most replica nodes. Therefore, when the replica node receives the valid block B for the first time k When k-2 submit.

[0062] The present invention further illustrates the above process in conjunction with specific embodiments below:

[0063] (1) Initialize the system: When the system is initialized, each node joins the blockchain network. Initially, there are no transactions or blocks in the network. Nodes establish connections through a peer-to-peer communication protocol to ensure network synchronization.

[0064] (2) Transaction broadcast: A user initiates a new transaction and packages it into transaction information, including the sender, receiver, amount, etc. The transaction information is broadcast to the entire blockchain network through point-to-point communication. After receiving the transaction information, each node verifies its format, digital signature, etc. to ensure the legitimacy of the transaction.

[0065] (3) Transaction verification: Nodes perform transaction verification and check the legitimacy of transactions. This includes verifying digital signatures, confirming the legitimacy of transaction inputs and outputs, etc. Transactions that pass verification enter the transaction pool and wait for subsequent processing.

[0066] (4) Consensus protocol execution: Under normal conditions, the master node L1 collects votes from multiple replica nodes and generates an aggregate signature aggregate_signature. The master node packages the transactions to be uploaded into block B. k , including the hash value of the previous block. The master node signs the block and broadcasts it to other nodes via P2P.

[0067] (5) Voting: Each node starts a timer after receiving a new block. If the node receives a valid block before the timer times out, it sends a confirmation of the block to the next view's master node L2. If it still has not been received after the timer times out, it sends a vote for the previous block to the next master node L2. After sending the vote, the node enters the next view and resets the timer.

[0068] (6) Execution of the re-voting mechanism: If the master node L2 sorts out the votes from the previous view and no proposal has received votes greater than or equal to a certain threshold, the system enters the re-voting phase. The master node L1 sends a recall message to these replica nodes, informing them to re-vote. After receiving the recall message, the replica node compares the block height, view number size, and hash value size of the candidate proposal with the proposal it voted on last time. If there is a larger value, it sends a re-vote for the candidate proposal to L2.

[0069] (7) Submit: Valid block B k After being generated, it means that L1 has collected valid votes for the previous block. When the replica node receives a valid block for the first time, it can submit the previous block. Each block contains an aggregate signature of the previous block to ensure the validity of the block. The submission mechanism maintains the coherence and consistency of the blockchain. After the node submits, the system continues to execute the next round of consensus process.

[0070] At the same time, in order to make the purpose, technical solution, applicability, innovation and advantages of the present invention clearer, the present invention is further described in detail by proposing an example of applying the method of the present invention.

[0071] The following description takes a network scale of 4 nodes as an example. Figure 2 When the total number of nodes is 4, the HCA protocol can tolerate a Byzantine failure in one node. In the present invention, the four replica nodes in the system are r1, r2, r3, and r4, as shown in Figure 2 As shown. Under normal circumstances, the HCA protocol continues to run on each replica, and each round of operation is called a view. After entering a new view, the view number will increase by 1, and a new replica will be selected as the master node in a cyclic manner. Figure 2 In the example, r4 is the primary node under the current view v, and r1 is the primary node under the view v+1.

[0072] In a four-node blockchain system using the HCA protocol, the process of reaching consensus under normal circumstances is as follows:

[0073] Step 1: r4 is selected as the master node under the current view v. Under normal circumstances, r4 collects no less than 3 votes for the previous block and aggregates them into an aggregate signature aggregate_signature. Then, the master node packages the transactions to be uploaded into transactions and calculates the hash value previous_hash of the previous block. Finally, r4 assembles these data into a block and signs it, and broadcasts it to r1, r2, and r3 in a P2P manner.

[0074] Step 2: After receiving the block, replica nodes r1, r2, and r3 verify its legitimacy. After passing the verification, they will send their votes to the next view's primary node r1 to indicate their confirmation of the block. Replica node r4 also sends its vote to node r1. After sending the vote message, each replica node will enter view v+1 and reset the timer.

[0075] Step 3: r1 collects 4 legal votes for the block, proposes a new block after the block, and broadcasts it to r2, r3, and r4, driving the system into the next round of consensus process. In addition, the block will be submitted at a depth of 2.

[0076] Figure 3 The paper shows the process of rapid convergence of forks in the re-voting phase when a fork occurs in the blockchain. In the present invention, the four replica nodes in the system are r1, r2, r3, and r4. Figure 2 In , r4 is the master node under the current view v, and r1 is the master node under the view v+1. In view v, two candidate blocks appear in the system and cause a fork. In the present invention, it is assumed that the hash value of the block is greater than the hash value of .

[0077] The four-node blockchain system using the HCA protocol performs the following re-voting process in the event of a fork:

[0078] Step 1: r4 is the master node under the current view v. r4 sends a message to replica nodes r2 and r3, calling on replica nodes r2 and r3 to re-vote.

[0079] Step 2: After receiving the recall message, these replica nodes compare the block height, view number size, and hash value size of the proposal. Because the hash value size is larger, replicas r2 and r3 send a re-vote for the proposal to the primary node r1 of view v+1.

[0080] Step 3: After the re-voting phase, r1 can collect 4 legal votes for the block. Therefore, r1 proposes a new block after the block and broadcasts it to r2, r3, and r4. In the blockchain, the branch where the block is located will be abandoned, and subsequent blocks will be extended after the block.

[0081] According to the embodiments provided by the present invention, the present invention has the following beneficial effects:

[0082] 1. High efficiency: This invention introduces the re-voting mechanism into the consensus protocol. During the process of the master node collecting votes, the replica nodes are allowed to change their votes, so that the master node can collect enough votes earlier. This move improves the performance of the existing consensus protocol of the alliance chain and solves the problem of low efficiency of the traditional distributed consistency protocol when processing massive transactions.

[0083] 2. Activity: The present invention also uses a rolling-based leader selection mechanism to further optimize the process of the protocol. In the rolling-based leader selection mechanism, the leader is replaced in a cyclic manner. This can further improve the performance of the consensus protocol and maintain activity.

[0084] The present invention also provides an electronic device, comprising a bus, a transceiver, a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the transceiver, the memory, and the processor are connected via the bus, and characterized in that the computer program implements the steps in the above-mentioned consensus acceleration method based on re-voting when executed by the processor. Compared with the prior art, the beneficial effects of an electronic device provided by the present invention are the same as the beneficial effects of the consensus acceleration method based on re-voting described in the above-mentioned technical solution, and will not be elaborated here.

[0085] The present invention also provides a computer-readable storage medium having a computer program stored thereon, characterized in that the computer program implements the steps in the above-mentioned consensus acceleration method based on re-voting when executed by a processor. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the present invention are the same as the beneficial effects of the consensus acceleration method based on re-voting described in the above technical solution, and will not be repeated here.

[0086] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the method disclosed in the embodiment, since it corresponds to the device disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the device part description.

[0087] The principles and implementation methods of the present invention are described in this article using specific examples. The description of the above embodiments is only used to help understand the method and core idea of ​​the present invention. At the same time, for those skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting the present invention.

Claims

1. A consensus acceleration method based on re-voting, characterized in that: include: Initialize the blockchain system and add all nodes to the blockchain network. The nodes in the current view include the primary node and the replica node. When all nodes complete a vote, the view number will increase by 1, and a new replica node will be selected as the primary node in a cyclic manner. When any node initiates a new transaction, the node broadcasts the transaction information to the entire blockchain network; When the transaction information passes the legitimacy verification, the master node in the current view collects no less than a preset number of nodes for the previous block B k-1 The vote generates an aggregate signature, and the aggregate signature and the previous block B k-1 The hash value and the transaction to be uploaded are packaged into a block B k , and at the same time, the block B k Broadcast to replica nodes; When the replica node receives a valid block B before the timer expires, k , then send the block B k The confirmation information is sent to the master node of the next view and the timer is reset; When the replica node does not receive a valid block B before the timer expires, k , then send the previous block B k-1 Votes for the next view's master node and resets the timer; Use the master node of the next view to sort out the voting results from the previous view. When no proposal receives votes greater than or equal to the preset threshold, the blockchain system enters the re-voting phase. When the valid block B k After generation, block B k-2 Submit, the blockchain system continues to execute the next round of consensus process.

2. A consensus acceleration method based on re-voting according to claim 1, characterized in that: The block B k It is broadcast to each replica node in a P2P manner, and the block: B k =<PROPOSE,transactions,view,previous_hash,aggregate_signature> L1, where PROPOSE is the message identifier, indicating that this message is a proposal message. The proposal is broadcast in blocks. Transactions are transactions to be uploaded to the chain. View is the current view. Previous_hash is the hash value of the previous block. Aggregate_signature is the aggregate signature.

3. A consensus acceleration method based on re-voting according to claim 2, characterized in that: When the replica node receives a valid block B before the timer expires, k , then send the block B k The confirmation information is sent to the master node of the next view and the timer is reset, including: When the replica node r receives a valid block B before the timer expires, k , then send the block B k Confirmation information <VOTE,view+1,hash k > r Give the next view's master node L2 and reset the timer; VOTE is the message identifier, indicating that this message is a voting message, and hash k For block B k The hash value of .

4. A consensus acceleration method based on re-voting according to claim 3, characterized in that: When the replica node does not receive a valid block B before the timer expires, k , then send the previous block B k-1 The vote for the next view master node and reset the timer include: When the replica node r does not receive a valid block B before the timer expires, k , then send the previous block B k-1 Voting <VOTE,view+1,hash k-1 > r Give the next view's master node L2 and reset the timer; where hash k-1 For block B k-1 The hash value of .

5. A consensus acceleration method based on re-voting according to claim 4, characterized in that: After the blockchain system enters the re-voting phase, the master node L1 in the current view will send<RECALL,view+1,m*> L1 Send a message to the replica node, calling on the replica node to re-vote. When the replica node receives the re-vote message, it compares the block height, view number size, and hash value size of proposals m* and m'. If m* has the largest block height, view number size, or hash value size, the replica node sends a re-vote for proposal m*. <VOTE,view+1,hash m* > r To the master node L2 of the next view; where m*' is the proposal voted on by the replica node last time, m* is the proposal selected by the master node L1 that needs to be re-voted, hash m* is the hash value of proposal m*, RECALL is the message identifier, indicating that this message is of recall type, which is used to call for re-voting.

6. An electronic device, comprising a bus, a transceiver, a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the transceiver, the memory, and the processor are connected via the bus, wherein: When the computer program is executed by the processor, the steps of a consensus acceleration method based on re-voting as described in any one of claims 1-5 are implemented.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of a consensus acceleration method based on re-voting as described in any one of claims 1-5 are implemented.

Citation Information

Patent Citations

  • Method and system based on Byzantine fault-tolerant consensus acceleration

    CN117081719A

Cited By

  • Block consensus method and device, electronic equipment and storage medium

    CN117579632A

  • A block consensus method and device, electronic equipment and storage medium

    CN117579632B