CN117914859A - PBFT algorithm-based distributed consensus master node selection method and system - Google Patents

PBFT algorithm-based distributed consensus master node selection method and system Download PDF

Info

Publication number
CN117914859A
CN117914859A CN202311721739.7A CN202311721739A CN117914859A CN 117914859 A CN117914859 A CN 117914859A CN 202311721739 A CN202311721739 A CN 202311721739A CN 117914859 A CN117914859 A CN 117914859A
Authority
CN
China
Prior art keywords
node
credit
queue
master node
nodes
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
CN202311721739.7A
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.)
Tianyi Cloud Technology Co Ltd
Original Assignee
Tianyi Cloud Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tianyi Cloud Technology Co Ltd filed Critical Tianyi Cloud Technology Co Ltd
Priority to CN202311721739.7A priority Critical patent/CN117914859A/en
Publication of CN117914859A publication Critical patent/CN117914859A/en
Pending legal-status Critical Current

Links

Classifications

    • 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/104Peer-to-peer [P2P] networks
    • H04L67/1044Group management mechanisms 
    • H04L67/1051Group master selection mechanisms
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/20Network architectures or network communication protocols for network security for managing network security; network security policies in general
    • 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/50Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using hash chains, e.g. blockchains or hash trees

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computing Systems (AREA)
  • Computer Hardware Design (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Theoretical Computer Science (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention relates to the technical field of distributed computing and consensus node selection, and provides a method and a system for selecting a distributed consensus master node based on PBFT algorithm. Comprising the following steps: establishing an index system for evaluating node credit, and collecting node data; establishing a judgment matrix according to the node data, and calculating to obtain comprehensive weight through a analytic hierarchy process and an entropy method; weighting the judgment matrix according to the comprehensive weight, and calculating according to the weighting matrix to obtain a node credit value of each evaluation node; sorting the plurality of evaluation nodes according to the node credit values, presetting a credit critical value, and dividing the plurality of evaluation nodes according to the credit value sorting result and the credit critical value to obtain a three-level credit gradient queue; and selecting nodes from the primary trust queue to obtain a consensus master node. The invention can ensure the safety of the master node, improve the reliability of the selection of the common master node, and strengthen the safety and stability of the system to a certain extent.

Description

PBFT algorithm-based distributed consensus master node selection method and system
Technical Field
The invention relates to the technical field of distributed computing and consensus node selection, in particular to a method and a system for selecting a distributed consensus master node based on PBFT algorithm.
Background
In the field of distributed systems, consensus algorithms are core techniques that ensure that an agreed state is reached between different nodes. The main goal of consensus is to ensure that individual nodes within the system agree on a proposal in the event that there may be node failure or communication delay. Under the background, PBFT consensus algorithm is widely applied in the field of distributed systems as a classical Bayesian fault-tolerant algorithm, and aims to realize excellent high performance and fault tolerance so as to ensure the stable operation of the whole system. However, as the scale of distributed systems continues to expand, the rational choice of consensus master nodes becomes particularly critical. In a distributed system, a consensus master node has important responsibilities, including proposing new transactions or blocks, and then directing other nodes to agree on. This process directly affects the performance, delay and fault tolerance of the system. However, the existing node selection method has some constraint factors and challenges in adapting to dynamic network topology changes, improving system throughput, reducing delay and the like, and needs to be overcome and solved. The classical PBFT algorithm has the following two main disadvantages in practical applications: firstly, the lack of an effective node distinguishing mechanism leads to difficulty in accurately distinguishing abnormal nodes; secondly, the master node is too random to select a rule which lacks definiteness.
The algorithm for solving the problems at present is that the first 10% of nodes with reputation values are selected as consensus nodes to carry out PBFT consensus flow by applying the improved EigenTrust to PBFT consensus algorithm, the rest nodes are taken as slave nodes of PBFT consensus algorithm to receive the result of the consensus nodes, and the result of the consensus nodes is not participated in the flow of the consensus algorithm, so that the time complexity of the consensus algorithm is reduced.
However, when evaluating the node credit value, only two indexes of the number of satisfactory/dissatisfied transactions of the other nodes on the node are simply selected to evaluate the node credit, and the indexes are too few; and the index weight only depends on subjective evaluation, and the objectivity is lacking. I.e. the selection of the scheme index lacks of integrity, scientificity and objectivity.
In addition, when the main node is selected by the traditional PBFT consensus algorithm, all nodes are sequentially selected by the remainder algorithm to serve as the main node in turn, so that the main node is easy to attack in advance, and the technical scheme does not optimize the main node selection, so that the main node is also likely to attack.
Disclosure of Invention
The present invention is directed to solving at least one of the technical problems existing in the related art. Therefore, the invention provides a distributed consensus master node selection method and system based on PBFT algorithm.
The invention provides a distributed consensus master node selection method based on PBFT algorithm, comprising the following steps:
s1: establishing an index system for evaluating node credit, and collecting node data according to the index system;
s2, establishing a judgment matrix according to the node data, and calculating to obtain the comprehensive weight of the judgment matrix through a hierarchical analysis method and an entropy value method;
s3: weighting the judgment matrix according to the comprehensive weight to obtain a weighting matrix, and calculating according to the weighting matrix to obtain a node credit value of each evaluation node;
S4: sorting a plurality of evaluation nodes according to the node credit values based on a good-bad solution distance method to obtain a credit value sorting result;
S5: presetting a credit critical value, dividing a plurality of evaluation nodes according to the credit value sequencing result and the credit critical value to obtain a credit gradient queue, wherein the credit gradient queue comprises a primary trust queue, a secondary candidate queue and a tertiary fault queue;
S6: and selecting nodes from the primary trust queue to obtain a consensus master node.
According to the distributed consensus master node selection method based on the optimization PBFT consensus algorithm provided by the invention, the index system in the step S1 comprises the following steps:
The communication capacity dimension, wherein the refinement index of the communication capacity dimension comprises downtime times, recovery time and communication time;
Basic information dimension, wherein the refinement index of the basic information dimension comprises communication times and network capacity;
and the refinement index of the credit history dimension comprises a valid block number and an invalid block number.
According to the distributed consensus master node selection method based on the optimization PBFT consensus algorithm provided by the invention, the step S2 further comprises the following steps:
S21: and calculating the consistency ratio of the judgment matrix, and reconstructing the judgment matrix of which the consistency ratio does not meet the consistency requirement.
According to the distributed consensus master node selection method based on the optimization PBFT consensus algorithm provided by the invention, the expression of the consistency ratio in the step S21 is as follows:
wherein CR is the consistency ratio obtained by calculation, CI is a consistency index, and RI is an average consistency index.
According to the distributed consensus master node selection method based on the optimization PBFT consensus algorithm provided by the invention, the expression of the comprehensive weight in the step S2 is as follows:
Z=αZ1+(1―α)Z2
Wherein Z is the comprehensive weight obtained by calculation, alpha is a preference factor, Z 1 is a weight vector obtained by calculation by a hierarchical analysis method, and Z 2 is a weight vector obtained by calculation by an entropy value method.
According to the distributed consensus master node selection method based on the optimization PBFT consensus algorithm provided by the invention, the step S3 further comprises the following steps:
S31: carrying out standardization processing on the judgment matrix to obtain a standardization matrix;
s32: weighting the standardized matrix according to the comprehensive weight to obtain a weighting matrix;
s32: defining a global optimal solution and a global worst solution;
s33: calculating to obtain a first difference from each node to the global optimal solution and a second difference from each node to the global worst solution;
S34: and calculating according to the first gap and the second gap to obtain a node credit value of the evaluation node.
According to the distributed consensus master node selection method based on the optimization PBFT consensus algorithm provided by the invention, the expressions of the first gap and the second gap in the step S33 are respectively as follows:
wherein, For the first gap,/>For the second difference, j is the index value of the refinement index number in the index system, n is the total number of refinement indexes in the index system,/>For global optimal solution,/>For the global worst solution, p ij is the node in the weighting matrix.
According to the distributed consensus master node selection method based on the optimization PBFT consensus algorithm provided by the invention, the expression of the node credit value in the step S34 is as follows:
Wherein U i is the node credit value obtained by calculation.
According to the distributed consensus master node selection method based on the optimization PBFT consensus algorithm provided by the invention, the credit gradient queue in the step S5 comprises the following steps:
The system comprises a primary trust queue, wherein the authority of nodes in the primary trust queue comprises master node selection, consensus node selection and synchronous data;
the authority of the nodes in the secondary candidate queue comprises consensus node selection and synchronous data;
and the authority of the nodes in the three-level fault node queue comprises data synchronization.
The invention also provides a distributed consensus master node selection system based on PBFT algorithm, which is used for executing the distributed consensus master node selection method based on PBFT algorithm according to any one of the above, and comprises the following steps:
and a data acquisition module: the method comprises the steps of establishing an index system for evaluating node credit, and collecting node data according to the index system;
And a weight calculation module: the comprehensive weight of the judgment matrix is obtained through calculation by a hierarchical analysis method and an entropy value method; the method is also used for weighting the judgment matrix according to the comprehensive weight to obtain a weighting matrix;
credit calculation module: the node credit value of each evaluation node is obtained through calculation according to the weighting matrix obtained by the weight calculation module;
A credit ordering module: the credit calculation module is used for calculating the credit values of the nodes according to the priority solution distance method;
a queue dividing module: the credit gradient queue is used for presetting a credit critical value, dividing a plurality of evaluation nodes according to the credit value sequencing result and the credit critical value to obtain a credit gradient queue, wherein the credit gradient queue comprises a primary trust queue, a secondary candidate queue and a tertiary fault queue;
The node selection module: and the first-level trust queue is used for selecting nodes from the first-level trust queues divided by the queue dividing module to obtain a common master node.
The invention provides a distributed consensus master node selection method and system based on PBFT algorithm, which aims at providing a distributed consensus master node selection strategy based on an optimization PBFT consensus algorithm, and particularly comprises the steps of firstly constructing a node credit evaluation gradient model, selecting a plurality of evaluation indexes, determining node weights by using an AHP-entropy combination weighting mode, and then carrying out credit sequencing on each node to realize clear distinction of the nodes, and then randomly selecting master nodes from high-confidence nodes so as to ensure the safety of the master nodes to the greatest extent.
The invention classifies the nodes according to the behavior of the nodes, distinguishes the authority of the nodes, and increases punishment to malicious nodes, which enhances the enthusiasm of the nodes to participate in consensus, and when the enthusiasm of the nodes is higher and other conditions are the same, the time delay for the system to reach consensus is lower; and the main node is randomly selected from the high-credit node queue selected from the node credit evaluation gradient model, so that the safety and reliability of the main node are ensured, the probability of occurrence of a view switching protocol is greatly reduced, and compared with PBFT, a certain time delay is reduced.
The invention can improve the performance of the alliance chain PBFT consensus algorithm, improve the reliability of the selection of the consensus master node, and not only is beneficial to improving the consensus performance, but also strengthens the safety and stability of the system to a certain extent by fusing the steps of credit evaluation, weight setting, random selection and the like.
Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention.
Drawings
In order to more clearly illustrate the invention or the technical solutions of the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described, and it is obvious that the drawings in the description below are some embodiments of the invention, and other drawings can be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flowchart of a distributed consensus master node selection method based on PBFT algorithm according to an embodiment of the present invention.
Fig. 2 is a schematic diagram of a distributed consensus master node selection system based on PBFT algorithm according to an embodiment of the present invention.
Reference numerals:
100. A data acquisition module; 200. a weight calculation module; 300. a credit calculation module; 400. a credit ordering module; 500. a queue dividing module; 600. and a node selecting module.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present invention more apparent, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is apparent that the described embodiments are some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention. The following examples are illustrative of the invention but are not intended to limit the scope of the invention.
In the description of the embodiments of the present invention, it should be noted that the terms "center", "longitudinal", "lateral", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", etc. indicate orientations or positional relationships based on the orientations or positional relationships shown in the drawings, are merely for convenience in describing the embodiments of the present invention and simplifying the description, and do not indicate or imply that the apparatus or elements referred to must have a specific orientation, be configured and operated in a specific orientation, and thus should not be construed as limiting the embodiments of the present invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance.
In describing embodiments of the present invention, it should be noted that, unless explicitly stated and limited otherwise, the terms "coupled," "coupled," and "connected" should be construed broadly, and may be either a fixed connection, a removable connection, or an integral connection, for example; can be mechanically or electrically connected; can be directly connected or indirectly connected through an intermediate medium. The specific meaning of the above terms in embodiments of the present invention will be understood in detail by those of ordinary skill in the art.
In embodiments of the invention, unless expressly specified and limited otherwise, a first feature "up" or "down" on a second feature may be that the first and second features are in direct contact, or that the first and second features are in indirect contact via an intervening medium. Moreover, a first feature being "above," "over" and "on" a second feature may be a first feature being directly above or obliquely above the second feature, or simply indicating that the first feature is level higher than the second feature. The first feature being "under", "below" and "beneath" the second feature may be the first feature being directly under or obliquely below the second feature, or simply indicating that the first feature is less level than the second feature.
In the description of the present specification, a description referring to terms "one embodiment," "some embodiments," "examples," "specific examples," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the embodiments of the present invention. In this specification, schematic representations of the above terms are not necessarily directed to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, the different embodiments or examples described in this specification and the features of the different embodiments or examples may be combined and combined by those skilled in the art without contradiction.
In order to better understand the present invention, the following explanation will be given of proper nouns appearing in the present invention.
The PBFT algorithm (PRACTICAL BYZANTINE FAULT TOLERANCE, practical bayer fault-tolerant algorithm) is a consensus algorithm widely applied to the blockchain field, and can reduce the complexity of the original bayer fault-tolerant algorithm from an exponential level to a polynomial level, and the PBFT algorithm is mainly used for ensuring that decisions in a alliance chain system agree, and comprises a plurality of components such as a consensus protocol, a check point protocol, a view switching protocol and the like, wherein the consensus protocol for realizing the consensus among nodes can be regarded as a core protocol of the PBFT algorithm.
AHP (ANALYTIC HIERARCHY Process ): is a subjective weighting method widely used in decision analysis, which provides a structured method to determine the relative importance between multiple targets, thereby helping decision makers make reasonable choices. The method comprises the following steps: ① Problem definition and targeting: first it is necessary to specify the problem and determine the overall objective. This helps to ensure that the direction and focus of the analysis are clear, providing a basis for subsequent hierarchical structure construction; ② And (3) establishing a hierarchical analysis structure: the AHP divides the decision problem into different layers, including a total target, a criterion and a sub-criterion; ③ Judgment matrix creation and consistency test: for each level, the decision maker needs to fill in a judgment matrix to compare and evaluate the relative importance among different elements. ④ Total ordering and consistency check: the relative weights of the elements in different layers can be obtained by calculating the eigenvectors and eigenvalues of the judgment matrix. Consistency checks are again performed to ensure stability and reliability of the analysis results.
Entropy method: in the field of information theory, entropy is used to measure the degree of uncertainty of an object under study. The entropy method is an objective weighting method, quantitative analysis of data is achieved by quantifying uncertainty, and the entropy is proportional to the uncertainty. According to the method, the weight of each index is calculated by examining the amplitude of index variation data, and compared with an AHP method, the weight calculation of an entropy method has objectivity and a mathematical basis. The core idea of entropy method is to introduce the entropy concept in the information theory into decision analysis. The method comprises the following steps: ① Data normalization: firstly, carrying out standardization processing on index data, and unifying the data of different indexes on the same scale so as to carry out comparison and calculation; ② Calculating probability distribution: for each index, calculating the occurrence probability of the state i according to the variation amplitude and the data distribution condition; ③ Calculating an entropy value: and calculating the entropy value of each state by using the probability distribution, thereby measuring the uncertainty of each index. ④ Calculating weights: and calculating the weight of each index according to the entropy value.
TOPSIS method (Technique for Order Preference by Similarity to Ideal Solution, good-bad solution distance method): is an effective method widely adopted in the field of multi-attribute decision analysis, and aims to assist a decision maker in selecting an optimal scheme or decision object. The method mainly comprises the following steps: ① Constructing a comprehensive evaluation matrix: constructing standardized attribute data into a comprehensive evaluation matrix, wherein each row represents a scheme, and each column represents an attribute; ② Calculating an ideal solution and a negative ideal solution: calculating the values of an ideal solution and a negative ideal solution according to the property of each attribute; ③ Calculating similarity: for each scheme, calculating the similarity between the scheme and the ideal solution and the negative ideal solution, wherein common similarity measures comprise Euclidean distance, manhattan distance and the like; ④ Ordering and decision: and according to the calculated similarity value, sequencing each scheme, wherein the scheme with larger similarity is ranked higher.
Embodiments of the present invention are described below in conjunction with fig. 1-2.
The invention provides a distributed consensus master node selection method based on PBFT algorithm, comprising the following steps:
s1: establishing an index system for evaluating node credit, and collecting node data according to the index system;
To ensure the performance and quality of service of nodes in a blockchain system, we need to choose a comprehensive, scientific and reasonable index. In the invention, the credit of the node is divided into three primary indexes, namely communication capacity, basic information and credit history, and the primary indexes are further divided into a plurality of secondary indexes.
Wherein, the index system in the step S1 includes:
The communication capacity dimension, wherein the refinement index of the communication capacity dimension comprises downtime times, recovery time and communication time;
Basic information dimension, wherein the refinement index of the basic information dimension comprises communication times and network capacity;
and the refinement index of the credit history dimension comprises a valid block number and an invalid block number.
The downtime times, the recovery time and the communication time represent the stability of the nodes, the stable nodes are selected to participate in consensus with higher probability, when the node credit value is given, the more stable node credit value is higher, and the downtime times, the recovery time and the communication time can better reflect the stability of the nodes.
Number of communications: the number of communications of a node represents the level of activity and engagement of the node in the network. Higher communication times typically indicate that a node is actively engaged in the network, with frequent information transfer and data exchange with other nodes. The number of communications is also related to the reliability and security of the node. If one node rarely communicates with other nodes or is in isolation, it may be indicated that the node is problematic.
Network capacity: in a blockchain, the network capacity of a node refers to the ability of the node to process and store data. It includes the size of the amount of data that a node can handle and the ability of the node to store transactions, blockchain data, and other related information. The system mainly comprises the contents of CPU quantity, network bandwidth, storage capacity and the like, and the network capacity of the nodes represents the importance and performance level of the nodes in the whole blockchain network. The higher network capacity enables the nodes to better participate in the blockchain consensus process, process transactions faster, ensure quick validation of transactions and generation of blocks.
And for the number of valid outgoing blocks and the number of invalid outgoing blocks: the valid number of blocks refers to the number of legal blocks that the node successfully generates and broadcasts to the network under the consensus mechanism. The number of invalid out blocks refers to the number of invalid blocks that the node attempts to generate but that are rejected or not accepted by the network. These blocks may be considered invalid due to violations of consensus rules, double-flower attacks, timestamp errors, or other non-compliance reasons. An increase in the number of invalid blocks may indicate that the behavior of the node is problematic, either due to intentional malicious behavior or due to software or configuration issues of the node. The more the actual number of blocks generated by a node, the higher its corresponding credit value, and the more invalid blocks generated, the lower its corresponding credit value.
S2, establishing a judgment matrix according to the node data, and calculating to obtain the comprehensive weight of the judgment matrix through a hierarchical analysis method and an entropy value method;
The invention adopts an AHP-entropy combination weighting method to realize balance calculation of index weight, and ensures that the decision process reaches balance between subjective evaluation and objective data analysis. The analytic hierarchy process is used as a subjective weighting method, and takes subjective judgment of a decision maker on index importance into consideration, but the subjective judgment is possibly influenced by subjective factors, so that a certain scientificity deficiency exists. In contrast, the entropy method is used as an objective weighting method, the data is statistically processed to calculate the weight, but the intention of a decision maker is probably not fully considered, so that the AHP and the entropy method are organically combined in the step to comprehensively reference the advantages of the two methods, ensure the comprehensiveness and scientificity of the index weight, simultaneously furthest reduce the interference of subjective factors, and the combined weighting method is helpful for realizing the fusion of the subjective and objective factors, so that the more comprehensive, accurate and reliable weight calculation is realized.
Wherein, step S2 further comprises:
S21: and calculating the consistency ratio of the judgment matrix, and reconstructing the judgment matrix of which the consistency ratio does not meet the consistency requirement.
Wherein the expression of the consistency ratio in step S21 is:
wherein CR is the consistency ratio obtained by calculation, CI is a consistency index, RI is an average consistency index, and the specific value of the average consistency index can be checked by an average consistency index table.
And comparing and recording the indexes of the nodes according to a scale table to obtain a judgment matrix, wherein the matrix is obtained by counting the weight questionnaire data and calculating the average value, then the consistency ratio value is required to be calculated, the condition that the judgment matrix meets the consistency requirement is that the consistency ratio value is smaller than 0.1, and otherwise, the judgment matrix is required to be determined again.
Wherein, the expression of the comprehensive weight in the step S2 is:
Z=αZ1+(1―α)Z2
Wherein Z is the comprehensive weight obtained by calculation, alpha is a preference factor, the value range of the preference factor is [0,1], the value is generally taken to be 0.5, the value can be dynamically adjusted, Z 1 is a weight vector obtained by calculation through a hierarchical analysis method, and Z 2 is a weight vector obtained by calculation through an entropy value method.
S3: weighting the judgment matrix according to the comprehensive weight to obtain a weighting matrix, and calculating according to the weighting matrix to obtain a node credit value of each evaluation node;
The entropy method data are obtained through hardware and software testing and collection, and the flow for solving the objective weight of the system node evaluation index by using the entropy method is as follows:
Firstly, processing original data, and adopting different data preprocessing modes for indexes of positive direction and negative direction; calculating the evaluation index variation value of the node, namely the index of the node occupies the corresponding proportion of the index; calculating the entropy value of the node evaluation index; calculating the information entropy redundancy of the node evaluation index; calculating a weight value of the evaluation index; the comprehensive weight Z calculated by using the AHP-entropy combination weighting method is shown in the above formula.
Wherein, step S3 further comprises:
S31: carrying out standardization processing on the judgment matrix to obtain a standardization matrix;
s32: weighting the standardized matrix according to the comprehensive weight to obtain a weighting matrix;
s32: defining a global optimal solution and a global worst solution;
s33: calculating to obtain a first difference from each node to the global optimal solution and a second difference from each node to the global worst solution;
S34: and calculating according to the first gap and the second gap to obtain a node credit value of the evaluation node.
Wherein, the expressions of the first gap and the second gap in step S33 are respectively:
wherein, For the first gap,/>For the second difference, j is the index value of the refinement index number in the index system, n is the total number of refinement indexes in the index system,/>For global optimal solution,/>For the global worst solution, p ij is the node in the weighting matrix.
Wherein, the expression of the node credit value in step S34 is:
Wherein U i is the node credit value obtained by calculation.
Further, the range of values of the calculated node credit value U i is [0,1], and when U i is closer to 1, it is indicated that it is closer to the optimal solution, and is closer to 0, it is closer to the worst solution.
S4: sorting a plurality of evaluation nodes according to the node credit values based on a good-bad solution distance method to obtain a credit value sorting result;
And after the credit value U i of each node is calculated according to the combined weighted TOPSIS credit sequencing flow and the U i is sequenced from big to small, the system nodes can be classified, namely, the nodes are sequenced by using the TOPSIS method.
The system nodes are divided into three types of nodes, namely a first-stage trust node, a second-stage candidate node and a third-stage fault node according to the credit value, the corresponding nodes are placed in corresponding gradient queues, the credit critical values of the first-stage node and the second-stage node are marked as U 1, the credit critical values of the second-stage node and the third-stage node are marked as U 2, and meanwhile, different authorities are given to the nodes in different credit gradient queues.
S5: presetting a credit critical value, dividing a plurality of evaluation nodes according to the credit value sequencing result and the credit critical value to obtain a credit gradient queue, wherein the credit gradient queue comprises a primary trust queue, a secondary candidate queue and a tertiary fault queue;
wherein, the credit gradient queue in step S5 includes:
The system comprises a primary trust queue, wherein the authority of nodes in the primary trust queue comprises master node selection, consensus node selection and synchronous data;
the authority of the nodes in the secondary candidate queue comprises consensus node selection and synchronous data;
and the authority of the nodes in the three-level fault node queue comprises data synchronization.
In the method, nodes are divided according to the trisection of credit scores, 1/3 of the nodes are firstly used as dividing points to keep the simplicity of the model, in practical application, a trust evaluation gradient model which is too complex is difficult to understand and realize, and the complexity of a system can be reduced by selecting simple dividing points, so that the feasibility of practical application is improved; secondly, for balancing the system, the trust evaluation is divided into three grades, wherein each grade accounts for 1/3 of the whole, so that certain balance among different grades is maintained, and extreme unbalance of the trust evaluation echelon is avoided; the last 1/3 partition point provides a relatively flexible way to adapt to different network topologies and trust evaluation criteria, and this flexibility makes the model more adaptive and able to operate effectively in different environments.
S6: and selecting nodes from the primary trust queue to obtain a consensus master node.
Furthermore, in order to avoid that the master node is known in advance (in the traditional PBFT algorithm, the master node uses a redundancy method to select nodes in turn to serve as the master node), the method uses the random slave-stage trust gradient queue to randomly select the nodes to serve as the master node, so that the reliability of the master node is ensured as much as possible.
In the process of selecting the master node, the method adopts a strategy of randomly selecting the master node from the primary trust node echelon queue so as to remarkably reduce the possibility that the malicious node is selected as the master node, and is worth emphasizing that the damage degree of the master node to the whole system is more serious when the malicious behavior of the master node occurs. Therefore, in the process of selecting the master node, a method for randomly selecting the node from the first-level trust node echelon queue is adopted, and the node with the highest credit value is not directly designated as the master node.
The invention also provides a distributed consensus master node selection system based on PBFT algorithm, which is used for executing the distributed consensus master node selection method based on PBFT algorithm according to any one of the above, and comprises the following steps:
The data acquisition module 100: the method comprises the steps of establishing an index system for evaluating node credit, and collecting node data according to the index system;
Weight calculation module 200: the method comprises the steps of establishing a judgment matrix according to node data acquired by a data acquisition module 100, and calculating to obtain the comprehensive weight of the judgment matrix through a hierarchical analysis method and an entropy value method; the method is also used for weighting the judgment matrix according to the comprehensive weight to obtain a weighting matrix;
credit calculation module 300: the node credit value of each evaluation node is obtained through calculation according to the weighting matrix obtained by the weight calculation module 200;
Credit ordering module 400: the method is used for sorting a plurality of evaluation nodes according to the node credit values obtained by calculation of the credit calculation module 300 based on the better and worse solution distance method to obtain a credit value sorting result;
queue partitioning module 500: the credit gradient queue is used for presetting a credit critical value, dividing a plurality of evaluation nodes according to the credit value sequencing result and the credit critical value to obtain a credit gradient queue, wherein the credit gradient queue comprises a primary trust queue, a secondary candidate queue and a tertiary fault queue;
node selection module 600: and the node is selected from the primary trust queues divided by the queue dividing module 500, so as to obtain a common master node.
The invention provides a distributed consensus master node selection method and system based on PBFT algorithm, which aim to solve some limit problems of PBFT consensus algorithm in a alliance chain, such as lack of node distinguishing mechanism and randomness of master node selection. Specifically, a node credit evaluation gradient model is firstly constructed, which comprises selecting a plurality of evaluation indexes, then determining node weights by using an AHP-entropy combination weighting mode, and then carrying out credit sequencing on each node so as to realize clear distinction of the nodes. After that, the security of the master node is ensured to the greatest extent by randomly picking the master node from the high-credit nodes. The method can improve the performance of the alliance chain PBFT consensus algorithm and the reliability of the selection of the consensus master node. By integrating the steps of credit evaluation, weight setting, random selection and the like, the method is not only beneficial to improving consensus performance, but also strengthens the safety and stability of the system to a certain extent.
The invention aims at optimizing PBFT algorithm, so that PBFT algorithm still has better performance when more nodes exist in the system, and the efficiency is greatly improved.
Firstly, the nodes are classified according to the behavior of the nodes, the authority of the nodes is differentiated, and the punishment to malicious nodes is increased, so that the enthusiasm of the nodes for participating in consensus is enhanced, and when the enthusiasm of the nodes is higher and other conditions are the same, the time delay for the system to reach consensus is lower.
In addition, the algorithm randomly selects the main node from the high-credit node queue selected from the node credit evaluation gradient model, thereby ensuring the safety and reliability of the main node, greatly reducing the probability of occurrence of the view switching protocol, and reducing a certain time delay compared with PBFT.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present invention, and are not limiting; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims (10)

1. A distributed consensus master node selection method based on PBFT algorithm is characterized by comprising the following steps:
s1: establishing an index system for evaluating node credit, and collecting node data according to the index system;
s2, establishing a judgment matrix according to the node data, and calculating to obtain the comprehensive weight of the judgment matrix through a hierarchical analysis method and an entropy value method;
s3: weighting the judgment matrix according to the comprehensive weight to obtain a weighting matrix, and calculating according to the weighting matrix to obtain a node credit value of each evaluation node;
S4: sorting a plurality of evaluation nodes according to the node credit values based on a good-bad solution distance method to obtain a credit value sorting result;
S5: presetting a credit critical value, dividing a plurality of evaluation nodes according to the credit value sequencing result and the credit critical value to obtain a credit gradient queue, wherein the credit gradient queue comprises a primary trust queue, a secondary candidate queue and a tertiary fault queue;
S6: and selecting nodes from the primary trust queue to obtain a consensus master node.
2. The distributed consensus master node selection method based on the optimization PBFT consensus algorithm according to claim 1, wherein the index system in step S1 includes:
The communication capacity dimension, wherein the refinement index of the communication capacity dimension comprises downtime times, recovery time and communication time;
Basic information dimension, wherein the refinement index of the basic information dimension comprises communication times and network capacity;
and the refinement index of the credit history dimension comprises a valid block number and an invalid block number.
3. The method for selecting a distributed consensus master node based on an optimization of PBFT algorithm according to claim 1, wherein step S2 further comprises:
S21: and calculating the consistency ratio of the judgment matrix, and reconstructing the judgment matrix of which the consistency ratio does not meet the consistency requirement.
4. The distributed consensus master node selection method based on PBFT algorithm as claimed in claim 3, wherein the expression of the consistency ratio in step S21 is:
wherein CR is the consistency ratio obtained by calculation, CI is a consistency index, and RI is an average consistency index.
5. The method for selecting a distributed consensus master node based on PBFT algorithm as claimed in claim 1, wherein the expression of the comprehensive weight in step S2 is:
Z=αZ1+(1―α)Z2
Wherein Z is the comprehensive weight obtained by calculation, alpha is a preference factor, Z 1 is a weight vector obtained by calculation by a hierarchical analysis method, and Z 2 is a weight vector obtained by calculation by an entropy value method.
6. The method for selecting a distributed consensus master node based on PBFT algorithm as claimed in claim 1, wherein step S3 further comprises:
S31: carrying out standardization processing on the judgment matrix to obtain a standardization matrix;
s32: weighting the standardized matrix according to the comprehensive weight to obtain a weighting matrix;
s32: defining a global optimal solution and a global worst solution;
s33: calculating to obtain a first difference from each node to the global optimal solution and a second difference from each node to the global worst solution;
S34: and calculating according to the first gap and the second gap to obtain a node credit value of the evaluation node.
7. The method for selecting a distributed consensus master node based on PBFT algorithm as claimed in claim 6, wherein the expressions of the first gap and the second gap in step S33 are:
wherein, For the first gap,/>For the second difference, j is the index value of the refinement index number in the index system, n is the total number of refinement indexes in the index system,/>For global optimal solution,/>For the global worst solution, p ij is the node in the weighting matrix.
8. The method for selecting a distributed consensus master node based on PBFT algorithm as claimed in claim 6, wherein the expression of the node credit in step S34 is:
Wherein U i is the node credit value obtained by calculation.
9. The method for selecting a distributed consensus master node based on PBFT algorithm as claimed in claim 1, wherein the credit gradient queue in step S5 comprises:
The system comprises a primary trust queue, wherein the authority of nodes in the primary trust queue comprises master node selection, consensus node selection and synchronous data;
the authority of the nodes in the secondary candidate queue comprises consensus node selection and synchronous data;
and the authority of the nodes in the three-level fault node queue comprises data synchronization.
10. A distributed consensus master node selection system based on PBFT algorithm for performing the PBFT algorithm-based distributed consensus master node selection method according to any of claims 1 to 9, comprising:
and a data acquisition module: the method comprises the steps of establishing an index system for evaluating node credit, and collecting node data according to the index system;
And a weight calculation module: the comprehensive weight of the judgment matrix is obtained through calculation by a hierarchical analysis method and an entropy value method; the method is also used for weighting the judgment matrix according to the comprehensive weight to obtain a weighting matrix;
credit calculation module: the node credit value of each evaluation node is obtained through calculation according to the weighting matrix obtained by the weight calculation module;
A credit ordering module: the credit calculation module is used for calculating the credit values of the nodes according to the priority solution distance method;
a queue dividing module: the credit gradient queue is used for presetting a credit critical value, dividing a plurality of evaluation nodes according to the credit value sequencing result and the credit critical value to obtain a credit gradient queue, wherein the credit gradient queue comprises a primary trust queue, a secondary candidate queue and a tertiary fault queue;
The node selection module: and the first-level trust queue is used for selecting nodes from the first-level trust queues divided by the queue dividing module to obtain a common master node.
CN202311721739.7A 2023-12-14 2023-12-14 PBFT algorithm-based distributed consensus master node selection method and system Pending CN117914859A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311721739.7A CN117914859A (en) 2023-12-14 2023-12-14 PBFT algorithm-based distributed consensus master node selection method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311721739.7A CN117914859A (en) 2023-12-14 2023-12-14 PBFT algorithm-based distributed consensus master node selection method and system

Publications (1)

Publication Number Publication Date
CN117914859A true CN117914859A (en) 2024-04-19

Family

ID=90688110

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311721739.7A Pending CN117914859A (en) 2023-12-14 2023-12-14 PBFT algorithm-based distributed consensus master node selection method and system

Country Status (1)

Country Link
CN (1) CN117914859A (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021032138A1 (en) * 2019-08-20 2021-02-25 深圳前海微众银行股份有限公司 Consensus method and device based on blockchain system, and system
US20210109825A1 (en) * 2018-08-31 2021-04-15 Advanced New Technologies Co., Ltd. Transaction consensus processing method and apparatus for blockchain and electronic device
CN114938292A (en) * 2022-04-26 2022-08-23 重庆邮电大学 Node reliability-based multi-level optimization PBFT consensus method
US20220321575A1 (en) * 2019-08-01 2022-10-06 Bloom Technology, Inc. Dag-awtc ledger system using bft verification consensus mechanism
CN115168870A (en) * 2022-07-29 2022-10-11 江苏大学 Block chain safety assessment method based on comprehensive evaluation
CN116151826A (en) * 2023-04-04 2023-05-23 广东电力交易中心有限责任公司 Efficient and reliable block chain-based power transaction terminal trust management method
CN116432213A (en) * 2022-09-07 2023-07-14 北京工商大学 Grain supply chain data privacy protection method based on multi-chain block chain

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20210109825A1 (en) * 2018-08-31 2021-04-15 Advanced New Technologies Co., Ltd. Transaction consensus processing method and apparatus for blockchain and electronic device
US20220321575A1 (en) * 2019-08-01 2022-10-06 Bloom Technology, Inc. Dag-awtc ledger system using bft verification consensus mechanism
WO2021032138A1 (en) * 2019-08-20 2021-02-25 深圳前海微众银行股份有限公司 Consensus method and device based on blockchain system, and system
CN114938292A (en) * 2022-04-26 2022-08-23 重庆邮电大学 Node reliability-based multi-level optimization PBFT consensus method
CN115168870A (en) * 2022-07-29 2022-10-11 江苏大学 Block chain safety assessment method based on comprehensive evaluation
CN116432213A (en) * 2022-09-07 2023-07-14 北京工商大学 Grain supply chain data privacy protection method based on multi-chain block chain
CN116151826A (en) * 2023-04-04 2023-05-23 广东电力交易中心有限责任公司 Efficient and reliable block chain-based power transaction terminal trust management method

Similar Documents

Publication Publication Date Title
CN108900380B (en) Node management method and implementation system thereof
CN113645190A (en) Byzantine fault-tolerant consensus method considering node reputation and block chain
Tang et al. Failure mode and effect analysis considering the fairness-oriented consensus of a large group with core-periphery structure
Zhou et al. Statistics-based approach for large-scale group decision-making under incomplete Pythagorean fuzzy information with risk attitude
Zhou et al. Weight assignment method for multiple attribute decision making with dissimilarity and conflict of belief distributions
CN110428191B (en) Method for identifying fragile nodes of power distribution network
CN109151953A (en) A kind of network insertion selection calculation method based on user and network bilateral income
CN113422661B (en) Credible broadband spectrum sensing method based on active and passive credibility division
CN111882198A (en) Project performance evaluation method and system
CN109548029A (en) A kind of two-stage method for trust evaluation of nodes of Wireless Sensor Networks
Sun et al. A probabilistic uncertain linguistic FMEA model based on the extended ORESTE and regret theory
CN111598457B (en) Method and device for determining quality of power wireless network
CN115022022A (en) Method for improving Raft consensus mechanism based on node past behavior analysis
CN102394904B (en) Terminal polymerization system and method in heterogeneous ubiquitous network environment
CN114065220B (en) Dual-level analysis situation assessment method based on distributed system
CN117914859A (en) PBFT algorithm-based distributed consensus master node selection method and system
CN114091791A (en) Improved DEA-based AHP logistics performance evaluation method
Zhou et al. A statistical approach to large-scale group decision making with incomplete hesitant fuzzy linguistic information by incorporating risk attitude
CN108459991A (en) A method of obtaining equipment dependability data
CN115860526A (en) Comprehensive performance evaluation method of communication network based on comprehensive fuzzy evaluation
CN115981778A (en) Method and system for determining early warning model for monitoring container cluster
CN115689191A (en) Intelligent power grid security evaluation method for index system screening optimization
Lu et al. Evaluation of black-start schemes based on prospect theory and improved TOPSIS method
CN114913033A (en) Power grid diversity data hierarchical storage balancing and transaction safety method and system
CN118467523B (en) Measurement data quality evaluation method and system for power distribution network measurement device

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