An Improved and Optimized PBFT Consensus Method and System for Consortium Blockchain

By dividing the alliance chain nodes into different groups and introducing arbitration groups to process join and exit applications, the PBFT consensus algorithm has solved the problem of high communication complexity and insufficient dynamics in the supply chain blockchain system, and a more efficient consensus process and security are achieved.

CN116405502BActive Publication Date: 2025-07-29NANJING ZHONGCHENG BLOCK CHAIN RES INST CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310396609.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-04-14
Publication Date
2025-07-29
Estimated Expiration
2043-04-14

AI Technical Summary

Technical Problem

The existing PBFT consensus algorithm is highly complex and lacks dynamic when the number of nodes is large in the supply chain blockchain system, so it cannot adapt to the joining and exiting needs of nodes, and Byzantine nodes endanger the consensus process.

Method used

The alliance chain nodes are divided into arbitration group, consensus group, candidate group and Byzantine group, and the arbitration group is introduced to process node joining and exit applications, judge the validity of nodes through consensus coefficients, and randomly select some nodes to participate in consensus within the consensus cycle, and use a random algorithm to process Byzantine behavior.

Benefits of technology

It improves the dynamic and robustness of the system, reduces communication complexity, enhances the security and node enthusiasm of the system, and reduces node configuration time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116405502B_ABST
    Figure CN116405502B_ABST
Patent Text Reader

Abstract

The present invention proposes an improved and optimized PBFT consensus method and system applied to a consortium blockchain. Aiming at the application scenario of the supply chain blockchain, the present invention divides all nodes into four groups: an arbitration group, a consensus group, a candidate group, and a Byzantine group. The nodes in the arbitration group are promoted from the primary nodes in the consensus group. By introducing arbitration nodes to process the applications of newly joined and exited nodes, the consortium blockchain system can be made dynamic. At the same time, the arbitration nodes are periodically served by multiple primary nodes, enabling the system to be better decentralized and ensuring the security of the system. Before the consensus starts, some nodes are selected from the candidate group to enter the consensus group to participate in the consensus, which can effectively solve the problem of high communication complexity caused by a large number of nodes. At the same time, a consensus coefficient is introduced to handle Byzantine nodes. In addition, for the exited nodes, the node information is not directly deleted, in order to save the configuration time for the exited nodes to rejoin the blockchain system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of blockchain, and relates to an improved and optimized PBFT consensus method and system applied to a consortium blockchain. Background Art

[0002] Blockchain technology has the characteristics of decentralization, immutability, and traceability. It can not only be applied in the trading environment of cryptocurrencies but also be deployed in the supply chain. In a complex and changing network environment, on the premise of the decentralization of the blockchain, to keep the ledgers of nodes that are completely dispersed in space consistent, a consensus algorithm needs to play an important role. It can enable the ledgers of each node to reach an agreement and maintain the agreement. In the development process of consortium blockchain consensus algorithms, consensus algorithms represented by PBFT (Practical Byzantine Fault Tolerance) account for a relatively large proportion.

[0003] PBFT can tolerate Byzantine nodes existing in the network, including crashed nodes and malicious nodes, and it is the first practical consensus algorithm that can tolerate Byzantine errors. It includes the following three protocols - the consistency protocol: ensuring that the requests of the client are executed in the order specified by the primary node; the view change protocol: replacing the failed node with a standby node; the checkpoint protocol: periodically cleaning the log files. Although the communication complexity of the PBFT algorithm has been reduced to o(n 2 ), it can tolerate malicious nodes not exceeding 1 / 3 of the total number of nodes, but it still has the disadvantage that the consensus efficiency of the system will decrease as the number of nodes increases, and it cannot meet the requests for dynamic joining or leaving of users. Summary of the Invention

[0004] Object of the Invention: Aiming at the large number of nodes in the supply chain blockchain system, the communication complexity increases accordingly, and at the same time, the traditional PBFT consensus algorithm does not have dynamics and cannot meet the needs of adding and withdrawing nodes in the supply chain system, and the presence of Byzantine nodes in the network endangers the progress of consensus. The present invention provides an improved and optimized PBFT consensus method and system applied to a consortium blockchain, which can be better used in the supply chain blockchain system.

[0005] Technical solution: To achieve the above-mentioned invention purpose, an improved and optimized PBFT consensus method applied to a consortium blockchain divides all nodes in the consortium blockchain into an arbitration group, a consensus group, a candidate group, and a Byzantine group; the nodes in the arbitration group are promoted from the primary nodes in the consensus group, with a fixed number. After adding a node, another node is randomly removed and exits to enter the candidate group. The nodes in the arbitration group are used to process applications for joining or exiting blockchain network nodes and to resolve nodes with Byzantine problems; the nodes in the Byzantine group include malicious nodes and exited nodes; newly added nodes or nodes that normally exit from the arbitration group and the consensus group are classified into the candidate group; the nodes in the consensus group are used to participate in consensus. A consensus cycle includes multiple rounds of consensus. The specific consensus process includes:

[0006] Randomly select some nodes from the candidate group to enter the consensus group;

[0007] In each round of consensus, a primary node is randomly selected. After receiving a request from the client, the primary node broadcasts the request to the secondary nodes, reaches a consensus based on the PBFT algorithm, and generates a block;

[0008] After a round of consensus ends, the primary nodes without Byzantine behavior are promoted to the arbitration group. If a node with Byzantine behavior is found, it is broadcast in the arbitration group, and the consensus coefficient of this node is decreased by a preset value, while the consensus coefficients of the nodes that successfully participated in this round of consensus are increased by the preset value;

[0009] After the consensus cycle ends, a broadcast is sent by the arbitration group to kick the nodes with consensus coefficients lower than the preset threshold into the Byzantine group.

[0010] Furthermore, the specific steps for processing new node addition include:

[0011] The new node broadcasts an application message to the arbitration group. The application message needs to include the node's own identity and proof of credit information;

[0012] After receiving the application message, the nodes in the arbitration group review the information. If the application passes, the passing information is broadcast to other nodes in the arbitration group;

[0013] After the nodes in the arbitration group receive 2h application passing messages from different arbitration nodes, a random algorithm is triggered. Through the random algorithm, a node other than the last entered node is selected. This node changes the information of the newly added node to let it enter the candidate group, updates the global status table, and at the same time, this arbitration node will also be used as the node that recently left the arbitration group, where h is the number of the maximum faulty nodes in the arbitration group.

[0014] Furthermore, the specific steps for processing node exit include:

[0015] The node to exit broadcasts an application message to the arbitration group. The application message needs to include its own status information;

[0016] After a node in the arbitration group receives an application message, it reviews the information. Only nodes in the candidate group can exit the system. If the review passes, the passed information is broadcast to other nodes in the arbitration group.

[0017] After a node in the arbitration group receives 2h exit application passed messages from different arbitration nodes, it triggers a random algorithm. Through the random algorithm, it selects a node other than the last entered node to change the information of the exiting node, let it enter the Byzantine group, update the global status table, and at the same time this arbitration node will also be used as the node that recently left the arbitration group.

[0018] Furthermore, the consensus coefficient is a numerical manifestation used to judge whether a node effectively and successfully participates in the consensus. The consensus coefficient of a newly added node is initially set to n. In one round of consensus, the consensus coefficient of a node with Byzantine behavior is decreased by 2, and the consensus coefficient of a node that successfully participates is increased by 1. After a consensus period ends, nodes in the consensus group with a consensus coefficient lower than n are kicked into the Byzantine group.

[0019] Preferably, the selection of the primary node in the consensus group is based on the consensus coefficient. Among the nodes with the largest consensus coefficient, a random algorithm is used to randomly select one as the primary node.

[0020] Furthermore, if the PBFT algorithm triggers the view switching protocol, the primary node is replaced. The specific steps include:

[0021] All nodes in the consensus group except the primary node send messages requesting to replace the primary node to all nodes in the arbitration group.

[0022] After a node in the arbitration group receives 2f request messages from different consensus nodes, it broadcasts the message of replacing the primary node in the arbitration group, where f is the number of the largest faulty nodes in the consensus group.

[0023] After a node in the arbitration group receives 2h replacement messages from different arbitration nodes, it triggers the random algorithm for selecting the primary node.

[0024] Based on the same inventive concept, the present invention provides an improved and optimized PBFT consensus system applied to the consortium chain, including:

[0025] A node status management module, which is used to divide all nodes in the consortium chain into an arbitration group, a consensus group, a candidate group, and a Byzantine group; among them, the nodes in the arbitration group are promoted from the primary node in the consensus group, with a fixed number. After adding a node, another node is randomly removed and leaves to enter the candidate group.

[0026] The consensus cycle management module is used to randomly select some nodes from the candidate group to enter the consensus group within a consensus cycle; in each round of consensus, a primary node is randomly selected. After receiving a request from the client, the primary node broadcasts the request to the secondary nodes, reaches a consensus based on the PBFT algorithm, and generates a block; after a round of consensus ends, the primary nodes without Byzantine behavior are promoted to the arbitration group. If a node with Byzantine behavior is found, it is broadcast in the arbitration group, and the consensus coefficient of this node is decreased by a preset value, while the consensus coefficients of the nodes that successfully participated in this round of consensus are increased by the preset value; after the consensus cycle ends, a broadcast is sent by the arbitration group to kick the nodes with consensus coefficients lower than the preset threshold into the Byzantine group.

[0027] The node joining and leaving management module is used to handle the applications of nodes in the arbitration group to join or leave the blockchain network nodes, classify the newly joined nodes into the candidate group, and the leaving nodes into the Byzantine group.

[0028] Furthermore, in the node joining and leaving management module, a new node or a leaving node broadcasts an application message to the arbitration group. After receiving the application message, the nodes in the arbitration group conduct a review. After the review is passed, the passing information is broadcast to other nodes in the arbitration group. After the nodes in the arbitration group receive 2h passing messages from different arbitration nodes, a node is randomly selected (except the last node to enter) to handle the application, and this selected node will also be used as the node that recently left the arbitration group.

[0029] Based on the same inventive concept, the present invention provides a computer system, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the computer program is loaded into the processor, it implements the steps of the improved and optimized PBFT consensus method applied to the consortium blockchain.

[0030] Beneficial effects: An improved and optimized PBFT consensus method applied to the consortium blockchain supply chain provided by the present invention has the following advantages compared with the prior art: 1. By introducing an arbitration group to handle the entry and exit of nodes from the blockchain network, the problem of the lack of dynamics in the traditional PBFT algorithm is solved; while ensuring the dynamics of the system, the setting of the arbitration group also greatly reduces the security problem caused by the excessive power of only a single node to review the entry and exit of nodes; in the solution of the present invention, the arbitration group does not have a primary node, and a random arbitration node is removed from the arbitration group at the end of each round of consensus, which also greatly guarantees the security of the highest power group. 2. The present invention takes into account that in the application scenario of the consortium blockchain supply chain, most nodes should be reliable nodes, and a part of the nodes are randomly selected through a random algorithm to participate in the consensus, which greatly reduces the communication complexity of the system. 3. The present invention introduces a consensus cycle, and in each cycle, a part of the nodes are selected to participate in the consensus, which can greatly improve the enthusiasm of the system nodes. At the same time, Byzantine nodes can be solved within one cycle, which greatly improves the robustness of the system. The setting of the Byzantine group temporarily places the exited nodes into the Byzantine group, and if they apply to join again next time, the node configuration time can be reduced. Brief Description of the Drawings

[0031] Figure 1 It is a schematic diagram of node division in an embodiment of the present invention.

[0032] Figure 2 It is an overall flowchart of an embodiment of the present invention.

[0033] Figure 3 It is a flowchart of the arbitration group handling Byzantine nodes in an embodiment of the present invention. Detailed Embodiments

[0034] The following further clarifies the present invention in conjunction with specific embodiments. It should be understood that these embodiments are only used to illustrate the present invention and not to limit the scope of the present invention. After reading the present invention, various equivalent forms of modification of the present invention by those skilled in the art all fall within the scope defined by the appended claims of this application.

[0035] As Figure 1 shown, all nodes in the supply chain consortium blockchain of the present invention are divided into an arbitration group, a consensus group, a candidate group, and a Byzantine group; the nodes in the arbitration group are promoted from the primary nodes in the consensus group. After adding an arbitration node to the arbitration group, another arbitration node is randomly removed and enters the candidate group. The nodes in the arbitration group are used to handle the applications of nodes joining or exiting the blockchain network and solve the nodes with Byzantine problems; the nodes in the Byzantine group include malicious nodes and exited nodes; the newly added or normally exited nodes from the arbitration group and the consensus group are classified into the candidate group; the nodes in the consensus group are randomly selected from the candidate group. A consensus cycle includes multiple rounds of consensus, and the status of the nodes is processed after the end of a consensus cycle.

[0036] Specifically, an improved and optimized PBFT consensus method applied to a consortium blockchain disclosed in an embodiment of the present invention, as Figure 2 shown, includes the following steps:

[0037] Step 1: All nodes are divided into four groups: an arbitration group, a consensus group, a candidate group, and a Byzantine group. Initially, all nodes belong to the candidate group. After one consensus cycle, step 1 is skipped and step 2 is directly entered; in this embodiment, the nodes are divided into four groups, and the specific group information is as follows: The nodes in the consensus group are called consensus nodes, and the consensus nodes are further divided into a primary node and secondary nodes. The consensus nodes participate in the consensus process; the nodes in the arbitration group are called arbitration nodes, which are served by the primary node in the consensus group, and mainly process applications for joining or exiting nodes of the blockchain network and resolve nodes with Byzantine problems; the nodes in the candidate group are called candidate nodes, and newly added nodes or nodes that normally exit from the arbitration group and the consensus group are classified into the candidate group, waiting for the opportunity to enter the consensus group; the nodes in the Byzantine group are called Byzantine nodes, and the Byzantine nodes are divided into malicious nodes and exiting nodes, and need to apply to the arbitration group to enter the candidate group again.

[0038] Step 2: Initialize the consensus coefficient of the newly added node to n; here, the consensus coefficient is a numerical representation used to judge whether a certain node effectively participates in the consensus. In one round of consensus, the consensus coefficient of the node with Byzantine behavior is reduced by 2, and the consensus coefficient of the node that successfully participates is increased by 1.

[0039] Step 3: Select nodes from the candidate group to enter the consensus group: Use a random algorithm to randomly select 50% of the nodes in the candidate group to enter the consensus group, and update the global node status table, setting the status of the nodes entering the consensus group to consensus nodes.

[0040] Step 4: Select a primary node: In one consensus cycle, a primary node is randomly selected in each round of consensus. Specifically, the selection of the primary node can refer to the consensus coefficient n, and a random algorithm is used to randomly select one from the 50% of the nodes with the largest consensus coefficient as the primary node.

[0041] Step 5: Start the consensus process: The client sends a request to all consensus nodes, and the primary node broadcasts the request to the secondary nodes. After the secondary nodes reach a consensus on this message, a block is generated; specifically based on the PBFT algorithm, it includes the following steps:

[0042] S1: The client sends a request message to all consensus nodes;

[0043] S2: The primary node broadcasts the request as a pre-prepared message with a signature to the secondary nodes;

[0044] S3: After receiving the pre-prepare message from the node, verify it. If the verification passes, generate a signed prepare message and broadcast it to all nodes;

[0045] S4: If a node receives 2f (where f is the number of the maximum faulty nodes in the consensus group) prepare messages from different nodes, generate a signed commit message and broadcast it to all nodes;

[0046] S5: If a node receives 2f commit messages from different nodes, consider the consensus successful, generate a block, and end the consensus;

[0047] S6: If the view change protocol is triggered, end the consensus.

[0048] Step 6: The primary node without Byzantine behavior ascends to the arbitration group (if the normal consensus ends, it is considered that the primary node has no Byzantine behavior; if the view change protocol is triggered during the PBFT algorithm consensus process, it is considered that the primary node has Byzantine behavior). Audit all the received commit messages. If a node with Byzantine behavior is found, broadcast it in the arbitration group, subtract 2 from the consensus coefficient of this node, add 1 to the consensus coefficient of the nodes that have successfully participated in this round of consensus. After the consensus period ends, broadcast by the arbitration group to kick the nodes with a consensus coefficient lower than n into the Byzantine group. At the same time, when the primary node ascends to the arbitration group, select a node other than the last-entered node to leave the arbitration group and enter the candidate group through a random algorithm.

[0049] The newly added node needs to send an application to the nodes in the arbitration group. The specific steps are as follows:

[0050] S1: The new node broadcasts an application message to the arbitration group. The application message needs to include the node's own identity and proof of credit information;

[0051] S2: After receiving the application message, the nodes in the arbitration group audit the information. If the application passes, broadcast the passed information to other nodes in the arbitration group; if the application to join fails, the arbitration node will not send a message. Finally, if the nodes in the arbitration group do not receive 2h passed messages, the new node will not be allowed to join. A time threshold can be set. If the new node has not received the joining information after exceeding the time threshold, it will know that it has not successfully passed the audit.

[0052] S3: After the nodes in the arbitration group receive 2h application passed messages from different arbitration nodes, trigger a random algorithm to select a node other than the last-entered node. Let this node change the information of the newly added node to make it enter the candidate group, update the global state table, and at the same time, this arbitration node will also be used as the node that has recently left the arbitration group.

[0053] The node to exit needs to send an application to the nodes in the arbitration group. The specific steps are as follows:

[0054] S1: The node to exit broadcasts an application message to the arbitration group. The application message needs to include its own status information (information in the global status table).

[0055] S2: After receiving the application message, the arbitration group nodes review the information. Only the nodes in the candidate group can exit the system. If the review passes, the passed information is broadcast to other nodes in the arbitration group; if the review fails, no message is sent.

[0056] S3: After receiving 2h exit application passed messages from different arbitration nodes, the arbitration group nodes trigger a random algorithm. Through the random algorithm, a node other than the last entered node is selected. This node changes the information of the exiting node, allows it to enter the Byzantine group, updates the global status table, and at the same time, this arbitration node will also be used as the node that recently left the arbitration group.

[0057] As Figure 3 shown, in step 4, after triggering the view switching protocol, the primary node needs to be replaced. The specific steps are as follows:

[0058] S1: All nodes except the primary node send messages requesting to replace the primary node to all nodes in the arbitration group.

[0059] S2: After receiving 2f request messages from different nodes, the arbitration group nodes broadcast a message to replace the primary node in the arbitration group.

[0060] S3: After receiving 2h replacement messages from different arbitration nodes, the arbitration group nodes trigger a random algorithm to select the primary node.

[0061] The following combines a specific example to illustrate the specific implementation process of the improved and optimized PBFT consensus method in the supply chain in the embodiments of the present invention. In the example, the preset initial consensus coefficient is 4, the maximum number of arbitration group nodes is 4, and a consensus cycle includes 4 consensuses.

[0062] Step 1: Initially, there are 20 nodes, and these 20 nodes are first grouped into the candidate group.

[0063] Step 2: Initialize the consensus coefficient of these 20 nodes to 4, ConMum 1~20 = 4;

[0064] Step 3: Select nodes from the candidate group to enter the consensus group: Use a random algorithm to randomly select 50% of the nodes in the candidate group to enter the consensus group. Assume the selected node numbers are Con 1~10 , and update the global node status table. Set the status of these 10 nodes to ConState 1~10 = 2. Status 1 represents an arbitration node, status 2 represents a consensus node, status 3 represents a candidate node, and status 4 represents a Byzantine node.

[0065] Step 4: Select the primary node: The primary node Con1 is selected by using a random algorithm.

[0066] Step 5: Start the consensus process: The client sends a request to all consensus nodes, and the primary node broadcasts the request to the secondary nodes. After the secondary nodes reach a consensus on the message, a block is generated. The specific steps are as follows:

[0067] S1: The client sends a request message to all consensus nodes.

[0068] S2: The primary node Con1 generates a pre-prepared message Pre1 with a signature for the request <consign1>Broadcast to other nodes Con 2~10 ;

[0069] S3: Node Con 2~10 Each receives the pre-prepared message Pre1 <consign1>After that, it is verified. If the verification passes, each generates a prepared message with a signature, Pre2<ConSign 2~10 > and broadcasts it to all nodes Con 1~10 (except itself);

[0070] S4: If a node receives six prepared messages from different nodes, it generates a commit message with a signature, Commit<ConSign x > and broadcasts it to all nodes;

[0071] S5: If a node receives six commit messages from different nodes, it considers the consensus successful, generates a block, and the consensus ends;

[0072] S6: If the view switching protocol is triggered, the consensus ends.

[0073] Step 5: Since there is no Byzantine behavior in this round, Con1 is promoted to the arbitration group, and the node state is set to ConState1 = 1. Con1 audits all the commit messages Commit<ConSign 2~10 > it receives and finds that Con2 has Byzantine behavior. Con1 broadcasts it in the arbitration group, reduces the consensus coefficient of this node by 2, ConMum2 = 2, and increases the consensus coefficient of other nodes by 1, ConMum 3~10 = 5. Since the number of nodes in the arbitration group does not reach 4, there is no need to select a node to leave the arbitration group. At the same time, it is judged whether 4 consensus rounds have been completed. If not, continue with Step 4; if completed, end, and the node state of the nodes still in the consensus group is set to 3 and enter the candidate group.

[0074] More specifically, the newly added node needs to send an application to the nodes in the arbitration group. The specific steps are as follows:

[0075] S1: The new node Con 21 broadcasts an application message, Join<Con 21 > to the arbitration group;

[0076] S2: After receiving the application message, the nodes in the arbitration group audit the information. If the application passes, each broadcasts the passed information, JoinPass<Con 1~4 > to other nodes in the arbitration group;

[0077] S3: After receiving two application passed messages from different arbitration nodes, the arbitration group nodes trigger a random algorithm and randomly select Con1. This node changes the information of the newly added node and sets ConState 21 to 3. At the same time, Con1 will also be the node that recently left the arbitration group.

[0078] More specifically, the node to be exited needs to send an application to the arbitration group node, and the specific steps are as follows:

[0079] S1: The new node Con 21 Broadcasts an application message Out<Con 21 > to the arbitration group;

[0080] S2: After receiving the application message, the arbitration group nodes review the information. First, check whether ConState 21 is 3. If the review passes, each of them broadcasts the passed information OutPass<Con 1~4 > to other nodes in the arbitration group;

[0081] S3: After receiving two application passed messages from different arbitration nodes, the arbitration group nodes trigger a random algorithm and randomly select Con1. This node changes the information of the node applying to exit, and sets ConState 21 to 4. At the same time, Con1 will also be the node that recently left the arbitration group.

[0082] More specifically, after triggering the view switching protocol, the primary node needs to be replaced, and the specific steps are as follows:

[0083] S1: All nodes except the primary node send the message ChangeMainRequest<Con 2~10 > requesting to replace the primary node to all nodes in the arbitration group;

[0084] S2: After receiving six request messages from different nodes, the arbitration group nodes broadcast the message ChangeMain<Con 21~24 > for replacing the primary node in the arbitration group;

[0085] S3: After receiving two replacement messages from different arbitration nodes, the arbitration group nodes randomly select an arbitration node to trigger the random algorithm for selecting the primary node. Similarly, this arbitration node is the node that recently left the arbitration group.

[0086] Based on the same inventive concept, an improved and optimized PBFT consensus system applied to a consortium blockchain disclosed in an embodiment of the present invention includes: a node status management module, configured to divide all nodes in the consortium blockchain into an arbitration group, a consensus group, a candidate group, and a Byzantine group; where the nodes in the arbitration group are promoted from the primary nodes in the consensus group, the number is fixed, and after adding a node, another node is randomly removed and leaves and enters the candidate group; a consensus cycle management module, configured to randomly select some nodes from the candidate group to enter the consensus group within a consensus cycle; in each round of consensus, a primary node is randomly selected, and after receiving a request from a client, the primary node broadcasts the request to the secondary nodes, and reaches a consensus based on the PBFT algorithm to generate a block; after a round of consensus ends, the primary nodes without Byzantine behavior are promoted to the arbitration group. If a node with Byzantine behavior is found, it is broadcast in the arbitration group, and the consensus coefficient of the node is decreased by a preset value, and the consensus coefficients of the nodes that successfully participated in this round of consensus are increased by the preset value; after the consensus cycle ends, a broadcast is sent by the arbitration group, and the nodes with consensus coefficients lower than the preset threshold are kicked into the Byzantine group; a node addition and withdrawal management module, configured to process applications for adding or withdrawing blockchain network nodes by the nodes in the arbitration group, classify the newly added nodes into the candidate group, and the withdrawn nodes into the Byzantine group. In the node addition and withdrawal management module, a new node or a withdrawn node broadcasts an application message to the arbitration group. After receiving the application message, the nodes in the arbitration group conduct a review. After the review is passed, the passed information is broadcast to other nodes in the arbitration group. After the nodes in the arbitration group receive 2h passing messages from different arbitration nodes, a node other than the last entered node is randomly selected to process the application, and the selected node will also be used as the node that recently left the arbitration group.

[0087] For the specific working processes of the above-described modules, reference may be made to the corresponding processes in the foregoing method embodiments, which will not be elaborated herein. The division of the modules is merely a logical function division, and there may be other division methods in actual implementation. For example, multiple modules may be combined or integrated into another system.

[0088] Based on the same inventive concept, a computer system disclosed in an embodiment of the present invention includes a memory, a processor, and a computer program stored on the memory and executable on the processor. When the computer program is loaded onto the processor, the steps of the improved and optimized PBFT consensus method applied to the consortium blockchain are implemented.

[0089] Those skilled in the art can understand that the technical solution of the present invention, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to enable one or more computer devices (which can be personal computers, servers, or network devices, etc.) to execute all or part of the steps of the method described in the embodiments of the present invention. The storage medium includes: various media that can store computer programs, such as USB flash drives, mobile hard disks, read-only memory ROM, random access memory RAM, magnetic disks, or optical discs.

Claims

1. An improved and optimized PBFT consensus method applied to the consortium blockchain, characterized in that, All nodes in the consortium blockchain are divided into an arbitration group, a consensus group, a candidate group, and a Byzantine group; The nodes in the arbitration group are promoted from the primary nodes in the consensus group, and the number is fixed. After adding a node, another node is randomly removed and exits to enter the candidate group. The nodes in the arbitration group are used to process applications for joining or exiting the blockchain network nodes and to resolve nodes with Byzantine problems; the nodes in the Byzantine group include malicious nodes and exited nodes; newly added nodes or nodes that normally exit from the arbitration group and the consensus group are classified into the candidate group; The nodes in the consensus group are used to participate in consensus. A consensus cycle includes multiple rounds of consensus. The specific consensus process includes: Randomly select some nodes from the candidate group to enter the consensus group; In each round of consensus, a primary node is randomly selected. After receiving a request from the client, the primary node broadcasts the request to the secondary nodes and reaches a consensus based on the PBFT algorithm to generate a block; After a round of consensus ends, the primary nodes without Byzantine behavior are promoted to the arbitration group. If a node with Byzantine behavior is found, it is broadcast in the arbitration group, and the consensus coefficient of this node is decreased by a preset value, while the consensus coefficients of the nodes that successfully participated in this round of consensus are increased by the preset value; After the consensus cycle ends, a broadcast is sent by the arbitration group to kick the nodes with consensus coefficients lower than the preset threshold into the Byzantine group; The specific steps for handling the addition of new nodes include: The new node broadcasts an application message to the arbitration group. The application message needs to include the node's own identity and proof of credit information; After receiving the application message, the nodes in the arbitration group review the information. If the application passes, the passed information is broadcast to other nodes in the arbitration group; After the nodes in the arbitration group receive 2h application passed messages from different arbitration nodes, a random algorithm is triggered. Through the random algorithm, a node other than the last entered node is selected. This node changes the information of the newly added node to let it enter the candidate group, updates the global status table, and at the same time this arbitration node will also be used as the node that recently left the arbitration group, where h is the number of the maximum faulty nodes in the arbitration group.

2. The improved and optimized PBFT consensus method applied to the consortium blockchain according to claim 1, wherein, The specific steps for handling node exits include: The node to exit broadcasts an application message to the arbitration group. The application message needs to include its own status information; After receiving the application message, the nodes in the arbitration group review the information. Only the nodes in the candidate group can exit the system. If the review passes, the passed information is broadcast to other nodes in the arbitration group; After the nodes in the arbitration group receive 2h exit application passed messages from different arbitration nodes, a random algorithm is triggered. Through the random algorithm, a node other than the last entered node is selected. This node changes the information of the exiting node to let it enter the Byzantine group, updates the global status table, and at the same time this arbitration node will also be used as the node that recently left the arbitration group, where h is the number of the maximum faulty nodes in the arbitration group.

3. An improved and optimized PBFT consensus method applied to a consortium blockchain according to claim 1, characterized in that, The consensus coefficient is a numerical representation used to judge whether a certain node effectively and successfully participates in consensus. The consensus coefficient of a newly added node is initialized to n. In a round of consensus, the consensus coefficient of a node with Byzantine behavior is decreased by 2, and the consensus coefficient of a node that successfully participates is increased by 1. After a consensus cycle ends, the nodes in the consensus group with consensus coefficients lower than n are kicked into the Byzantine group.

4. An improved and optimized PBFT consensus method applied to a consortium blockchain according to claim 1, characterized in that, The selection of the primary node in the consensus group is based on the consensus coefficient. A random algorithm is used to randomly select one from a part of the nodes with the largest consensus coefficient as the primary node.

5. An improved and optimized PBFT consensus method applied to a consortium blockchain according to claim 1, characterized in that, If the PBFT algorithm triggers the view change protocol, the primary node will be replaced. The specific steps include: All nodes in the consensus group except the primary node will send messages requesting to replace the primary node to all nodes in the arbitration group. After receiving 2f request messages from different consensus nodes, the nodes in the arbitration group will broadcast the message of replacing the primary node in the arbitration group, where f is the number of the maximum faulty nodes in the consensus group. After receiving 2h replacement messages from different arbitration nodes, the nodes in the arbitration group will trigger the random algorithm for selecting the primary node, where h is the number of the maximum faulty nodes in the arbitration group.

6. An improved and optimized PBFT consensus system applied to a consortium blockchain, characterized in that, Including: The node status management module is used to divide all nodes in the consortium chain into an arbitration group, a consensus group, a candidate group, and a Byzantine group. Among them, the nodes in the arbitration group are promoted from the primary node in the consensus group, and the number is fixed. After adding a node, another node will be randomly removed and leave to enter the candidate group. The consensus cycle management module is used to randomly select some nodes from the candidate group to enter the consensus group within a consensus cycle. In each round of consensus, a primary node is randomly selected. After receiving a request from the client, the primary node will broadcast the request to the slave nodes, and reach a consensus based on the PBFT algorithm to generate a block. After a round of consensus ends, the primary node without Byzantine behavior will be promoted to the arbitration group. If a node with Byzantine behavior is found, it will be broadcast in the arbitration group, and the consensus coefficient of this node will be decreased by a preset value, while the consensus coefficients of the nodes that successfully participated in this round of consensus will be increased by a preset value. After the consensus cycle ends, a broadcast will be sent by the arbitration group to kick the nodes with consensus coefficients lower than the preset threshold into the Byzantine group. The node joining and leaving management module is used for the nodes in the arbitration group to process applications for joining or leaving the blockchain network nodes, classifying the newly joined nodes into the candidate group and the leaving nodes into the Byzantine group. The specific steps for processing the joining of new nodes include: The new node broadcasts an application message to the arbitration group, and the application message needs to include the node's own identity and proof of credit information. After receiving the application message, the nodes in the arbitration group will review the information. If the application passes, the passed information will be broadcast to other nodes in the arbitration group. After receiving 2h application passed messages from different arbitration nodes, the arbitration group will trigger the random algorithm. One node except the last entered node will be selected through the random algorithm. This node will change the information of the newly joined node to let it enter the candidate group and update the global status table. At the same time, this arbitration node will also be used as the node that recently left the arbitration group, where h is the number of the maximum faulty nodes in the arbitration group.

7. An improved and optimized PBFT consensus system applied to a consortium blockchain according to claim 6, characterized in that, In the node joining and leaving management module, the new node or the leaving node broadcasts an application message to the arbitration group. After receiving the application message, the nodes in the arbitration group will review it. After the review passes, the passed information will be broadcast to other nodes in the arbitration group. After receiving 2h passed messages from different arbitration nodes in the arbitration group, a node except the last entered node will be randomly selected to process the application, and the selected node will also be used as the node that recently left the arbitration group, where h is the number of the maximum faulty nodes in the arbitration group.

8. An improved and optimized PBFT consensus system applied to a consortium blockchain according to claim 6, characterized in that The selection of the primary node in the consensus group is based on the consensus coefficient. A random algorithm is used to randomly select one from some nodes with the largest consensus coefficient as the primary node.

9. A computer system, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, When the computer program is loaded into the processor, it implements the steps of the improved and optimized PBFT consensus method applied to the consortium blockchain according to any one of claims 1-5.

Citation Information

Patent Citations

  • Alliance chain consensus method based on grid arbitration

    CN111179087A

  • Practical Byzantine fault-tolerant algorithm improvement scheme for alliance block chain

    CN113269630A