CN115271724A - Grouping Byzantine fault-tolerant algorithm based on dynamic trust model - Google Patents

Grouping Byzantine fault-tolerant algorithm based on dynamic trust model Download PDF

Info

Publication number
CN115271724A
CN115271724A CN202210902646.3A CN202210902646A CN115271724A CN 115271724 A CN115271724 A CN 115271724A CN 202210902646 A CN202210902646 A CN 202210902646A CN 115271724 A CN115271724 A CN 115271724A
Authority
CN
China
Prior art keywords
node
nodes
trust
consensus
group
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.)
Pending
Application number
CN202210902646.3A
Other languages
Chinese (zh)
Inventor
刘炜
佘维
田钊
阮敏捷
师恩洁
宰光军
夏玉洁
张聪
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhengzhou University
Original Assignee
Zhengzhou University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhengzhou University filed Critical Zhengzhou University
Priority to CN202210902646.3A priority Critical patent/CN115271724A/en
Publication of CN115271724A publication Critical patent/CN115271724A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3825Use of electronic signatures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3827Use of message hashing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3829Payment protocols; Details thereof insuring higher security of transaction involving key management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/40Authorisation, e.g. identification of payer or payee, verification of customer or shop credentials; Review and approval of payers, e.g. check credit lines or negative lists
    • G06Q20/401Transaction verification
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3236Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions

Abstract

The invention provides a packet Byzantine fault-tolerant algorithm based on a dynamic trust model, which comprises a client, a transaction processing center and a transaction processor, wherein the transaction processing center comprises a transaction pool, the client submits transactions to the transaction pool, the transaction processor extracts the transactions in the transaction pool, sequentially performs node selection, node grouping, consensus communication and master node reselection according to trust evaluation, initializes nodes in a node selection stage, and sequentially distributes keys for the nodes, sets initial trust and randomly selects the master nodes in an initialization stage; in the node grouping, nodes are successively grouped in a Hash modulo mode, and leader nodes of each group are found out; the invention effectively reduces the communication overhead and the consensus time delay, improves the throughput, the reliability and the stability, and effectively reduces the communication complexity of the Byzantine error-tolerant calculation.

Description

Grouping Byzantine fault-tolerant algorithm based on dynamic trust model
Technical Field
The invention belongs to the technical field of block chain link point grouping management bits, and particularly relates to a grouping Byzantine fault-tolerant algorithm based on a dynamic trust model.
Background
The block chain technology has the characteristics of decentralization, data traceability without tampering and the like, and can be used in the fields of financial transactions, data authentication, data storage, election voting and the like. The block chain technology has certain difficulty in practical application due to the fact that a large amount of computing or communication resources are consumed for achieving consistency of data storage and data processing among nodes in the block chain system, high time delay and low system throughput are generated. The consensus mechanism, which is a technique for achieving final agreement of nodes in the blockchain system, has a significant impact on the performance of the blockchain system. The common recognition algorithms in the mainstream at present include a workload certification algorithm (PoW), a rights and interests certification algorithm (PoS), a stock rights and interests certification algorithm (DPoS), a practical byzantine fault-tolerant algorithm (PBFT), and the like. The use of PoW, poS, and DPoS is mostly applicable to an open public chain, and a large number of nodes can be accommodated while having a relatively high fault tolerance rate, but the throughput of the system is low. Compared with the certification algorithm, the PBFT is more suitable for a federation chain and a private chain with less nodes and certain trust among the nodes. The throughput of the PBFT algorithm can reach thousands of nodes per second, but with the increase of the number of nodes, the communication traffic among the nodes can be increased sharply, and huge pressure is brought to network bandwidth, so that the number of the nodes in a block chain system using the PBFT protocol cannot be excessive.
For the problems of high PBFT traffic and performance degradation when the number of nodes increases, research is mainly performed in two aspects of controlling the scale of nodes participating in consensus and improving the consensus structure, for example:
in controlling the size of nodes involved in Consensus, "G-PBFT: A Location-based and Scalable Consensus for IoT-Block Applications [ C ]" by Lao L, dai X, xiao B et al, in 2020, IEEE International Parallel and Distributed Processing Symposium (IPDPS) proposed a Location-based extensible Consensus Protocol G-PBFT. The G-PBFT utilizes the geographic information of the fixed equipment to achieve consensus, and selects a node with a relatively fixed position as an endorser to participate in the PBFT consensus, so that the expenditure for verifying and recording transactions is reduced; "An Extensible Consensus successful basic on PBFT" published by Li Y, wang Z, fan J et al in 2019 in International Conference on Cyber-Enabled Distributed Computing and Knowledge Discovery proposes EPBFT suitable for dynamic networks, selects part of nodes to participate in Consensus by using Verifiable Random Function (VRF), and executes simplified consistency protocol under the condition of good network state, thereby reducing the traffic of the PBFT;
in improving Consensus structure, li W, feng C, zhang L, 2021, in IEEE Transactions on Parallel and Distributed Systems, "A Scalable Multi-layer PBFT Consensus for Block", proposed an extensible Multi-layer PBFT Consensus mechanism to reduce the traffic for single-layer PBFT Consensus and analyzed the number of nodes per layer when traffic is minimized. Chen Zihao, li Jiang, and published in 2019 in computer science, "improved PBFT consensus mechanism based on K-medoids", propose an improved PBFT consensus mechanism based on K-medoids, utilize K-medoids to cluster nodes participating in consensus according to characteristics, and use the improved PBFT algorithm in a clustered hierarchical model to reduce the number of communications required for consensus and improve consensus efficiency;
although the above-mentioned published documents optimize the PBFT algorithm, the optimized PBFT algorithm still has the defects of high communication overhead, prolonged consensus time, low throughput, and low reliability and stability.
Disclosure of Invention
The invention aims to overcome the defects of the prior art and provide an effective grouping Byzantine fault-tolerant algorithm based on a dynamic trust model.
The technical scheme of the invention is as follows:
a grouping Byzantine fault-tolerant algorithm based on a dynamic trust model comprises a client, a transaction processing center and a transaction processor, wherein the transaction processing center comprises a transaction pool, the client submits transactions to the transaction pool, and the transaction processor extracts the transactions in the transaction pool to perform the following processing steps:
s1, selecting nodes, initializing the nodes, and in an initialization stage, sequentially distributing keys, setting initial trust degrees and randomly selecting a main node for the nodes by a transaction processor;
step S2, grouping nodes, after the step S1 is completed, successively grouping the nodes with different trust levels, the initial trust level of which is set in the step S1, by adopting a Hash mode, dividing the nodes participating in consensus in the whole network into k groups, and finding out leader nodes of each group;
step S3, judging the breakdown of the groups, after the step S2 is finished, judging whether each group is broken, if the group is not broken, executing the step S4, if the group is broken, executing the step S2 to carry out the grouping again, and then executing the step S4 under a new attempt;
s4, consensus communication, namely after the step S3 is completed, the nodes are lifted out of the blocks, PBFT consensus is carried out on the blocks in the blocks, after intra-group consensus is completed, leader nodes of all groups represent the groups to carry out inter-group PBFT consensus, and after both intra-group consensus and inter-group consensus are completed, the blocks are synchronized to the local by the nodes;
and S5, reselecting the main node, updating the trust level and the trust state according to the dynamic trust model after finishing the step S4, and reselecting the main node to enter the next view.
Further, in the steps S4 to S5, when the consensus is overtime, the slave node triggers a view switching protocol, and if there are 2f +1 slave nodes requesting view switching, the new master node initiates a new view and starts a new round of consensus operation; the consensus timeout is that after a round of consensus is completed, the node reselects the master node, but the node does not receive the pre-prefix message sent by the master node within a specified time.
Further, the specific process of grouping nodes in step S2 is as follows:
step S21, randomly distributing the nodes in the credible state and the normal state to each group, and calculating h (key) according to the hash value of the current block and the node public key PK, namely:
h (key) = hash (PK) formula 1
H (key) is updated every time of grouping, h (key) is random because hash (block) is random, and the value of the hash (block) cannot be predicted and cannot be controlled, so that the randomness required by grouping is met;
s22, obtaining x-bit hexadecimal characters after h (key) and converting the x-bit hexadecimal characters into corresponding decimal integers y;
step S23, carrying out the modular operation on y, acquiring the random grouping index groupIndex corresponding to the node,
groupIndex = y% k formula 2;
step S24, if the number of the nodes in the group divided by the nodes reaches
Figure BDA0003767973510000041
groupIndex +1, if groupIndex +1=k, groupIndex =0;
step S25, repeating the step S24 until all the nodes in the credible state and the normal state are divided into groups;
s26, after the grouping of the nodes in the credible state and the normal state is finished, grouping the nodes in the abnormal state, and firstly executing the steps S21-S23 on the nodes in the abnormal state;
step S27, after step S26 is completed, if the number of nodes in the group to which the nodes are classified reaches
Figure BDA0003767973510000042
groupIndex +1, if groupIndex +1=k, groupIndex =0;
and step S28, repeating the step S27, and repeating the steps until the abnormal state nodes are divided into the groups.
After the credible state nodes, normal state nodes and abnormal state nodes are grouped, the leader nodes of each group are found out, the leader nodes are found out in the process that the main nodes in the group where the main nodes are located serve as the leader nodes of the group, the nodes with the highest trust degree in the rest groups serve as the leader nodes of the groups, if the leader nodes are down or have a Byzantine behavior, the next node is sequentially selected to serve as the leader node according to the sequence of the trust degrees in the groups, the k leader nodes form an upper common identification cluster, and the rest nodes form a bottom common identification cluster led by the leader nodes of the upper layer, so that a multi-center hierarchical network structure is formed.
Further, the consensus communication in step S4 specifically includes the following steps:
step S41, group consensus process:
step S411, the leader node sends a pre-preparation message to the slave nodes in the group, and the message format is<<L-PRE-PREPARE, v,h,t,D(b)>σi,b>。
Step S412, after receiving the pre-prepared message from the leader node, the slave node in the group verifies the message, if the message passes the verification, the slave node sends the prepared message to the other nodes in the group, and the message format is<<L-PREPARE,v,h,D(b),i>σi>And simultaneously the node receives the preparation message from other nodes in the group, when receiving 2fq+1 prepare messages and verify pass, enter commit phase.
Step S413, the slave node in the group organizes the confirmation message and sends the confirmation message to other nodes in the group, and the message format is<<L-COMMIT,v,h,D(b),i>σi>At the same time, the node receives confirmation messages from other nodes in the group, when receiving 2fq+1 acknowledgement message and when the verification passes, the group consensus is completed;
step S42, intergroup consensus process:
step S421, the leader node sends a preparation message to other group leader nodes, and the message format is<<G-PREPARE, v,h,t,D(b)>σi>When the leader node sends the preparation message, the preparation message from other leader nodes is received, and if the preparation message is received 2fk+1 standardAnd preparing messages and passing the verification, and entering a commit stage.
Step S422, each leader node sends confirmation information to other leader nodes, and the information format is<<G-COMMIT, v,h,D(b),i>σi>. When each leader node receives 2fk+1 confirmation messages, and when the verification passes, the group consensus is completed;
step S43, block synchronization to local process:
after steps S41-S42 are completed, each leader node sends an execution message to its group slave nodes, and each group of nodes attaches the block to the local block chain, thereby achieving final consistency of data in the block chain system.
In performing steps S41-S42, the following verification needs to be performed on the pre-prepared message:
(1) Whether v is consistent with the current view number of the user;
(2) h is consistent with the height of the current block;
(3) D (b) whether the digests of the block b are consistent or not;
(4) Whether the message signature is legal;
(5) Whether the transaction in the block body is legal or not and whether the transaction script can be executed correctly or not;
(6) Whether each field in the block header is correct and valid;
if all the verifications are passed, the validity of the message is confirmed, the node executes the block, and the execution result is cached.
Further, the dynamic trust model in step S5 includes a trust punishment mechanism, a trust consumption mechanism, a trust recovery mechanism, and a trust level mechanism, the calculation of the trust level depends on the trust punishment, the trust consumption, and the trust recovery mechanism, and the trust level mechanism sets a node trust state according to the magnitude of the node trust level and manages the node authority.
Furthermore, the credit and punishment mechanism introduces a Bayesian theory into the trust evaluation of the consensus network node, collects the historical behavior evaluation and the current behavior evaluation of the consensus node within a period of time, evaluates the trust of the node on the basis, and predicts the behavior of the node;
dividing the operation of the consensus communication into a plurality of time slots in terms of time, wherein each time slot is the time for completing one round of consensus communication, and each time when one round of consensus communication is completed, a time sliding window advances one time slot forwards;
according to the node behavior evaluation score recorded in the time sliding window, defining a trust degree evaluation formula of a node i as follows:
Figure BDA0003767973510000061
wherein the content of the first and second substances,
Figure BDA0003767973510000062
before the next round of consensus begins, the system gives the current trust degree to the node based on the feedback evaluation obtained by the node i in the time sliding window; α (i) represents the positive evaluation statistics of node i within the time sliding window; β (i) represents the negative evaluation statistics of node i within the time sliding window;
within the current time sliding window, updating α (i) according to the following formula,
Figure BDA0003767973510000063
wherein rf is a reward coefficient for controlling the rate of increase of confidence,
Figure BDA0003767973510000064
expressing the positive evaluation score of a node j to a node i, wherein pn is the total number of nodes for positive evaluation of the node i, f (t) is a time attenuation function, and m is a time sliding window value; the time decay function f (t) is defined as follows,
f(t)=ρm-tformula 5;
wherein rho is an attenuation coefficient, and rho is more than 0 and less than or equal to 1,1 and less than or equal to m;
within the current time sliding window, update β (i) according to
Figure BDA0003767973510000065
The pf is a penalty coefficient and is used for controlling the speed of the descending of the trust value;
Figure BDA0003767973510000066
representing the negative evaluation score of the node j to the node i, gn being the total number of nodes for negative evaluation of the node i, f (t) being a time attenuation function, and m being a time sliding window value;
the trust consumption calculation formula in the trust consumption mechanism is as follows:
Figure BDA0003767973510000067
Figure BDA0003767973510000068
representing the updated trust level when the node participates in consensus for the last time; wherein, lambda is more than 0, lambda is attenuation coefficient and is used for controlling the consumption speed; Δ b is the height difference between the block generated when the node participates in consensus for the last time and the current block, and the calculation formula of Δ b is as follows:
Δb=bcurrent-bpreviousformula 8;
the trust recovery calculation formula in the trust recovery mechanism is as follows:
Figure BDA0003767973510000071
u is a trust degree threshold value, and when the trust degree of the node is lower than u, the node is prohibited from participating in consensus; when the confidence level is higher than u, participation in consensus is allowed,
Figure BDA0003767973510000072
c is an increase coefficient, delta T is the time from the current time when the node is the last time to participate in the consensus, so that every T passesIn the time period, the node trust level will rise by c;
for the trust level mechanism, a, r and u are defined as thresholds of trust state change, 1 > a > r > u > 0, and based on the thresholds of trust state change, the following trust states are defined:
the node trust degree range of the trusted state is [ a,1];
the node trust degree range of the normal state is [ r, a ];
abnormal state, wherein the node trust degree range of the abnormal state is [ u, r ];
and in an invalid state, the node in the invalid state is that the node has multi-Byzantine behaviors or is off-line for a long time in a period of time, and the trust degree range of the node is [0,u ].
Further, for the trust award and punishment mechanism, in a consensus process, the node uses a private key to sign the block, and only the signature and the summary are transmitted after a pre-prepare stage, so that the behavior of the node can be distinguished. Depending on the role of the node(s),
Figure BDA0003767973510000073
the update rule of (2) is as follows:
(a) If the node i is a slave node and has information interaction with the node j in the consensus process, and the PREPARE message and the COMMIT message sent by the node i are consistent with most nodes and the signature verification is passed through after the verification of the node j, the node i is a slave node
Figure BDA0003767973510000074
Otherwise, the value is 0;
(b) If the node i is a main node and has information interaction with the node j in the consensus process, the transaction in the proposed block is legal after the verification of the node j, the fields in the block head are correct, the message contents sent in the prefix and commit stages are consistent with most nodes, the signature verification is passed, and finally the leader slave node successfully completes a round of consensus, then the node i is a master node and has information interaction with the node j in the consensus process, and the leader slave node passes the consensus
Figure BDA0003767973510000081
Otherwise it is 0.
Further, for the trust reward and punishment mechanism, according to the difference of the node roles,
Figure BDA0003767973510000082
the update rule of (2) is as follows:
(a) If the node i is a slave node and has information interaction with the node j in the process of consensus, if the node j verifies that the PREPARE message and the COMMIT message sent by the node i are inconsistent with most nodes or the signature verification fails and the possibility of tampering the message content or forging the identity exists, the node i sends the message to the COMMIT network, and if the node i sends the message to the COMMIT network, the node i sends the message to the COMMIT network through the network
Figure BDA0003767973510000083
Otherwise, the value is 0; .
(b) If the node i is a master node and has information interaction with the node j in the consensus process, if the following conditions are verified by the node j: the information in the proposed block is wrong, the content of the message sent in the preamble and commit stages is inconsistent with that of most nodes, the signature verification is not passed, and finally the slave node is not led to successfully complete a round of consensus, so that the slave node is not led to successfully complete the round of consensus
Figure BDA0003767973510000084
Otherwise it is 0.
Compared with the prior art, the grouping Byzantine fault-tolerant algorithm based on the dynamic trust model has the following beneficial effects:
by grouping and layering the nodes, the consensus is limited to be carried out in groups and among the groups, and the communication complexity of the algorithm is reduced on the premise of ensuring the participation of the nodes in the whole network in the consensus; secondly, a rule for polling and selecting the master node in the PBFT is modified, the master node is selected according to the node trust degree and the time interval from the last time serving as the master node, a basis is provided for the selection of the master node, and meanwhile, the problem of trust centralization is avoided; finally, combining with a dynamic trust model, increasing the attribute of the node trust degree, and managing the trust state and the right of the node; the method effectively reduces the communication overhead and the consensus time delay, improves the throughput, the reliability and the stability, and effectively reduces the communication complexity of the Byzantine error-tolerant calculation.
Drawings
FIG. 1 shows the number of Byzantine nodes in a system when a threshold u is different when the node performs a probability station 1/2 of the Byzantine behavior in the invention;
fig. 2 shows the number of byzantine nodes in the system when the threshold u is different when the node performs the probability station 2/3 of the byzantine behavior in the invention;
FIG. 3 is a curved view of the ratio of communication times when analyzing communication overhead according to the present invention;
FIG. 4 is a comparison graph of the PBFT and DRPFT algorithm delay in the delay analysis of the present invention;
FIG. 5 is a comparison graph of the PBFT and DGBFT algorithm throughput when performing throughput analysis in the present invention;
FIG. 6 is a graph comparing PBFT and DGBFT delays as a function of time-of-day runs for stability analysis in Pentium one.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to 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.
Examples of the invention
A packet Byzantine fault-tolerant algorithm based on a dynamic trust model comprises a client, a transaction processing center and a transaction processor, wherein the transaction processing center comprises a transaction pool, the client submits transactions to the transaction pool, and the transaction processor extracts the transactions in the transaction pool to perform the following processing steps:
s1, selecting nodes, initializing the nodes, and in an initialization stage, sequentially distributing keys, setting initial trust degrees and randomly selecting a main node for the nodes by a transaction processor;
step S2, grouping nodes, namely after the step S1 is finished, successively grouping the nodes with different trust levels, which are set with initial trust degrees in the step S1, in a mode of Hash modulus taking, dividing the nodes which participate in the consensus in the whole network into k groups, and finding out leader nodes of each group;
step S3, judging the downtime of the groups, after the step S2 is completed, judging whether each group is down, if the group is not down, executing the step S4, if the group is down, executing the step S2 to re-group, and then executing the step S4 under a new attempt;
s4, consensus communication, namely after the step S3 is completed, the nodes are lifted out of the blocks, PBFT consensus is carried out on the blocks in the blocks, after intra-group consensus is completed, leader nodes of all groups represent the groups to carry out inter-group PBFT consensus, and after both intra-group consensus and inter-group consensus are completed, the blocks are synchronized to the local by the nodes;
and S5, reselecting the main node, updating the trust level and the trust state according to the dynamic trust model after the step S4 is finished, reselecting the main node, and entering the next view.
In the invention, in steps S4-S5, when consensus is overtime, the slave node will trigger a view switching protocol, and if there are 2f +1 slave nodes requesting view switching, a new master node initiates a new view and starts a new round of consensus operation; the consensus timeout is that after a round of consensus is completed, the node reselects the master node, but the node does not receive the pre-prefix message sent by the master node within a specified time.
In the process of grouping nodes in step S2, because the PBFT algorithm traffic is greatly influenced by the number of nodes, in order to prevent a packet with a small number of nodes from waiting for the group with a large number of nodes to complete the group consensus and wasting communication resources, the number of nodes in each group should be close. The number of nodes per group is at most when grouping is specified
Figure BDA0003767973510000091
In addition, because the PBFT has a fault tolerance rate of 1/3, the distribution of the Byzantine nodes and normal nodes in each group also influences the consensus, so the nodes are randomly distributed into each group, and the consensus efficiency is prevented from being influenced by the excessive number of the Byzantine nodes in the group. In sum, randomness and uniformity should be satisfied at the time of grouping. To realize random and uniform grouping, DGBFT adopts a mode of Hash modulo to carry out different trustsThe nodes of the hierarchy are grouped in sequence. If the total number of nodes in the system is N, wherein the node set in the credible and normal states is L, the nodes are divided into k groups;
the specific process of the step S2 for node grouping is as follows:
step S21, randomly allocating nodes in the trusted state and the normal state to each group, and calculating h (key) by using the hash value of the current block and the node public key PK, that is:
h (key) = hash (block, PK) formula 1;
h (key) is updated every time grouping is carried out, h (key) is random because hash (block) is random, and the value of the hash (block) cannot be predicted and controlled, so that the randomness required by grouping is met;
s22, obtaining x-bit hexadecimal characters after h (key) and converting the x-bit hexadecimal characters into corresponding decimal integers y;
step S23, carrying out modular operation on y, acquiring the random grouping index groupIndex corresponding to the node,
groupIndex = y% k formula 2;
step S24, if the number of nodes in the group which are divided by the nodes reaches
Figure BDA0003767973510000101
groupIndex +1, if groupIndex +1=k, groupIndex =0;
step S25, repeating the step S24 until all the nodes in the credible state and the normal state are divided into groups;
s26, after the grouping of the nodes in the credible state and the normal state is finished, grouping the nodes in the abnormal state, and firstly executing the steps S21-S23 on the nodes in the abnormal state;
step S27, after step S26 is completed, if the number of nodes in the group to which the nodes are classified reaches
Figure BDA0003767973510000102
groupIndex +1, if groupIndex +1=k, groupIndex =0;
step S28, step S27 are repeated until the abnormal state nodes are divided into groups.
The step S2 describes an algorithm for node grouping as in table 1;
table 1 node grouping algorithm description
Figure BDA0003767973510000111
Figure BDA0003767973510000121
Nodes can be randomly and uniformly divided into each group by a mode of Hash modulus taking and grouping the maximum number of the nodes in the control group, and k node groups can be formed after the division is finished;
after the credible state nodes, normal state nodes and abnormal state nodes are grouped, the leader nodes of each group are found out, the leader nodes are found out in the process that the main nodes in the group where the main nodes are located serve as the leader nodes of the group, the nodes with the highest trust degree in the rest groups serve as the leader nodes of the groups, if the leader nodes are down or have a Byzantine behavior, the next node is sequentially selected to serve as the leader node according to the sequence of the trust degrees in the groups, the k leader nodes form an upper common identification cluster, and the rest nodes form a bottom common identification cluster led by the leader nodes of the upper layer, so that a multi-center hierarchical network structure is formed.
A node grouping stage is carried out through the step S2, the nodes are divided into k consensus subgroups through the grouping stage, and the whole consensus network is formed by an upper-layer consensus cluster consisting of k leader nodes and a bottom-layer consensus cluster consisting of k subgroups; the master node is responsible for packing transaction organization blocks, and after the master node provides the blocks, the blocks are transmitted to each group by the leader node. The whole consensus process is divided into three stages of intra-group consensus, inter-group consensus and block synchronization;
(1) Group consensus, wherein a main node collects transactions in a network within a period of time and organizes the transactions into blocks, then the blocks are sent to leader nodes of all node groups, and PBFT consensus is carried out in all consensus groups;
(2) After the group consensus is finished, performing PBFT consensus on each group of leader nodes representing the group, and returning the result of the group consensus to the slave nodes in the group;
(3) Block synchronization, wherein each node updates a local block chain according to a returned result;
the specific process of the consensus communication in the step S4 is as follows:
step S41, group consensus process:
step S411, the leader node sends a pre-prepared message to the slave nodes in the group, the message format is<<L-PRE-PREPARE, v,h,t,D(b)>σi,b>。
Step S412, after receiving the pre-prepared message from the leader node, the slave node in the group verifies the message, if the message passes the verification, the slave node sends the prepared message to the other nodes in the group, and the message format is<<L-PREPARE,v,h,D(b),i>σi>At the same time, the node receives the preparation message from other nodes in the group, when receiving 2fq+1 prepare messages and verify pass, enter commit phase.
Step S413, the slave node in the group organizes the confirmation message and sends the confirmation message to other nodes in the group, and the message format is<<L-COMMIT,v,h,D(b),i>σi>At the same time, the node receives confirmation messages from other nodes in the group, when receiving 2fq+1 acknowledgement message and when the verification passes, the group consensus is completed;
step S42, intergroup consensus process:
step S421, the leader node sends a preparation message to other group leader nodes, the message format is<<G-PREPARE, v,h,t,D(b)>σi>When the leader node sends the preparation message, the preparation message from other leader nodes is received, and if the preparation message is received 2fk+1 prepare messages and all pass the verification, then enter the commit phase.
Step S422, each leader node sends confirmation information to other leader nodes, and the information format is<<G-COMMIT, v,h,D(b),i>σi>. When each leader node receives 2fk+1 acknowledgement messages, and when the verification passes, the group consensus is completed;
step S43, block synchronization to local process:
after steps S41-S42 are completed, each leader node sends an execution message to its group slave nodes, and each group of nodes attaches the block to the local block chain, thereby achieving final consistency of data in the block chain system.
In performing steps S41-S42, the following verification needs to be performed on the pre-prepared message:
(1) Whether v is consistent with the current view number of the user;
(2) h is consistent with the height of the current block;
(3) D (b) whether the digests of the block b are consistent or not;
(4) Whether the message signature is legal;
(5) Whether the transaction in the block body is legal or not and whether the transaction script can be executed correctly or not;
(6) Whether each field in the block header is correct and valid;
if all the verifications are passed, the validity of the message is acknowledged, and the node executes the block and caches the execution result.
The description of the relevant symbols involved in the consensus communication process of step S4 is shown in table 2:
TABLE 2 description of related symbols
Figure BDA0003767973510000131
Figure BDA0003767973510000141
The dynamic trust model in the step S5 comprises a trust reward and punishment mechanism, a trust consumption mechanism, a trust recovery mechanism and a trust level mechanism, the trust degree is calculated according to the trust reward and punishment mechanism, the trust consumption mechanism and the trust recovery mechanism, the trust level mechanism sets a node trust state according to the node trust degree, and node authority is managed.
The trust reward and punishment mechanism introduces a Bayesian theory into the trust evaluation of the consensus network node, collects the historical behavior evaluation and the current behavior evaluation of the consensus node within a period of time, evaluates the node trust on the basis, and predicts the node behavior;
dividing the operation of the consensus communication into a plurality of time slots in terms of time, wherein each time slot is the time for completing one round of consensus communication, and each time when one round of consensus communication is completed, a time sliding window advances one time slot forwards;
according to the node behavior evaluation score recorded in the time sliding window, defining a trust evaluation formula of the node i as follows:
Figure BDA0003767973510000151
wherein, the first and the second end of the pipe are connected with each other,
Figure BDA0003767973510000152
before the next round of consensus begins, the system gives the current trust degree to the node based on the feedback evaluation obtained by the node i in the time sliding window; α (i) represents the positive evaluation statistics of node i within the time sliding window; β (i) represents the negative evaluation statistics of node i within the time sliding window;
within the current time sliding window, updating α (i) according to,
Figure BDA0003767973510000153
wherein rf is a reward coefficient for controlling the rate of increase of confidence,
Figure BDA0003767973510000154
expressing the positive evaluation score of a node j to a node i, wherein pn is the total number of nodes for positive evaluation of the node i, f (t) is a time attenuation function, and m is a time sliding window value; the time decay function f (t) is defined as follows,
f(t)=ρm-tformula 5;
wherein rho is an attenuation coefficient, and rho is more than 0 and less than or equal to 1,1 and less than or equal to m;
within the current time sliding window, updating β (i) according to the following formula,
Figure BDA0003767973510000155
wherein pf is a penalty coefficient used for controlling the speed of the decrease of the trust value;
Figure BDA0003767973510000156
representing the negative evaluation score of the node j to the node i, gn being the total number of nodes for performing negative evaluation on the node i, f (t) being a time attenuation function, and m being a time sliding window value;
the trust consumption calculation formula in the trust consumption mechanism is as follows:
Figure BDA0003767973510000157
Figure BDA0003767973510000158
representing the updated trust level when the node participates in consensus for the last time; wherein, lambda is more than 0, lambda is attenuation coefficient and is used for controlling the consumption speed; Δ b is the height difference between the block generated when the node participates in consensus for the last time and the current block, and the calculation formula of Δ b is as follows:
Δb=bcurrent-bpreviousformula 8;
the trust recovery calculation formula in the trust recovery mechanism is as follows:
Figure BDA0003767973510000161
u is a confidence threshold value, and when the node confidence is lower than u, the node is prohibited from participating in consensus; when the confidence level is higher than u, participation in consensus is allowed,
Figure BDA0003767973510000162
after the node trust degree is reduced to be lower than a threshold value u, the trust degree is forbidden to participate in consensus by a system, c is an increase coefficient, and delta T is the time from the current time when the node participates in consensus for the last time, so that the node trust degree is increased by c every time T time period;
for the trust level mechanism, defining a, r and u as thresholds of trust state change, and 1 > a > r > u > 0, and defining the following trust states based on the thresholds of trust state change:
a credibility state, wherein the node credibility range of the credibility state is [ a,1];
the node trust degree range of the normal state is [ r, a ];
an abnormal state, wherein the node trust degree range of the abnormal state is [ u, r ];
and in an invalid state, the node in the invalid state is that the node has multi-Byzantine behaviors or is off-line for a long time in a period of time, and the trust degree range of the node is [0,u ].
For the trust reward and punishment mechanism, in a consensus process, the node uses a private key to sign the block, and only the signature and the summary are transmitted after a pre-prefix stage, so that the behavior of the node can be distinguished. According to the difference of the roles of the nodes,
Figure BDA0003767973510000163
the update rule of (2) is as follows:
(a) If the node i is a slave node and has information interaction with the node j in the consensus process, and the PREPARE message and the COMMIT message sent by the node i are consistent with most nodes and the signature verification is passed through after the verification of the node j, the node i is a slave node
Figure BDA0003767973510000164
Otherwise, the value is 0;
(b) If the node i is a main node and has information interaction with the node j in the consensus process, the transaction in the proposed block is legal after the verification of the node j, the fields in the block head are correct, the message contents sent in the prefix and commit stages are consistent with most nodes, the signature verification is passed, and finally the leader slave nodeIf a round of consensus is successfully completed, then
Figure BDA0003767973510000171
Otherwise it is 0.
For the trust reward and punishment mechanism, according to different node roles,
Figure BDA0003767973510000172
the update rule of (2) is as follows:
(a) If the node i is a slave node and has information interaction with the node j in the process of consensus, if the node j verifies that the PREPARE message and the COMMIT message sent by the node i are inconsistent with most nodes or the signature verification fails and the possibility of tampering the message content or forging the identity exists, the node i sends the message to the COMMIT network, and if the node i sends the message to the COMMIT network, the node i sends the message to the COMMIT network through the network
Figure BDA0003767973510000173
Otherwise, the value is 0; .
(b) If the node i is a master node and has information interaction with the node j in the consensus process, if the following conditions are verified by the node j: the information in the proposed block is wrong, the content of the message sent in the preamble and commit stage is inconsistent with that of most nodes, the signature verification fails, and finally the slave nodes are not led to successfully complete a round of consensus, then
Figure BDA0003767973510000174
Otherwise it is 0.
In step S5, in the process of updating the master node, the master node is selected according to the node priority in the DGBFT, the priority is calculated according to the node trust and the time interval from the last time serving as the master node, and the priority calculation formula is as shown in formula 10.
Figure BDA0003767973510000175
Δ T is the time interval from the last time it served as the master node, T is a parameter given by the system. Before the main node is selected, priority updating is carried out on the nodes in the trusted state and the normal state, and then the main node is selected according to the priority sequence. The priority list is maintained by the main nodes, after the consensus is finished, the main nodes broadcast the priority list and the serial numbers of the main nodes in the next round, and if the main nodes in the next round are down, the nodes with the priority in the list are sequentially selected.
The master node selection algorithm is described in table 3, and the node priorities are calculated first, then sorted according to the priorities, and finally the node with the first order in the list is selected as the master node.
Table 3 master node selection algorithm description
Figure BDA0003767973510000176
Figure BDA0003767973510000181
Experimental analysis of the invention
In order to evaluate the performance of the DGBFT, a Golang language is used for carrying out simulation on the DGBFT and the PBFT, a distributed multi-node scene is simulated in a mode of establishing TCP connection between different port numbers for communication, and the environment configuration in an experiment is shown in a table 4.
TABLE 4 Experimental Environment
Figure BDA0003767973510000182
Firstly, analyzing a trust model and verifying the reliability of the model; secondly, analyzing the communication overhead of the two algorithms; then respectively testing the time delay and the throughput of the two algorithms under the condition of no Byzantine node, and analyzing the test result; and finally, testing and analyzing the stability of the two algorithms under the condition that the Byzantine node exists.
1) Reliability analysis
In the reliability test, the total number of nodes in the system is set to be 100, wherein the number of Byzantine nodes is 30, the initial trust of the nodes is 0.5, and the time attenuation coefficient rho and the penalty coefficient rf penalty coefficient pf are respectively set to be 0.9, 1.2 and 1.5. And (4) randomly selecting whether to perform the Byzantine behavior or not by the Byzantine node in each round of consensus along with the operation of the system. And when the trust degree is less than the threshold u, marking the trust state of the node as invalid, forbidding participation in consensus, and when the experimental test threshold u is respectively 0.4, 0.35 and 0.3, counting the number of the Byzantine nodes in the system along with the progress of the consensus.
As shown in FIG. 1 and FIG. 2, in each round of consensus, each node has a probability of 1/2 or 2/3 performing Byzantine behavior. Along with the operation of the algorithm, the speed of eliminating the Byzantine node at the early stage is high, because the early stage is a trust accumulation stage, the historical behavior evaluation information of the node recorded in the system is less, so the influence of the behavior evaluation score of the current turn of the node on the trust degree is large, and if the node chooses to make the Byzantine behavior in the early stage consensus process, the trust degree is greatly reduced. The speed of eliminating the Byzantine nodes in the later period is gradually reduced, because most of the historical behavior evaluation of the nodes is honest, and the time for the credibility to be reduced to the u value is relatively long after the credibility is accumulated to a certain value, so the speed of eliminating the Byzantine nodes in the later period is reduced.
As can be seen from fig. 1, when the probability of the node performing the byzantine behavior is 1/2, after 20 rounds of consensus, the number of byzantine nodes in the system is less than 5, and most of the byzantine nodes are determined to be in an invalid state. As can be seen from fig. 2, when the probability of the node performing the byzantine action is 2/3, the byzantine node is completely excluded after 14 rounds of consensus. Because the proportion of the node Byzantine behavior is increased, the speed of the decrease of the trust is accelerated, and therefore the Byzantine node can be eliminated more quickly.
In addition, as the threshold u is increased, the speed of excluding the byzantine node is faster, because the higher the threshold u is, the lower the tolerance degree of the byzantine node is, and the trust state threshold in the actual system needs to be set according to the security requirement of the system.
2) Communication overhead analysis
With the increase of the number of nodes in the PBFT algorithm, the traffic volume in the network increases sharply, thereby affecting the consensus efficiency. Therefore, the communication overhead is a key measure for the efficiency of the algorithm. The communication times required by one round of consensus can be completed by comparing the two algorithms, and whether the DGBFT is smaller than the PBFT in communication overhead can be verified.
The PBFT algorithm communication overhead is calculated as the number of communications required for the pre-prepare, commit stages. Assuming that the total number of nodes participating in consensus in the system is N, in the PBFT algorithm, the nodes both need to exchange messages with other nodes in the range of the entire network at the prepare and commit stages, so that the number of communications required to complete one round of PBFT consensus is X, and the number of communications broadcast once to the entire network by each node is N-1, which can be obtained:
x =2N (N-1) formula 11;
the DGBFT communication overhead calculates the number of communications required to send a prepare message from the master node to the leader node until the inter-group consensus is complete. The method comprises the steps that a main node sends a pre-preparation message, intra-group consensus and inter-group consensus to each leader node. For calculation and analysis, the phase of sending the prearranged message to each leader node by the main node is divided into a pre-preamble phase with intergroup consensus. If N nodes are divided into k groups, and there are N/k nodes in each group, the number of communications required for the DGBFT to complete one consensus is shown in table 5.
TABLE 5 DGBFT number of communications
Figure BDA0003767973510000201
In the group consensus phase, PBFT consensus is carried out on k groups, and the number of communication times required in the group consensus phase is recorded as W, so that the following results can be obtained:
Figure BDA0003767973510000202
in the calculation of the number of communications required in the inter-group consensus phase, the number of communications required for the master node to send the pre-preparation message to each leader node is included, so that the inter-group consensus phase can be regarded as that k leader nodes perform PBFT consensus, and the number of communications required in this phase is 2k (k-1). The communication times required by the DGBFT algorithm to complete a round of consensus are the sum of the communication times of consensus between groups and within groups, and are marked as Y, and in sum, the following can be obtained:
Figure BDA0003767973510000203
taking the ratio of the single consensus communication times of the two algorithms as Z, the following equations 11 and 13 can be obtained:
Figure BDA0003767973510000204
the communication frequency ratio surface graph of the PBFT and DGBFT algorithms is shown in fig. 3, when the total node number N is fixed and k is equal to 1, the DGBFT communication process is the same as PBFT, and at this time Z is 1. Along with the increase of the k value, Z is increased, at the moment, the number of nodes in each group is reduced due to the increase of the number of node groups, the DGBFT performs consensus in a small range, the communication frequency required in the intra-group consensus stage is effectively reduced, and the inter-group consensus communication frequency is relatively low because the k value is not increased to an extreme point at the moment. When k is increased to an extreme point, Z reaches a maximum value and then starts to decrease, and at the moment, the k value is too large, so that the node groups are too many, and the required communication times are rapidly increased in the inter-group consensus stage. When k equals N, DGBFT again follows the PBFT communication process, and Z is again 1. Although the value of k influences the ratio of the number of communication times, the communication overhead of the DGBFT is far smaller than that of the PBFT as a whole.
From the above analysis, the PBFT algorithm requires 2N (N-1) communications between nodes to complete a consensus, and thus has a time complexity of O (N)2). The DGBFT needs to carry out 2N (N/k-1) +2k (k-1) times of communication among the nodes to complete one consensus, and the time complexity is O (m)2) Wherein
Figure BDA0003767973510000211
When k is 1 or N, the DGBFT and the PBFT have the same communication process, and the time complexity is O (N)2). When 1 < k < N, O (m < N) is O (m), although the time complexity of DGBFT remains in the order of the square, since m < N2)<O(N2) In terms of time complexity, DGBFT is less than PBFT.
3) Efficiency analysis
3.1 Time delay analysis of
The consensus time delay is the time required by the system to complete one consensus. The consensus time delay is an important index for measuring the efficiency of the consensus algorithm, and the shorter the time delay is, the higher the transaction processing speed is, and the consensus efficiency is higher. This section compares the efficiency of PBFT and DGPFT by analyzing the time delay. The consensus latency tested in the experiment was the time between the client submitting the request and receiving f +1 replies.
As shown in fig. 4, the time delay of the PBFT algorithm rapidly increases as the number of nodes increases. The communication complexity due to PBFT is O (N)2) As the number of nodes increases, the amount of traffic in the network increases rapidly, and when the number of nodes is 100, the number of communication links established between the nodes is up to 19800, and a lot of time is spent on the establishment of the links and the communication between the nodes. In contrast, DGBFT divides consensus tasks into each group, with DGBFT algorithm delay increasing slowly as the number of nodes increases. With the same number of nodes, the time delay is sequentially reduced as the k value increases, and as can be seen from fig. 3, the larger the k value is before k reaches the extreme point, the fewer the number of communications required for consensus is, and at this time, the shorter the time required for consensus is.
3.2 Throughput analysis)
In the block chain system, the throughput refers to the number of transactions processed in a unit time, the throughput reflects the speed of processing the transactions by the system, and the throughput calculation method is as follows:
TPS=TradeΔtthe/delta t is 15;
wherein, tradeΔtIs the number of transactions processed by the system in Δ t time. The experiment is that a plurality of transaction information are added in one request, the required consensus time is tested, and the throughput is obtained by calculating the ratio of the number of transactions to the consensus time delay.
As shown in fig. 5, PBFT throughput decreases with increasing number of nodes, and when the number of nodes is greater than 70, the throughput decreases significantly due to the large amount of time used during consensus for establishing communication links and information exchange between nodes. The throughput of the DGBFT is slowly reduced along with the increase of the number of the nodes, because the DGBFT divides the nodes of the whole network into a plurality of groups, each group firstly carries out small-range intra-group consensus, and then only k leader nodes are needed to participate in the inter-group consensus stage, so that the communication overhead and consensus time delay are greatly reduced, and the nodes have more time to process the requests of the clients. Therefore, the DGBFT can still maintain higher throughput under the condition of more nodes. When the number of nodes is not changed, the throughput of the DGBFT increases with the increase of the value k, and as can be seen from the analysis in conjunction with fig. 3, before k reaches the extreme point, the number of communications and the delay required by the DGBFT to complete one consensus decrease with the increase of the value k, and at this time, the corresponding throughput is larger.
4) Stability analysis
In order to compare the stability of PBFT and DGBFT, the total node number is set to be 40, the Byzantine node number is 10, the initial trust degree is 0.5, rho, rf and pf are respectively 0.9, 1.2 and 1.5, and when the node trust degree is lower than 0.35, the state is judged to be invalid. Setting Byzantine node to send error information or delaying sending error information in communication with other nodes. Experimental tests the time delay of both algorithms with a consensus run.
As shown in fig. 6, with the consensus operation, the PBFT algorithm delay floats between 123ms and 137ms, while the DGBFT algorithm gradually reduces the effect of the byzantine node due to the existence of the dynamic trust mechanism, and the delay tends to be stable after the 8 th round. Experiments prove that the DGBFT is superior to PBFT in stability.
Although the present invention has been described in detail with reference to the foregoing embodiments, it will be apparent to those skilled in the art that various changes in the embodiments and/or modifications of the invention can be made, and equivalents and modifications of some features of the invention can be made without departing from the spirit and scope of the invention.

Claims (10)

1. A grouping Byzantine fault-tolerant algorithm based on a dynamic trust model is characterized in that: the system comprises a client, a transaction processing center and a transaction processor, wherein the transaction processing center comprises a transaction pool, the client submits transactions to the transaction pool, and the transaction processor extracts the transactions in the transaction pool to perform the following processing steps:
step S1, selecting nodes, initializing the nodes, and in an initialization stage, sequentially distributing keys, setting initial trust degrees and randomly selecting a main node for the nodes by a transaction processor;
step S2, grouping nodes, after the step S1 is completed, successively grouping the nodes with different trust levels, the initial trust level of which is set in the step S1, by adopting a Hash mode, dividing the nodes participating in consensus in the whole network into k groups, and finding out leader nodes of each group;
step S3, judging the breakdown of the groups, after the step S2 is finished, judging whether each group is broken, if the group is not broken, executing the step S4, if the group is broken, executing the step S2 to carry out the grouping again, and then executing the step S4 under a new attempt;
s4, consensus communication, namely after the step S3 is completed, the nodes are lifted out of the blocks, PBFT consensus is carried out on the blocks in the blocks, after intra-group consensus is completed, leader nodes of all groups represent the groups to carry out inter-group PBFT consensus, and after both intra-group consensus and inter-group consensus are completed, the blocks are synchronized to the local by the nodes;
and S5, reselecting the main node, updating the trust level and the trust state according to the dynamic trust model after the step S4 is finished, reselecting the main node, and entering the next view.
2. The dynamic trust model-based packet byzantine fault-tolerant algorithm according to claim 1, wherein in steps S4-S5, when consensus is overtime, a slave node triggers a view switching protocol, and if 2f +1 slave nodes request view switching, a new master node initiates a new view and starts a new round of consensus work; the consensus timeout is that after a round of consensus is completed, the node reselects the master node, but the node does not receive the pre-prefix message sent by the master node within a specified time.
3. The dynamic trust model-based packet byzantine fault-tolerant algorithm according to claim 1, wherein the specific process of grouping nodes in step S2 is as follows:
step S21, randomly distributing the nodes in the credible state and the normal state to each group, and calculating h (key) according to the hash value of the current block and the node public key PK, namely:
h (key) = hash (block, PK) formula 1;
h (key) is updated every time of grouping, h (key) is random because hash (block) is random, and the value of the hash (block) cannot be predicted and cannot be controlled, so that the randomness required by grouping is met;
s22, obtaining x-bit hexadecimal characters after h (key) and converting the x-bit hexadecimal characters into corresponding decimal integers y;
step S23, carrying out modular operation on y, acquiring the random grouping index groupIndex corresponding to the node,
groupIndex = y% k formula 2;
step S24, if the number of the nodes in the group divided by the nodes reaches
Figure FDA0003767973500000021
groupIndex +1, if groupIndex +1=k, groupIndex =0;
step S25, repeating the step S24 until all the nodes in the credible state and the normal state are divided into groups;
s26, after the grouping of the nodes in the credible state and the normal state is finished, grouping the nodes in the abnormal state, and firstly executing the steps S21-S23 on the nodes in the abnormal state;
step S27, after step S26 is completed, if the number of nodes in the group to which the nodes are classified reaches
Figure FDA0003767973500000022
groupIndex +1, if groupIndex +1=k, groupIndex =0;
and step S28, repeating the step S27, and repeating the steps until the abnormal state nodes are divided into the groups.
4. The dynamic trust model-based packet byzantine fault tolerance algorithm of claim 3, wherein: after the credible state nodes, normal state nodes and abnormal state nodes are grouped, the leader nodes of each group are found out, the leader nodes are found out in the process that the main nodes in the group where the main nodes are located serve as the leader nodes of the group, the nodes with the highest trust degree in the rest groups serve as the leader nodes of the groups, if the leader nodes are down or have a Byzantine behavior, the next node is sequentially selected to serve as the leader node according to the sequence of the trust degrees in the groups, the k leader nodes form an upper common identification cluster, and the rest nodes form a bottom common identification cluster led by the leader nodes of the upper layer, so that a multi-center hierarchical network structure is formed.
5. The dynamic trust model-based packet byzantine fault-tolerant algorithm according to claim 1, wherein the consensus communication in step S4 is performed as follows:
step S41, group consensus process:
step S411, the leader node sends a pre-preparation message to the slave nodes in the group, and the message format is<<L-PRE-PREPARE,v,h,t,D(b)>σi,b>。
Step S412, after receiving the pre-prepared message from the leader node, the slave node in the group verifies the message, if the message passes the verification, the slave node sends the prepared message to the other nodes in the group, and the message format is<<L-PREPARE,v,h,D(b),i>σi>And simultaneously the node receives the preparation message from other nodes in the group, when receiving 2fq+1 prepare messages and verify pass, enter commit phase.
Step S413, the slave node in the group organizes the confirmation message and sends the confirmation message to other nodes in the group, and the message format is<<L-COMMIT,v,h,D(b),i>σi>At the same time, the node receives confirmation messages from other nodes in the group, when receiving 2fq+1 acknowledgement message and when the verification passes, the group consensus is completed;
step S42, a group consensus process:
step S421, the leader node sends a preparation message to other group leader nodes, the message format is<<G-PREPARE,v,h,t,D(b)>σi>When the leader node sends the preparation message, the preparation message from other leader nodes is received, and if the preparation message is received 2fk+1 prepare messages and all pass the verification, then enter the commit phase.
Step S422, each leader node sends confirmation information to other leader nodes, and the information format is<<G-COMMIT,v,h,D(b),i>σi>. When each leader node receives 2fk+1 confirmation messages, and when the verification passes, the group consensus is completed;
step S43, block synchronization to local process:
after steps S41-S42 are completed, each leader node sends an execution message to its own slave node in the group, and each group of nodes attaches the block to the local block chain, thereby achieving the final consistency of data in the block chain system.
6. The dynamic trust model-based packet byzantine fault-tolerant algorithm according to claim 5, wherein the following verification is required for the pre-prepared message when performing steps S41-S42:
(1) Whether v is consistent with the current view number of the user;
(2) h is consistent with the height of the current block;
(3) D (b) whether the digests of the block b are consistent or not;
(4) Whether the message signature is legal;
(5) Whether the transaction in the block body is legal or not and whether the transaction script can be executed correctly or not;
(6) Whether each field in the block header is correct and valid;
if all the verifications are passed, the validity of the message is confirmed, the node executes the block, and the execution result is cached.
7. The dynamic trust model-based packet Byzantine fault-tolerant algorithm according to claim 1, wherein the dynamic trust model in the step S5 comprises a trust rewarding mechanism, a trust consumption mechanism, a trust recovery mechanism and a trust level mechanism, the trust degree is calculated according to the trust rewarding mechanism, the trust consumption mechanism and the trust recovery mechanism, and the trust level mechanism sets a node trust state according to the node trust degree and manages node authority.
8. The dynamic trust model-based packet byzantine fault tolerance algorithm of claim 7, wherein:
the trust reward and punishment mechanism introduces a Bayesian theory into the trust evaluation of the consensus network node, collects the historical behavior evaluation and the current behavior evaluation of the consensus node within a period of time, evaluates the node trust on the basis, and predicts the node behavior;
dividing the operation of the consensus communication into a plurality of time slots in terms of time, wherein each time slot is the time for completing one round of consensus communication, and each time when one round of consensus communication is completed, a time sliding window advances one time slot forwards;
according to the node behavior evaluation score recorded in the time sliding window, defining a trust evaluation formula of the node i as follows:
Figure FDA0003767973500000041
wherein the content of the first and second substances,
Figure FDA0003767973500000042
before the next round of consensus begins, the system gives the current trust degree to the node based on the feedback evaluation obtained by the node i in the time sliding window; α (i) represents the positive evaluation statistics of node i within the time sliding window; β (i) represents a negative evaluation statistic of node i within a time sliding window;
within the current time sliding window, updating α (i) according to the following formula,
Figure FDA0003767973500000043
wherein rf is a reward coefficient for controlling the rate of increase of confidence,
Figure FDA0003767973500000044
expressing the positive evaluation score of a node j to a node i, wherein pn is the total number of nodes for positive evaluation of the node i, f (t) is a time attenuation function, and m is a time sliding window value; the time decay function f (t) is defined as follows,
f(t)=ρm-tformula 5;
wherein rho is an attenuation coefficient, and rho is more than 0 and less than or equal to 1,1 and less than or equal to m;
within the current time sliding window, updating β (i) according to,
Figure FDA0003767973500000045
the pf is a penalty coefficient and is used for controlling the speed of the descending of the trust value;
Figure FDA0003767973500000046
representing the negative evaluation score of the node j to the node i, gn being the total number of nodes for negative evaluation of the node i, f (t) being a time attenuation function, and m being a time sliding window value;
the trust consumption calculation formula in the trust consumption mechanism is as follows:
Figure FDA0003767973500000051
Figure FDA0003767973500000052
representing the updated trust level when the node participates in the consensus for the last time; wherein, lambda is more than 0, lambda is attenuation coefficient and is used for controlling the consumption speed; Δ b is the height difference between the block generated when the node participates in consensus for the last time and the current block, and the calculation formula of Δ b is as follows:
Δb=bcurrent-bpreviousformula 8;
the trust recovery calculation formula in the trust recovery mechanism is as follows:
Figure FDA0003767973500000053
u is a confidence threshold value, and when the node confidence is lower than u, the node is prohibited from participating in consensus; when the confidence level is higher than u, participation in consensus is allowed,
Figure FDA0003767973500000054
after the node trust degree is reduced to be lower than a threshold value u, the trust degree is forbidden to participate in consensus by a system, c is an increase coefficient, and delta T is the time from the current time when the node participates in consensus for the last time, so that the node trust degree is increased by c every time T time period;
for the trust level mechanism, defining a, r and u as thresholds of trust state change, and 1 > a > r > u > 0, and defining the following trust states based on the thresholds of trust state change:
the node trust degree range of the trusted state is [ a,1];
a normal state, wherein the node trust degree range of the normal state is [ r, a ];
an abnormal state, wherein the node trust degree range of the abnormal state is [ u, r ];
and in the invalid state, the node in the invalid state is a node which has multiple Byzantine behaviors or is off-line for a long time in a period of time, and the trust degree range of the node is [0,u ].
9. The dynamic trust model-based packet byzantine fault-tolerant algorithm according to claim 8, wherein for the trust punishment mechanism, in a consensus process, a node signs a block with a private key, and only a signature and a digest are transferred after a pre-prepare stage, so that a behavior of the node can be distinguished. Depending on the role of the node(s),
Figure FDA0003767973500000055
the update rule of (2) is as follows:
(a) If the node i is a slave node and has information interaction with the node j in the consensus process, and the PREPARE message and the COMMIT message sent by the node i are consistent with most nodes and the signature verification is passed after the verification of the node j, the node i is a slave node
Figure FDA0003767973500000061
Otherwise, the value is 0;
(b) If the node i is a main node and has information interaction with the node j in the consensus process, the node j verifies that the transaction in the proposed block is legal, the fields in the block header are correct, the message contents sent in the prefix and commit stages are consistent with most nodes and the signature verification is passed, and finally the leader slave node successfully completes one round of consensus, the leader node determines that the block is legal and that the signature verification is passed
Figure FDA0003767973500000062
Otherwise it is 0.
10. The dynamic trust model-based packet byzantine fault-tolerant algorithm according to claim 8, wherein for the trust punishing mechanism, according to the node role difference,
Figure FDA0003767973500000063
the update rule of (2) is as follows:
(a) If the node i is a slave node and has information interaction with the node j in the process of consensus, if the node j verifies that the PREPARE message and the COMMIT message sent by the node i are inconsistent with most nodes or the signature verification fails and the possibility of tampering the message content or forging the identity exists, the node i sends the message to the COMMIT network, and if the node i sends the message to the COMMIT network, the node i sends the message to the COMMIT network through the network
Figure FDA0003767973500000064
Otherwise, the value is 0; .
(b) If the node i is a master node and has information interaction with the node j in the consensus process, if the following conditions are verified by the node j: the information in the proposed block is wrong, the content of the message sent in the preamble and commit stages is inconsistent with that of most nodes, the signature verification fails, and finally the slave nodes are not led to finish successfullyIn a round of consensus, then
Figure FDA0003767973500000065
Otherwise it is 0.
CN202210902646.3A 2022-07-27 2022-07-27 Grouping Byzantine fault-tolerant algorithm based on dynamic trust model Pending CN115271724A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210902646.3A CN115271724A (en) 2022-07-27 2022-07-27 Grouping Byzantine fault-tolerant algorithm based on dynamic trust model

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210902646.3A CN115271724A (en) 2022-07-27 2022-07-27 Grouping Byzantine fault-tolerant algorithm based on dynamic trust model

Publications (1)

Publication Number Publication Date
CN115271724A true CN115271724A (en) 2022-11-01

Family

ID=83771758

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210902646.3A Pending CN115271724A (en) 2022-07-27 2022-07-27 Grouping Byzantine fault-tolerant algorithm based on dynamic trust model

Country Status (1)

Country Link
CN (1) CN115271724A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116112490A (en) * 2022-12-29 2023-05-12 新疆大学 Low-complexity extensible Bayesian-busy-court fault-tolerant method and device and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116112490A (en) * 2022-12-29 2023-05-12 新疆大学 Low-complexity extensible Bayesian-busy-court fault-tolerant method and device and storage medium
CN116112490B (en) * 2022-12-29 2024-04-16 新疆大学 Low-complexity extensible Bayesian-busy-court fault-tolerant method and device and storage medium

Similar Documents

Publication Publication Date Title
Yun et al. DQN-based optimization framework for secure sharded blockchain systems
US11256581B2 (en) Byzantine agreement using communications having linear complexity
Gupta et al. Blockchain transaction processing
Li et al. Lightweight blockchain consensus mechanism and storage optimization for resource-constrained IoT devices
CN111131209B (en) Improved efficient consensus method, system, computer device and storage medium
US20220067063A1 (en) Apparatus and method for adaptively managing sharded blockchain network based on deep q network
Yuan et al. Efficient Byzantine consensus mechanism based on reputation in IoT blockchain
CN114626547A (en) Group collaborative learning method based on block chain
Wang et al. Beh-Raft-Chain: a behavior-based fast blockchain protocol for complex networks
CN111478795B (en) Alliance block chain network consensus method based on mixed Byzantine fault tolerance
CN111935207A (en) Block chain system consensus method based on improved C4.5 algorithm
CN113271204A (en) Byzantine fault-tolerant consensus method based on quantum key distribution
Le et al. A lightweight block validation method for resource-constrained iot devices in blockchain-based applications
CN115271724A (en) Grouping Byzantine fault-tolerant algorithm based on dynamic trust model
Xuan et al. ECBCM: a prestige‐based edge computing blockchain security consensus model
CN111865595B (en) Block chain consensus method and device
CN116669111A (en) Mobile edge computing task unloading method based on blockchain
CN114172680A (en) Block chain system based on node credit mechanism and operation method thereof
EP4004853A1 (en) Unity protocol consensus
CN115378788B (en) Block chain performance self-adaptive optimization method based on hierarchical consensus and reinforcement learning
Wu et al. Blockchain consensus mechanism for distributed energy transactions
Wang et al. Optimization Scheme of Trusted Task Offloading in IIoT Scenario Based on DQN.
Xu et al. Efficient Byzantine Consensus Mechanism Based on Reputation in IoT Blockchain
Okegbile et al. A Reputation-Enhanced Shard-Based Byzantine Fault-Tolerant Scheme for Secure Data Sharing in Zero Trust Human Digital Twin Systems
An et al. Research on Byzantine Fault Tolerant algorithm based on Node Weights

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