CN113676541A - Improved PBFT consensus method - Google Patents
Improved PBFT consensus method Download PDFInfo
- Publication number
- CN113676541A CN113676541A CN202110969409.4A CN202110969409A CN113676541A CN 113676541 A CN113676541 A CN 113676541A CN 202110969409 A CN202110969409 A CN 202110969409A CN 113676541 A CN113676541 A CN 113676541A
- Authority
- CN
- China
- Prior art keywords
- node
- consensus
- nodes
- level
- credit
- 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.)
- Granted
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/104—Peer-to-peer [P2P] networks
- H04L67/1044—Group management mechanisms
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/104—Peer-to-peer [P2P] networks
- H04L67/1044—Group management mechanisms
- H04L67/1051—Group master selection mechanisms
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Computing Systems (AREA)
- Mathematical Physics (AREA)
- Theoretical Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Hardware Redundancy (AREA)
Abstract
The invention discloses an improved PBFT consensus method, which comprises the following steps: giving initial credit points to all nodes, starting first consensus, updating the credit points of the nodes, and counting the times of continuous successful consensus; carrying out CART classification on all nodes periodically, and dynamically adjusting the identity types of the nodes; distributing participation permission, participating in election of the main node, and electing the main node and the alternative main node; the main node receives a request sent by a client, consensus is started, if the main node is malignant or fails in the consensus process, the alternative main node directly receives the authority of the main node, view switching is not performed, the main node is degraded, the credit integral is halved, and the consensus process is exited; and after the consensus process is finished, adjusting the credit integral and the continuous successful consensus times of the corresponding nodes. The invention endows all nodes with credit integration and continuous successful consensus times, dynamically adjusts the node level, eliminates malicious nodes, dynamically adds and deletes the nodes, improves the safety of the block chain and reduces the communication overhead.
Description
Technical Field
The invention relates to the technical field of block chains, in particular to an improved PBFT consensus method.
Background
The block chain technology is a concept which comes along with the bitcoin concept, and takes blocks as basic data storage units, and each block chain is formed by linking a plurality of blocks. Each block consists of a block header and a block body, wherein the block header contains information such as a hash value, a time stamp, a random number, a merkel root and the like of a previous block, the block body mainly stores transaction information, the hash of the previous block, namely summary information of the previous block, uniquely points to the previous block, and if an attacker wants to modify a certain block, the block and all blocks behind the block need to be modified, so that the possibility that a block chain is maliciously attacked and tampered is greatly reduced, and sufficient security and non-tamper property are embodied. In the forming process of the block chain, related technologies such as cryptography, distributed storage, P2P, consensus algorithm and the like are adopted, wherein consensus plays a crucial role, the main task of the block chain is to select proper nodes according to a fair rule, trade data which are agreed among all nodes in a distributed system are successfully packaged and added into the block chain, the block chain technology consistency is guaranteed, and a part of consensus algorithm also provides a Bytendra fault-tolerant mechanism, so that the block chain system performance (including trade processing capacity, throughput rate, resource consumption, expandability, robustness and the like) is greatly influenced. However, the development of the current block chain technology is limited by the defects of the consensus algorithm in the system, which mainly reflects the defects of performance deficiency and low consensus rate, such as excessive resource consumption, high transaction delay, low throughput and the like caused by the workload certification (Proof of Work, PoW) consensus mechanism adopted by bitcoin, and further such as the Proof of equity (PoS) also has the above defects, and it is necessary to improve the existing consensus algorithm or propose a new algorithm to improve throughput, reduce delay and reduce resource consumption.
Unlike other algorithms, the PBFT algorithm can solve the byzantine problem, is efficient enough, and can be applied to various application scenarios, so the PBFT algorithm has been widely applied in federation chains. However, PBFT still has many drawbacks, mainly in three areas: first, the communication overhead is large, and the time complexity of the whole consensus process is O (N)2) (N is the total number of nodes in the network); secondly, malicious nodes may act as master nodes, causing potential safety hazards, and constantly switch overView, reduced operating efficiency; thirdly, the nodes cannot be added or deleted dynamically, new nodes need to be added and only the restart is performed, and the cost is huge.
Disclosure of Invention
The invention aims to provide an improved PBFT consensus method, which aims to solve the problems in the prior art, endow all node credit integrals and continuous successful consensus times, dynamically adjust the node level according to the node credit integrals and the continuous successful consensus times, eliminate malicious nodes, dynamically add and delete nodes, remarkably improve the safety of a block chain and reduce communication overhead.
In order to achieve the purpose, the invention provides the following scheme: the invention provides an improved PBFT consensus method, which comprises the following steps:
s1, giving initial credit points to all nodes of the block chain, starting a first consensus process, updating the credit points of all the nodes, and counting the continuous successful consensus times;
s2, based on the credit score and the continuous successful consensus times, carrying out CART classification on all the nodes periodically, and dynamically adjusting the identity types of the nodes;
s3, distributing participation permission based on the identity type of the node, participating in election of the main node based on the participation permission, and electing the main node and the alternative main node;
s4, after receiving the request sent by the client, the main node broadcasts the request to all other nodes to start the consensus process, in the consensus process, the consensus process is simplified on the premise of ensuring the reliability of the main node, if the main node is malignant or fails, the alternative main node directly receives the authority of the main node, view switching is not carried out, the main node is degraded into a middle-level node, the credit score is halved, and the consensus process is exited;
and S5, after the consensus process is finished, acquiring the consensus result of the nodes participating in consensus, adjusting the credit points corresponding to the nodes and the continuous successful consensus times, returning to S2, and performing the next round of consensus.
Preferably, the S1 includes: when joining the first consensus, all the nodes distribute the same initial credit points and randomly distribute the initial identity categories of the nodes, join the consensus process, adjust the credit points of the nodes, and count and update the continuous successful consensus times of the nodes.
Preferably, the identity categories of the nodes in S2 include low-level nodes, intermediate-level nodes and high-level nodes.
Preferably, after the first consensus ends, the reputation scores of all the nodes are updated, and the identity categories of the nodes are adjusted:
the newly added node is initially low-level and is upgraded to middle-level after successfully participating in the synchronization block;
if the credit integral of the intermediate node reaches the threshold value of the high-level node, upgrading to high level;
if the credit score of the high-level node is reduced to the threshold value of the middle-level node, the high-level node is degraded to a middle level;
if the credit integral of the node is less than 0, degrading the node to be low level, resetting the credit integral of the node to be 0, and placing the node at the tail bit of the low-level node sequence;
if the node fails to generate a valid block in the consensus process, the master node checks whether the state of the node is failed or intentionally badly, if the node is failed, the node is normally deducted, if the node is intentionally badly, the node is directly reduced to a low level, and the credit score is 0, wherein the intentionally badly is that the node intentionally sends error information or information different from original information to other nodes in the consensus process, so that the consensus fails;
the conditions also need to be satisfied:
wherein, the node number in the high-level node set is represented, the node number in the middle-level node set is represented, and the node number in the low-level node set is represented; f represents the maximum number of nodes that are allowed to fail in all the sets of nodes participating in the consensus.
Preferably, the node is a high-level node capable of participating in election of the master node; the node is an advanced node or a middle node and can be used as a slave node to participate in the consensus process; the high level node, the intermediate level node, and the low level node are all capable of participating in a checkpoint protocol that, in addition to checking for a coherency state, is also capable of clearing information about a block that has been validated.
Preferably, the selecting for the master node in S3 includes performing CART decision tree classification evaluation on all the nodes based on the reputation scores and the continuous successful consensus times before the consensus process, and numbering | N | nodes in the distributed network in order based on the high and low of the evaluation results: {0, …, | N | -1}, the more advanced the ranking, the higher the node reliability, the greater the probability that it is selected as the master node, and the sequence numbers of the selected master node and the alternative master node are respectively represented as:
p=v mod|NA|;
p′=(v+1)mod|NA|;
wherein, p represents the sequence number of the host node selected at last; p' represents the sequence number of the selected alternative main node; v denotes the number of the current view; | N | represents the number of all nodes participating in the consensus process; | NAL represents the number of high-level nodes participating in the consensus process.
Preferably, the S4 includes:
the master node packs the request sent by the client into a pre-preparation message and broadcasts the pre-preparation message to all the slave nodes participating in the consensus process;
after receiving the pre-preparation message, the slave node verifies the correctness and judges whether the master node is malicious or fails, if the master node is normal and the sent message is reliable, the slave node generates a preparation message and sends the preparation message to the master node; after receiving the preparation message, the master node judges whether the state of the slave node is malicious or faulty, if the preparation messages sent by all the slave nodes are correct, the master node generates the confirmation message and broadcasts the confirmation message to all the nodes, and sends a success message to the client, and after receiving the confirmation message, all the nodes add a new block; if the message of the slave node is inconsistent with the message of the master node, if the number of the fault nodes or malicious nodes is larger than f, the master node terminates the consensus operation, punishs the slave node with the inconsistent message and updates the credit point, the identity category and the grade of the slave node in time, so that the integrity of the node set participating in the consensus each time is ensured;
and if the main node fails or acts badly, transferring the authority to an alternative main node to continue to finish consensus operation, degrading the main node into the intermediate node, halving the credit score, and exiting consensus.
Preferably, in S5, the other nodes other than the master node participate in completing a block generation consensus once, the reputation scores of the nodes are added according to a rule, the number of times of continuous successful participation in the consensus is added by 1, the master node reputation scores are also added according to a corresponding rule, and the number of times of continuous successful participation in the consensus is added by 1;
when the master nodes participating in consensus fail to successfully generate a block, the reputation scores of all the nodes participating in consensus are decremented by m, and the number of consecutive successful participation in consensus is reset to 0.
The invention discloses the following technical effects:
compared with the traditional PBFT, the improved PBFT consensus method has the advantages that the communication complexity and the communication consumption are greatly reduced by adopting the simplified consensus process on the premise of ensuring the safety, the average throughput is increased, the time delay is reduced, the malicious nodes are effectively eliminated, the consensus efficiency is improved, and regression prediction can be carried out in specific scenes, such as a medical care system, a medical data storage system and the like.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings needed to be used in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings without inventive exercise.
FIG. 1 is a schematic flow diagram of an improved PBFT consensus method in an embodiment of the present invention;
FIG. 2 is a node level up-down process diagram of the improved PBFT consensus method in an embodiment of the present invention;
FIG. 3 is a diagram of a consensus process for an improved PBFT consensus method in an embodiment of the present invention;
fig. 4 is a flowchart illustrating a process of performing block consensus by a master node according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in further detail below.
The present invention provides an improved PBFT consensus method, as illustrated with reference to fig. 1-4, comprising the steps of:
and S100, giving initial credit points to all nodes of the block chain, starting a first consensus process, updating the credit points of all the nodes, and counting the continuous successful consensus times of the nodes.
Before the initial consensus process begins, when consensus is performed for the first time, all nodes distribute uniform initial credit points, in this embodiment, the initial credit points of the nodes are all 10, at this time, the identity categories of the nodes are all distributed randomly, and the identity categories of the nodes have three types: low level nodes, intermediate level nodes, and high level nodes. After the first consensus process is finished, the identity types of the nodes are converted as shown in fig. 2, the credit points of all the nodes change according to the behavior of the nodes, and then the identity types of the nodes are adjusted within a fixed time.
S200, based on the credit integral and the continuous successful consensus times, carrying out CART classification on all the nodes regularly, and dynamically adjusting the identity types of the nodes.
The rules for node classification include:
the newly added node is initially low-level and is upgraded to middle-level after successfully participating in the synchronization block;
if the credit integral of the intermediate node reaches the threshold value of the high-level node, upgrading to high level;
if the credit integral of the high-level node is reduced to the threshold value of the middle-level node, the high-level node is degraded to the middle level;
if the credit integral of a node is less than 0, degrading the node to be low level, resetting the credit integral of the node to be 0, and placing the node at the end of the low-level node sequence;
if a node fails to generate a valid block in the consensus process, the master node checks whether the state of the node is faulty or intentionally badly, if the node is faulty, the node is normally deducted, if the node is intentionally badly, namely, the node intentionally sends error information or the error information is different from the original information to other nodes in the consensus process, so that the consensus fails, the node is directly reduced to be low, and the credit score is 0.
Besides, when dynamically updating the number of nodes participating in consensus, the condition shown in formula (1) needs to be satisfied:
wherein, the node number in the high-level node set is represented, the node number in the middle-level node set is represented, and the node number in the low-level node set is represented; f represents the maximum number of nodes that are allowed to fail in the set (including the sum) of all nodes participating in the consensus. When the number of all the classes of nodes participating in the consensus is determined, the condition can limit the number of the nodes in different classes, and the dynamic update is ensured not to have errors.
S300, the node acquires the participation authority according to the identity type of the node, participates in the election of the main node according to the participation authority, and elects the main node and the alternative main node.
In this embodiment, only the senior nodes may participate in the selection of the master node; the high-level node and the middle-level node can be used as slave nodes to participate in the consensus process; the high-level node, the middle-level node and the low-level node can all participate in a check point protocol, besides checking the consistency state, the check point protocol can also clear the relevant information of the confirmed block, and the method can dynamically add and delete the nodes and regularly update the reputation total evaluation sequence number and the identity category of the nodes so as to achieve the purpose of upgrading and downgrading. After each consensus, the evaluation of the node behavior is added once, so that the most efficient node is selected as the master node, and the less efficient and malicious node is selected as the master node with less probability or even can not participate in the consensus.
TABLE 1
As shown in table 2, in this embodiment, the range of the credit points of the nodes is set to [0,100], the initial credit points of all nodes are 10 when the system starts to operate, when a node participates in completing a valid block generation consensus once, the credit points of the nodes are updated according to the credit point update rule, and if the number of times that the node successfully generates a block continuously is less than or equal to 6 times, the credit points are added according to the fibonacci number sequence f (n), as shown in formula (2):
wherein, the parameter n is the number of times of successfully generating the block. If the number of times of the nodes for continuously and successfully generating the blocks is more than 6, adding 8 points to the credit score, and adding 1 to the number of times of continuously and successfully participating in consensus after adding the points; when a node fails to generate a block, its credit score is decremented by m, which is 10 in this embodiment, and the number of times of successive successful participation in consensus is reset to 0. After all nodes in the set sort the size of the credit score from low to high, the first 45% of the nodes are low-level nodes, the last 25% of the nodes are high-level nodes, and the remaining 30% are middle-level nodes.
TABLE 2
In the invention, nodes with participation authority can participate in the selection of the master node, the invention provides a new master node selection mode, a node credit score classification system is introduced to optimize the selection of the master node, the specific implementation mode is that before consensus, CART decision tree classification evaluation is carried out on all nodes according to node credit scores and the times of continuous successful participation in consensus, | N | consensus nodes in a distributed network are numbered in sequence according to the height of the total evaluation, {0, … and | N | -1}, the more the sequence is forward, the higher the node reliability is, the greater the probability of being selected as the master node is, and the selected master node sequence number and the alternative master node sequence number are respectively expressed as formulas (3) - (4):
p=vmod|NA| (3);
p'=(v+1)mod|NA| (4);
wherein, p represents the sequence number of the host node selected at last; p' represents the sequence number of the selected alternative main node; v denotes the number of the current view; | N | represents the number of all nodes participating in the consensus process; | NAL represents the number of high-level nodes participating in the consensus process.
Pseudo code written using a computer is as follows:
input: request message < NREQUEST, O, T, C >, | N | consensus nodes sent by client, view
Output: processing result reply requested by client
1:Int a,b a∈[1,100-|N|],b∈[1,|N|-4]
2:view=0;
3:if(|N|+a|||N|-b)
4:CART tree classification:consensus node in blockchain;
5:the number of consensus node k based on credit assessment ranking:{0,…,|N|-1}
6:p=v mod|N|
7:p'=(v+1)mod|N|
8:else
9:check the validity of the state of p
10:if p state=normal
11:return p
12:Else
13:view++
14:return p'
B, if the number of the nodes is increased or quitted, updating the classification tree again, wherein p is a main node selected according to the sequence, and p' is an alternative main node selected according to the sequence; if not, judging the state of the master node p, if the master node is normal, continuing to perform consensus, otherwise, starting to perform a new consensus by adopting the alternative master node.
In the step, the selection mode of the main node is optimized, the main node is selected from the node list with high reliability through periodic classification, and the alternative main node is selected at the same time, so that frequent view switching caused by the failure of the main node is avoided, and the communication time delay required by the whole consensus process is reduced.
S400, after the main node elects and generates, after the main node receives the request sent by the client, the main node broadcasts the request to all other nodes, a consensus process is started, in the consensus process, the consensus process is simplified on the premise that the reliability of the main node is guaranteed, if the main node is malignant or fails, the alternative main node directly receives the authority of the main node, view switching is not performed, the main node is degraded to be a middle-level node, the credit integral is halved, and the consensus process is quitted.
The specific process is shown in FIG. 4:
the client sends a request message < NREQUEST, O, T, C > to the master node p, wherein O is a request execution state machine, T is a time stamp, and C represents a client number.
When detecting that a new transaction request exists in the whole blockchain network, firstly, judging whether a new consensus node is added or an old consensus node is withdrawn. If yes, classifying and sequencing all the consensus nodes according to a classification model of the CART classification decision tree, re-evaluating the reliability, re-numbering and selecting a main node, an alternative node and the like; if not, the method works normally, and then the slave node detects whether the state of the master node in the current view is normal.
If the main node is normal, the main node p allocates a proposal number n after receiving a request sent by the client, then generates a pre-preparation message, and broadcasts the pre-preparation message to all the consensus nodes, wherein the message format is as follows: < < Npre-prepare, v, n, digest, result >, credit _ score, message >. V is a view number, digest is an abstract of a message, credit _ score is node credit integral information, result is a result of Hash calculation performed by the credit _ score, and the message is a request message of a client.
After receiving the pre-preparation message sent by the master node p, the slave node Replica verifies the correctness of the message, firstly judges whether the master node is reliable, and generates the preparation message and sends the preparation message to the master node if the master node is reliable. The message format is < NPrepare, v, n, digest, i, credit _ score >, where i is the node number. At this stage, the master node receives the preparation messages sent by all the other nodes, verifies the authenticity of the messages, and enters the confirmation stage if more than (2f +1) of the preparation messages are correct. Otherwise, if the current main node is in a state of being crashed, failed or is in a state of being badly done, the authority is transferred to the alternative main node, the consensus operation is continuously completed, the main node is degraded to be a middle-level node, the credit integral is halved, the consensus is quitted, the message < Failure, v, t, c, k > of the consistency consensus verification Failure of the original main node is sent out, and the view is added with 1.
After receiving the preparation message, the master node p judges whether the slave node has bad or fault state, if the preparation messages sent by all the slave nodes are correct and the same, the master node generates an acknowledgement message < NCommit, v, n, digest, ack > and broadcasts the acknowledgement message to all the nodes, wherein ack is the addition acknowledgement, and sends a success message to the client, and after receiving the acknowledgement message, all the nodes add a into a new block as the addition acknowledgement message, which indicates that the master node has acknowledged the addition. If the messages of the slave nodes less than f are inconsistent with the master node, continuously sending a confirmation message, confirming the pre-generated block and adding the pre-generated block to the tail of the block chain, and updating local records of all the nodes; if the messages of the slave nodes are inconsistent with the messages of the master node and the number of the slave nodes is larger than f, the master node terminates the consensus operation, punishs the slave nodes with inconsistent messages, updates the credit points of the nodes and the classification evaluation of the nodes in time, and ensures the integrity of the node set participating in the consensus each time.
The reliability of the main node is guaranteed under the condition of double insurance, so that the consensus process of the consistency protocol is optimized, whether a Byzantine node exists in the system is judged according to the state of the system node in the consensus process, if the Byzantine node does not exist or the number of the Byzantine nodes is smaller than f, the consistency protocol can be guaranteed to be optimized in most of the time, the consensus efficiency is improved on the whole, meanwhile, a bidirectional verification process is added in the consistency protocol, in the broadcasting process, the accuracy of data can be verified by the slave node, whether the main node is the Byzantine node is judged, and the consensus efficiency of the whole system is guaranteed.
And S500, after the consensus process is finished, obtaining the consensus result of the nodes participating in the consensus, adjusting the credit integral and the continuous successful consensus times of the corresponding nodes, returning to S200, and starting the next round of consensus.
The other nodes except the main node participate in completing the block generation consensus for one time, credit points of the nodes are correspondingly added according to credit point updating rules, the number of times of continuous successful participation in the consensus is added by 1, the credit points of the main node also are correspondingly added according to the credit point updating rules, and the number of times of continuous successful participation in the consensus is added by 1;
if all nodes participating in consensus fail to generate blocks successfully, the credit score of the node is reduced by m, and the number of times of continuous successful consensus participation is reset to 0.
In the embodiment, when the nodes are selected and updated (S100, S200, S500), a CART decision tree reputation evaluation classification system and a node periodic update system are added to the checkpoint protocol, so that the security and reliability of subsequent master node elections are ensured, and the purpose of enabling the nodes to dynamically join and leave the system is achieved.
The above-described embodiments are merely illustrative of the preferred embodiments of the present invention, and do not limit the scope of the present invention, and various modifications and improvements of the technical solutions of the present invention can be made by those skilled in the art without departing from the spirit of the present invention, and the technical solutions of the present invention are within the scope of the present invention defined by the claims.
Claims (8)
1. An improved PBFT consensus method, characterized by: the method comprises the following steps:
s1, giving initial credit points to all nodes of the block chain, starting a first consensus process, updating the credit points of all the nodes, and counting the continuous successful consensus times;
s2, based on the credit score and the continuous successful consensus times, carrying out CART classification on all the nodes periodically, and dynamically adjusting the identity types of the nodes;
s3, distributing participation permission based on the identity type of the node, participating in election of the main node based on the participation permission, and electing the main node and the alternative main node;
s4, after receiving the request sent by the client, the main node broadcasts the request to all other nodes to start the consensus process, in the consensus process, the consensus process is simplified on the premise of ensuring the reliability of the main node, if the main node is malignant or fails, the alternative main node directly receives the authority of the main node, view switching is not carried out, the main node is degraded into a middle-level node, the credit integral is halved, and the consensus process is exited;
and S5, after the consensus process is finished, acquiring the consensus result of the nodes participating in consensus, adjusting the credit points corresponding to the nodes and the continuous successful consensus times, returning to S2, and performing the next round of consensus.
2. The improved PBFT consensus method of claim 1, wherein:
the S1 includes: when joining the first consensus, all the nodes distribute the same initial credit points and randomly distribute the initial identity categories of the nodes, join the consensus process, adjust the credit points of the nodes, and count and update the continuous successful consensus times of the nodes.
3. The improved PBFT consensus method of claim 1, wherein: the identity categories of the nodes in the S2 include low-level nodes, intermediate-level nodes, and high-level nodes.
4. The improved PBFT consensus method of claim 3, wherein: the dynamically adjusting the identity category of the node in S2 includes: after the first consensus is finished, updating the credit scores of all the nodes, and adjusting the identity types of the nodes:
the newly added node is initially low-level and is upgraded to middle-level after successfully participating in the synchronization block;
if the credit integral of the intermediate node reaches the threshold value of the high-level node, upgrading to high level;
if the credit score of the high-level node is reduced to the threshold value of the middle-level node, the high-level node is degraded to a middle level;
if the credit integral of the node is less than 0, degrading the node to be low level, resetting the credit integral of the node to be 0, and placing the node at the tail bit of the low-level node sequence;
if the node fails to generate a valid block in the consensus process, the master node checks whether the state of the node is failed or intentionally badly, if the node is failed, the node is normally deducted, if the node is intentionally badly, the node is directly reduced to a low level, and the credit score is 0, wherein the intentionally badly is that the node intentionally sends error information or information different from original information to other nodes in the consensus process, so that the consensus fails;
the conditions also need to be satisfied:
wherein, the node number in the high-level node set is represented, the node number in the middle-level node set is represented, and the node number in the low-level node set is represented; f represents the maximum number of nodes that are allowed to fail in all the sets of nodes participating in the consensus.
5. The improved PBFT consensus method of claim 4, wherein: the participation and selection permission in the S3 is as follows: the node is a high-level node and can participate in the election of the main node; the node is an advanced node or a middle node and can be used as a slave node to participate in the consensus process; the high level node, the intermediate level node, and the low level node are all capable of participating in a checkpoint protocol that, in addition to checking for a coherency state, is also capable of clearing information about a block that has been validated.
6. The improved PBFT consensus method of claim 5, wherein: the selecting of the master node in S3 includes, before the consensus process, performing CART decision tree classification evaluation on all the nodes based on the reputation scores and the number of consecutive successful consensus times, and numbering N nodes in the distributed network in order based on the level of evaluation results: {0, …, | N | -1}, the more advanced the ranking, the higher the node reliability, the greater the probability that it is selected as the master node, and the sequence numbers of the selected master node and the alternative master node are respectively represented as:
p=v mod |NA|;
p′=(v+1)mod |NA|;
wherein, p represents the sequence number of the host node selected at last; p' represents the sequence number of the selected alternative main node; v denotes the number of the current view; | N | represents the number of all nodes participating in the consensus process; | NAL represents the number of high-level nodes participating in the consensus process.
7. The improved PBFT consensus method of claim 5, wherein: the S4 includes:
the master node packs the request sent by the client into a pre-preparation message and broadcasts the pre-preparation message to all the slave nodes participating in the consensus process;
after receiving the pre-preparation message, the slave node verifies the correctness and judges whether the master node is malicious or fails, and if the master node is normal and the sent pre-preparation message is reliable, a preparation message is generated and sent to the master node; after receiving the preparation message, the master node judges whether the state of the slave node is malicious or faulty, if the preparation messages sent by all the slave nodes are correct, the master node generates the confirmation message and broadcasts the confirmation message to all the nodes, and sends a success message to the client, and after receiving the confirmation message, all the nodes add a new block; if the message of the slave node is inconsistent with the message of the master node, if the number of the fault nodes or malicious nodes is larger than f, the master node terminates the consensus operation, punishs the slave node with the inconsistent message and updates the credit point, the identity category and the grade of the slave node in time, so that the integrity of the node set participating in the consensus each time is ensured;
and if the main node fails or acts badly, transferring the authority to an alternative main node to continue to finish consensus operation, degrading the main node into the intermediate node, halving the credit score, and exiting consensus.
8. The improved PBFT consensus method of claim 1, wherein: in S5, the other nodes other than the master node participate in completing one-time block generation consensus, the credit points of the nodes are added according to rules, the number of times of continuous successful participation in consensus is added by 1, the credit points of the master node are also added according to corresponding rules, and the number of times of continuous successful participation in consensus is added by 1;
when the master nodes participating in consensus fail to successfully generate a block, the reputation scores of all the nodes participating in consensus are decremented by m, and the number of consecutive successful participation in consensus is reset to 0.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110969409.4A CN113676541B (en) | 2021-08-23 | 2021-08-23 | Improved PBFT consensus method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110969409.4A CN113676541B (en) | 2021-08-23 | 2021-08-23 | Improved PBFT consensus method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113676541A true CN113676541A (en) | 2021-11-19 |
CN113676541B CN113676541B (en) | 2023-06-27 |
Family
ID=78545342
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110969409.4A Active CN113676541B (en) | 2021-08-23 | 2021-08-23 | Improved PBFT consensus method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113676541B (en) |
Cited By (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114143104A (en) * | 2021-12-06 | 2022-03-04 | 昆明理工大学 | DPoS (distributed denial of service) consensus mechanism node reputation value measurement method based on dynamic trust model |
CN114448980A (en) * | 2022-01-06 | 2022-05-06 | 上海应用技术大学 | Improvement method of PBFT algorithm for Internet of things |
CN114760135A (en) * | 2022-04-19 | 2022-07-15 | 浙江大学 | Optimization method of block chain fault-tolerant consensus scheme |
CN115633035A (en) * | 2022-12-07 | 2023-01-20 | 长春大学 | Improved PBFT (physical layer transmission) based block chain consensus algorithm for Internet of things |
CN115664684A (en) * | 2022-12-27 | 2023-01-31 | 湖南工商大学 | Consensus protocol operation method and device fusing digital evidence and related equipment |
CN116915505A (en) * | 2023-09-12 | 2023-10-20 | 南京理工大学 | Block chain consensus method and device based on improved PBFT algorithm |
CN117408718A (en) * | 2023-12-14 | 2024-01-16 | 南京邮电大学 | PBFT optimization method for large-scale medicine traceability |
WO2024113334A1 (en) * | 2022-11-29 | 2024-06-06 | 中国科学院深圳先进技术研究院 | Improved consensus method based on raft and related device |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108492103A (en) * | 2018-02-07 | 2018-09-04 | 北京大学深圳研究生院 | A kind of alliance's block chain common recognition method |
CN110351133A (en) * | 2019-06-28 | 2019-10-18 | 阿里巴巴集团控股有限公司 | Method and device for the host node hand-off process in block catenary system |
CN110838947A (en) * | 2019-11-21 | 2020-02-25 | 桂林电子科技大学 | Multi-block output common chain consensus mechanism based on H-Algorand |
CN111355810A (en) * | 2020-03-17 | 2020-06-30 | 重庆邮电大学 | Improved PBFT consensus method based on credit and voting mechanism |
WO2020138606A1 (en) * | 2018-12-28 | 2020-07-02 | 연세대학교 산학협력단 | Fault-tolerant consensus method for eliminating obstacle factors of consensus in blockchain network |
CN112039964A (en) * | 2020-08-24 | 2020-12-04 | 大连理工大学 | Node reputation consensus method based on block chain |
CN112532581A (en) * | 2020-10-26 | 2021-03-19 | 南京辰阔网络科技有限公司 | Improved PBFT consensus method based on consensus participation and transaction activity |
-
2021
- 2021-08-23 CN CN202110969409.4A patent/CN113676541B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108492103A (en) * | 2018-02-07 | 2018-09-04 | 北京大学深圳研究生院 | A kind of alliance's block chain common recognition method |
WO2020138606A1 (en) * | 2018-12-28 | 2020-07-02 | 연세대학교 산학협력단 | Fault-tolerant consensus method for eliminating obstacle factors of consensus in blockchain network |
CN110351133A (en) * | 2019-06-28 | 2019-10-18 | 阿里巴巴集团控股有限公司 | Method and device for the host node hand-off process in block catenary system |
CN110838947A (en) * | 2019-11-21 | 2020-02-25 | 桂林电子科技大学 | Multi-block output common chain consensus mechanism based on H-Algorand |
CN111355810A (en) * | 2020-03-17 | 2020-06-30 | 重庆邮电大学 | Improved PBFT consensus method based on credit and voting mechanism |
CN112039964A (en) * | 2020-08-24 | 2020-12-04 | 大连理工大学 | Node reputation consensus method based on block chain |
CN112532581A (en) * | 2020-10-26 | 2021-03-19 | 南京辰阔网络科技有限公司 | Improved PBFT consensus method based on consensus participation and transaction activity |
Cited By (14)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114143104A (en) * | 2021-12-06 | 2022-03-04 | 昆明理工大学 | DPoS (distributed denial of service) consensus mechanism node reputation value measurement method based on dynamic trust model |
CN114143104B (en) * | 2021-12-06 | 2022-10-14 | 昆明理工大学 | DPoS (distributed denial of service) consensus mechanism node reputation value measurement method based on dynamic trust model |
CN114448980A (en) * | 2022-01-06 | 2022-05-06 | 上海应用技术大学 | Improvement method of PBFT algorithm for Internet of things |
CN114448980B (en) * | 2022-01-06 | 2023-09-01 | 上海应用技术大学 | Improvement method of PBFT algorithm for Internet of things |
CN114760135A (en) * | 2022-04-19 | 2022-07-15 | 浙江大学 | Optimization method of block chain fault-tolerant consensus scheme |
WO2024113334A1 (en) * | 2022-11-29 | 2024-06-06 | 中国科学院深圳先进技术研究院 | Improved consensus method based on raft and related device |
CN115633035B (en) * | 2022-12-07 | 2023-03-17 | 长春大学 | Improved PBFT (physical layer transmission) based block chain consensus algorithm for Internet of things |
CN115633035A (en) * | 2022-12-07 | 2023-01-20 | 长春大学 | Improved PBFT (physical layer transmission) based block chain consensus algorithm for Internet of things |
CN115664684B (en) * | 2022-12-27 | 2023-04-18 | 湖南工商大学 | Consensus protocol operation method and device fusing digital evidence and related equipment |
CN115664684A (en) * | 2022-12-27 | 2023-01-31 | 湖南工商大学 | Consensus protocol operation method and device fusing digital evidence and related equipment |
CN116915505A (en) * | 2023-09-12 | 2023-10-20 | 南京理工大学 | Block chain consensus method and device based on improved PBFT algorithm |
CN116915505B (en) * | 2023-09-12 | 2023-11-21 | 南京理工大学 | Block chain consensus method and device based on improved PBFT algorithm |
CN117408718A (en) * | 2023-12-14 | 2024-01-16 | 南京邮电大学 | PBFT optimization method for large-scale medicine traceability |
CN117408718B (en) * | 2023-12-14 | 2024-03-08 | 南京邮电大学 | PBFT optimization method for large-scale medicine traceability |
Also Published As
Publication number | Publication date |
---|---|
CN113676541B (en) | 2023-06-27 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN113676541A (en) | Improved PBFT consensus method | |
US11971877B2 (en) | Method, apparatus, device, and storage medium for proposal message processing for blockchain | |
CN112039964B (en) | Node reputation consensus method based on block chain | |
Civit et al. | Polygraph: Accountable byzantine agreement | |
CN111241114B (en) | Intelligent service transaction block chain credit management method and system combining transaction and consensus | |
CN108737375B (en) | Block chain consensus method and system | |
CN111131209B (en) | Improved efficient consensus method, system, computer device and storage medium | |
KR102062896B1 (en) | Methods and apparatus for a distributed database within a network | |
CN112532581A (en) | Improved PBFT consensus method based on consensus participation and transaction activity | |
CN112468302A (en) | Editable blockchain based on verifiable multiparty secret sharing | |
CN111026578A (en) | Intelligent contract security detection method based on prediction machine | |
CN111935207A (en) | Block chain system consensus method based on improved C4.5 algorithm | |
CN111597077B (en) | Data processing method, data processing device, computer equipment and storage medium | |
Cordova et al. | Blockgraph: A blockchain for mobile ad hoc networks | |
CN114172680B (en) | Operation method of block chain system based on node reputation mechanism | |
CN113191772A (en) | Layer model-based alliance chain consensus method | |
CN115412263A (en) | Byzantine fault-tolerant consensus method based on double blinding | |
CN115174570A (en) | Cross-chain consensus method and system based on dynamic committee | |
CN112565370B (en) | Method and system for verifying calculation result based on wireless communication and block chain scene | |
CN113360567A (en) | Safe storage method and application of electric power transaction distributed account book based on block chain | |
CN112700333A (en) | Electronic archive consensus method based on block chain | |
CN112272114A (en) | Method, device, equipment and storage medium for sending information across block chain network | |
CN114861233B (en) | Fragmenting asynchronous Bayesian family fault-tolerant consensus method and device without trusted third party | |
CN116232893A (en) | Consensus method and device of distributed system, electronic equipment and storage medium | |
CN116389040A (en) | Reputation-based blockchain consensus method, device and computer equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |