Study of blockchain's consensus mechanism based on score

IET BlockchainVolume 1, Issue 1 p. 41-55 ORIGINAL RESEARCH PAPEROpen Access Study of blockchain's consensus mechanism based on score An improved consensus mechanism Shaobin Cai, Computer Science and Technology, Huaqiao University, Xiamen, 361021 ChinaSearch for more papers by this authorTangxuan Han, Corresponding Author 18014083006@stu.hqu.edu.cn orcid.org/0000-0001-9259-4843 Computer Science and Technology, Huaqiao University, Xiamen, 361021 China Correspondence Tangxuan Han, College of Computer Science and Technology, Huaqiao University, Xiamen 361021, Xiamen, Fujian Province, China. Email: 18014083006@stu.hqu.edu.cnSearch for more papers by this authorYuhao Wang, Computer Science and Technology, Huaqiao University, Xiamen, 361021 ChinaSearch for more papers by this authorHu Zhang, Computer Science and Technology, Huaqiao University, Xiamen, 361021 ChinaSearch for more papers by this author Shaobin Cai, Computer Science and Technology, Huaqiao University, Xiamen, 361021 ChinaSearch for more papers by this authorTangxuan Han, Corresponding Author 18014083006@stu.hqu.edu.cn orcid.org/0000-0001-9259-4843 Computer Science and Technology, Huaqiao University, Xiamen, 361021 China Correspondence Tangxuan Han, College of Computer Science and Technology, Huaqiao University, Xiamen 361021, Xiamen, Fujian Province, China. Email: 18014083006@stu.hqu.edu.cnSearch for more papers by this authorYuhao Wang, Computer Science and Technology, Huaqiao University, Xiamen, 361021 ChinaSearch for more papers by this authorHu Zhang, Computer Science and Technology, Huaqiao University, Xiamen, 361021 ChinaSearch for more papers by this author First published: 10 May 2021 https://doi.org/10.1049/blc2.12006AboutSectionsPDF ToolsRequest permissionExport citationAdd to favoritesTrack citation ShareShare Give accessShare full text accessShare full-text accessPlease review our Terms and Conditions of Use and check box below to share full-text version of article.I have read and accept the Wiley Online Library Terms and Conditions of UseShareable LinkUse the link below to share a full-text version of this article with your friends and colleagues. Learn more.Copy URL Share a linkShare onEmailFacebookTwitterLinked InRedditWechat Abstract The consensus mechanism is a key technology to achieve state consistency among distributed nodes and it determines the consensus efficiency and stability of the blockchain system. If the consensus efficiency and stability are improved, that can promote the development of the entire society. Therefore, it is necessary to improve the consensus efficiency and stability of the blockchain system. However, there are many disadvantages in the existing consensus mechanism, such as high communication complexity, low throughput, and poor scalability. For solving these disadvantages, a blockchain consensus mechanism Score-Based Byzantine Fault Tolerance (SBBFT) is proposed. First, the score of nodes are obtained by Analytical Hierarchy Process (AHP) and SBBFT uses the score of the node to choose a node to be the primary node and acknowledgment node. Second, SBBFT selects c acknowledgment nodes to be an acknowledgment node subset. This subset can change the communication of nodes from all-to-all to all-to-c. Moreover, the view change of acknowledgment node subset can make the system resistant to attacks from more malicious nodes. According to the experiment, 900,000 transactions from Ethereum, the result demonstrates SBBFT can significantly reduce the communication complexity, improve the consensus efficiency and stability of the system. 1 INTRODUCTION Bitcoin was first proposed by Nakamoto [1] in 2008, and then the digital currency entered a new stage. The underlying blockchain technology of digital currency heralds the dawn of a new digital era [2]. The release of Facebook's Libra [3] project white paper led to the skyrocketing of Bitcoin prices, which attracted the attention of many blockchain investors and researchers at home and abroad [4]. To seize the opportunity of a new round of information revolution and promote industrial innovation and development, governments of various countries attached great importance to blockchain technology [5] and introduced policies and financial support. Blockchain technology is a technology in which all the nodes reach an agreement on public ledgers through a certain consensus mechanism in a distributed and untrusted environment [6]. Blockchain can be applied to many fields, such as the Internet of Things [7], healthcare [8], finance [9], supply chain [10], education [11]. As the core of blockchain technology, the consensus mechanism [12] fundamentally determines the security, availability, and system performance of the entire blockchain system. Research on the consensus mechanism of the blockchain is of great significance to the expansion of blockchain, faster transaction processing speed, and improvement of security. It is necessary to study the consensus mechanism for blockchain technology to be more widely used in the future. The consensus can be divided into traditional consensus and blockchain consensus [13]. Paxos [14], Practical Byzantine Fault Tolerance (PBFT) [15], and Scalable Byzantine Fault Tolerance (SBFT) [16, are traditional consensus, but they both have disadvantages. Paxos can only be fault tolerant to crashed nodes, not to malicious nodes, so Paxos is not suitable for complicated network system in real life. The communication of nodes in PBFT is all-to-all [16]. So PBFT generates high traffic overhead due to frequent network communications (O(n2)) among n nodes and just can work well only in a small fixed-size network [17]. SBFT has the collector to distribute messages to nodes, however, the collector must be a good node (SBFT does not consider the situation that the collector is a malicious node). SBFT has high requirements for a good network and is not suitable for complex networks. The blockchain consensus can be divided into permissioned consensus and permissionless consensus. In permissioned blockchain consensus, all the node identities are known (trusted or semi-trusted) and are controlled by a single entity or federation. Permissionless blockchain consensus is fully decentralized and anyone can run a node and join the network [18]. Hyperledger [19] is permissioned consensus and is just suitable for networks that have not or have fewer malicious nodes. Proof of work (PoW) [20], proof of stake (PoS) [21], delegated proof of stake (DPOS) [22], ByzCoin [23], Algorand [24], and ELASTICO [25] are permissionless consensus. But these consensuses still have many shortcomings. PoW consumes a lot of resources [13]. PoS reduces some resource consumption and has good scalability, but it is prone to the risk of bifurcation in high-latency networks [13]. The selection of committee in ByzCoin, Algorand, and ELASTICA is simple and does not consider the conditions of nodes (e.g. Network speed, Network bandwidth, Capability of Computation). If we take these conditions into account, the consensus efficiency of the system will be better. According to the content mentioned above, we can know that the problems with the existing consensus algorithms are: (1) it wastes resources; (2) it has a high communication complexity; (3) it is not suitable for complicated networks; (4) it does not make full use of the network and the algorithm of node selecting is too simple; (5) it just works well in a system that has fewer nodes. For solving these problems, we proposed a blockchain consensus based on score, which scores to each node by Analytical Hierarchy Process (AHP) and changes the communication complexity of nodes from all-to-all to all-to-c (c is a small constant) on the basis of PBFT and SBFT. We call this blockchain consensus Score-Based Byzantine Fault Tolerance (SBBFT). SBBFT does not waste resources and has a lower communication complexity. SBBFT takes the conditions of nodes (e.g. network, attributes, transactions) as criteria of scores. In this way, SBBFT can work well in a complex network that is in line with real life and works well in a network that has more nodes. SBBFT mainly applies to permissionless networks that have malicious nodes. According to experiment results, SBBFT can work well in a network that has more than 500 nodes and 60 malicious nodes. By contrast, PBFT and SBFT just work well in a network that has more than 50 nodes [26] and 200 nodes [16], respectively. SBBFT can run in the distributed system that has hundreds of nodes and its consensus efficiency is better than PBFT and SBFT. More important, SBBFT with the help of the sharding [27] technique can work well in the public blockchain that has countless nodes. The main contributions of this article are summarized as follows: SBBFT uses AHP to score nodes based on the conditions of nodes. Each node has a score that can be criteria to select the primary node and acknowledgment node. In this way, we can ensure that the nodes we select are good nodes and has a fast network. The number of times the malicious node be a primary node or acknowledgment node drops. SBBFT builds an acknowledgment node subset according to the score of nodes. The function of the acknowledgment node subset is ordering and verifying messages and distributing messages to nodes. Acknowledgment node subset changes the communication complexity from all-to-all to all-to-c (c is a small constant). So messages are executed in a shorter time and the consensus efficiency of systems improves. SBBFT proposes the view change of primary node and acknowledgment node subset, which makes this consensus can work well in networks with many malicious nodes. With the help of contributions mentioned above, the blockchain consensus we proposed can improve consensus efficiency, stability, and throughput of systems, and works well in networks with many nodes. The rest of this article is structured as follows. Section 2 introduces the AHP method. Section 3 describes the process of scoring to nodes using AHP. Section 4 describes the specific process of SBBFT. Section 5 describes the experiment and performance analysis of SBBFT. 2 ANALYTICAL HIERARCHY PROCESS METHOD The AHP approach, developed by Satty (1980), is one of the multiple-criteria decision-making (MCDM) methods used widely. The AHP has been applied to a wide variety of decisions and the human judgment process [28]. AHP is a decision-aided method which decomposes a complex multi-factor problem into a hierarchy, in which each level is composed of specific elements [29]. The approach is used to construct an evaluation model and has criterion weights, so the AHP approach agrees well with the behaviour of a decision-maker [30]. It combines different measures into a single score to rank decision choices. It is often used to simplify multiply standard problems by decomposing them into multilevel hierarchies. The steps to apply the AHP method are as follows. 2.1 Building the hierarchical construction model When we apply AHP to analyse decision-making problems, the problem must be organized and hierarchized to construct a hierarchical structural model. This hierarchical structural model can be divided into three levels: the first level represents the goal, the second level represents the criteria (e.g. factors), and the third level represents the sub-criteria (e.g. attributes). 2.2 Developing all judgment matrices in each level According to the importance of elements in each level to elements at higher levels, compare them in pairs. Starting from the top of the hierarchy and working down, the pairwise comparison of a given level can be simplified to a series of square matrices A = [ a i j ] n × n , as shown below: A = a 11 a 12 … a 1 n a 21 a 22 … a 2 n . . … . a n 1 a n 2 … a n n . The matrix has reciprocal properties, which are a i j = 1 a j i . In AHP, Satty recommended a relative importance scale from 1 to 9 for subjective pairwise comparison (see Table 1). TABLE 1. 9-Point intensity of relative importance scale Intensity of relative importance Definition Explanation 1 3 5 7 9 2, 4, 6, 8 Reciprocals of the above non-zero numbers Equal importance Moderate importance of one over another magnetic field strength Essential or strong importance Extreme importance Intermediate values between the two adjacent judgments Reciprocal for inverse comparison Two activities contribute equally to objective 1. Experience and judgment slightly favour one activity over another. Experience and judgment strongly favour one activity over another. An activity is strongly favoured, and its dominance is demonstrated in practice. The evidence favouring one activity over another is of the highest possible order of affirmation. When a compromise is needed. Source: Adapted from Satty and Kearns (1985). 2.3 Calculating the weights and checking consistency in each hierarchical level 2.3.1 Calculating the weights After all pairwise judgment matrices are formed, the weight vector, w = [ w 1 , w 2 , · · · , w n ] , calculated according to Satty's method based on the arithmetic mean. The weight calculation involves two steps. First, the pairwise judgment matrix, A = [ a i j ] n × n , is normalized by (1), and then the weight is calculated by (2). a i j ∗ = a i j ∑ i = 1 n a i j , j = 1 , 2 , … , n , (1) w i = ∑ j = 1 n a i j ∗ n , i = 1 , 2 , … , n . (2) 2.3.2 Calculating the consistency index We can get the consistency index (CI) [31] by (3), where Zmax is the maximum eigenvalue of the judgment matrix A and n is the order of matrix A. C I = λ m a x − n n − 1 . (3) 2.3.3 Finding the random index Random index (RI) [31] is the random consistency index obtained from a randomly generated pairwise judgment matrix A. Table 2 shows the value of the RI from matrices of order 1 to 10 as suggested by Satty (1980). TABLE 2. Random inconsistency indices (RI) for N = 10 N 1 2 3 4 5 6 7 8 9 10 RI 0.0 0.0 0.58 0.9 1.12 1.24 1.32 1.41 1.46 1.49 TABLE 3. The optimal attribute weights w C 1 w C 2 w C 3 w C 4 w C 5 w C 6 w C 7 w C 8 w C 9 W p r i m a r y 0.082 0.180 0.020 0.414 0.132 0.067 0.031 0.056 0.019 W a c k 0.101 0.202 0.028 0.380 0.075 0.112 0.026 0.019 0.056 2.3.4 Calculating the consistency ratio Consistency ration (CR) CR can be calculated using (4): CR = CI RI . (4) When CR < 0.10, we think the consistency of the judgment matrix is acceptable, otherwise the judgment matrix should be modified appropriately. 2.4 Calculating the total weights of hierarchical construction model According to the hierarchical construction model, the first level is the goal that just has one element A, the second level is criteria that has n elements, B1, B2, ···, Bn, and the third level is sub-criteria that has p elements, C1, C2, ···, Cp. The weight of Ci is w C i ( i = 1 , 2 , · · · , p ) and the weight of the upper level of Ci is w B j ( j = 1 , 2 , · · · , n ) . The total weight of w C i can be calculated by (5). There is a relationship between w C i and w B j in (6). W C i = w C i × w B j , (5) ∑ i = 1 p w C i × w B j = 1 . (6) 3 SCORING TO NODES USING AHP We score to nodes using AHP in this section and select the primary node and acknowledgment nodes according to the score in Section 4. The steps of scoring to nodes using AHP are as follows. 3.1 Building the hierarchical construction model of scoring to nodes As described in Figure 1, the hierarchical construction model is divided into three levels. The first level is Goal, the second is Factors, and the third is Attributes. The elements of Attributes level, Network speed (C1), Number of failed messages (C2), Network bandwidth (C3), Number of error messages (C4), Number of being primary node (C5), Number of being acknowledgment node (C6), Capability of compute (C7), Number of transactions sent (C8), and Number of transactions finished (C9), are important factors that influence the score to nodes. These important factors are described in Figure 2. FIGURE 1Open in figure viewer The hierarchical construction model of scoring to nodes FIGURE 2Open in figure viewer The score criteria of node 3.2 Developing all judgment matrices and finding the optimal attribute weights According to the method described in Section 2.2, we can get the judgment matrices at each hierarchical level. The judgment matrices of scoring to the primary node is different from the judgment matrices of scoring to the acknowledgment node. The subscript of judgment matrices of the primary node is primary. The subscript of judgment matrices of the acknowledgment node is ack. For example, the judgment matrices of first level A are A p r i m a r y and A a c k . They are as follows: A p r i m a r y = x 11 x 12 x 13 1 x 12 x 22 x 23 1 x 13 1 x 23 x 33 A a c k = y 11 y 12 y 13 1 y 12 y 22 y 23 1 y 13 1 y 23 y 33 . We can know that there are three variables x12, x13, and x23 in Aprimary and the range of them is 1 to 9. The values of x11, x22, and x33 both are 1. The number of different Aprimary is the third power of 9. We can get all different judgment matrices Aprimary through a for loop. In the same way, we can get all different judgment matrices of Aack, B1primary, B1ack, B2primary, B2ack, B3primary, and B3ack. In all cases, we can find the optimal attribute weights sequence by comparing the throughput. The process of the algorithm is as follows: Algorithm 1: get optimal attribute weights sequence Input: X Output: Y 1 For xi ∈ X 2 Let xi change from 1 to 9; 3 Get all judgment matrices; 4 If CR < 0.1 5 Calculating the attribute weights; 6 Calculating the attribute total weights; 7 Finding final judgment matrices that have the maximum throughput; 8 Output: Y In Algorithm 1, X is a matrix containing all variables of judgment matrices, Y is a matrix containing the optimal attribute weights sequence. First, getting all judgment matrices by change all variables of X from 1 to 9. Second, if the consistency ratio (CR) is less than 0.1, the attribute weight and attribute total weight are calculated. Finally, finding the final judgment matrices with the largest throughput and outputting the optimal attribute weights sequence. In this way, this test may take some time, but we can get the optimal attribute weights. Through long-time experiments, we have obtained the optimal attribute weights. They are as shown by Table 3. 3.3 Calculating the score of nodes For getting the score of nodes, we should build the score criteria as Figure 2 described. According to the criteria of node, we can get the final score (scorei) of node i and scorei can be calculated by (7). s c o r e i = ∑ j = 1 N = 9 s c o r e i C j × W C j . (7) In (7), s c o r e i C j is the score that node i gets in element Cj, and W C j is the weight that element Cj gets in node i. 4 THE SPECIFIC PROCESS OF SBBFT SBBFT is a blockchain consensus on the basis of PBFT and SBFT, which improves consensus efficiency and throughput in systems by scoring to nodes and selecting to acknowledgment node subset. The acknowledgment node subset is a set of c acknowledgment nodes. SBBFT consists of consistency protocol, view change of the primary node protocol, view change of the acknowledgment node subset protocol, and checkpoint protocol. The specific process of SBBFT is as shown in Figure 3. FIGURE 3Open in figure viewer The specific process of SBBFT 4.1 System initialization 4.1.1 Key initialization The key initialization process uses the Boneh–Lynn–Shacham (BLS) threshold signature algorithm, which is based on the identity-based encryption proposed by Boneh and Franklin [32]. The BLS [33] signature algorithm is based on a bilinear mapping structure that can realize signature aggregation and key aggregation. It can merge all signatures and public keys in a transaction into a single signature and public key, and the merge process is invisible. There are n nodes in the system, which are numbered N 1 , N 2 , … , N n . The master secret key (MSK), the master public key (MPK) for the system, and the corresponding public key and private key for each node are generated through the BLS threshold signature algorithm. The private key of node N i ( 1 ≤ i ≤ n ) is s i , and the public key is p i . Each node stores the MPK and the public keys of other nodes. 4.1.2 Node selection initialization The nodes of this system are divided into a primary node, many backup nodes, and c ( c is a small constant) acknowledgment nodes. The node selection consists of primary node selection and acknowledgment node subset selection. When the system runs for the first time, the system selects the primary node and c acknowledgment nodes (acknowledgment node subset) through a verifiable random function. 4.2 Node selection based on score After the system completed the node selection initialization operation, the node selection finishes by ordering the score of nodes. 4.2.1 Primary node selection When the view change of the primary node occurs, the acknowledgment node subset calculates the score of each node by (7), then sorts the score from largest to smallest. The acknowledgment node subset runs the verifiable random function in five nodes that have the largest score and get a final node that is the primary node. 4.2.2 Acknowledgment node subset selection When the view change of acknowledgment node subset occurs, the primary node calculates the score of each node by (7), then sorts the score from largest to smallest. The primary node runs the verifiable random function in 2c nodes that have the largest score and get c final nodes that are the acknowledgment nodes (acknowledgment node subset). 4.3 Consistency protocol of SBBFT The corruption model of SBBFT is n = 3f + 1. In SBBFT, there is only one primary node, m backup nodes, and c acknowledgment nodes (acknowledgment node subset), which satisfy 1 + m + c = n = 3f + 1. SBBFT is mainly divided into four stages: request, prepare, submit, and reply. The consistency protocol process of SBBFT is shown in Figure 4. As shown, in the whole process, SBBFT changes the communication complexity from all-to-all to all-to-c. The communication complexity of PBFT is all-to-all, so the consensus efficiency and throughput of SBBFT is higher than that of PBFT, and SBBFT can work well in networks that have nodes more than PBFT FIGURE 4Open in figure viewer The specific process of consistency protocol 4.3.1 Request The client collects numerous messages and then packs them into a request in the form of a Merkle tree. Thus, other nodes can directly verify the root of the Merkle tree to verify all messages. The client sends the request to the primary node. 4.3.2 Prepare The primary node numbers, hashes, and signs the request with its own private key and finally sends the preparation message < prepare, v, n, p, d(m), ap(d(m)),m > to other nodes, where v is the view serial number, n is the request serial number, p is the primary node serial number, d(m) is the digest information of the request, ap(d(m)) is the signature information of the primary node, and m is the request information. 4.3.3 Submit The backup node and the acknowledgment node do the following checks after receiving the prepare message: Check whether the digest of request m and the signature of the master node are correct. Check whether the view v in request m is the same as the current view. Check whether this node did not receive other requests with sequence number n under view v. Check whether the received request n is within the current acceptance window ( h , H ) . If the above checks are successful, then the submit message ⟨ s u b m i t , v , n , p , σ i ( m ) , i ⟩ is sent to the acknowledgment node subset. Here, σ i ( m ) is the threshold signature of node i to request message m. The acknowledgment node subset has a buffer to store the request messages of the same request sequence number sent by different nodes. The buffer is N 1 , N 2 , N 3 , … , N k , k is an infinite number, and N k = { N k i , 1 ≤ i ≤ n } . On receiving 2 f + 1 submit messages with the same request sequence number, the acknowledgment node subset collects all the signature information ( σ i ( m ) | 1 ≤ i ≤ n ) and then combines these 2 f + 1 signature information to generate a complete signature σ ( m ) . Finally, the acknowledgment node subset sends a reply message ⟨ r e p l y , v , n , σ ( m ) ⟩ to all the other nodes, in which v is the view serial number and n is the request serial number. 4.3.4 Reply All the nodes will use the MPK to verify σ ( m ) only when they received at least 2 3 c identical reply messages. If the verification is successful, then this message is written to the local log, and the request status with the request sequence number N is set to SUCCESS. The verification is performed to prevent malicious nodes in the acknowledgment node subset only when at least 2 3 c identical reply messages are received, thereby reducing the view change of acknowledgment node subset and improving the stability of the system. 4.4 View change of the primary node protocol of SBBFT The purpose of the view change of the primary node is to switch in time when the primary node has an error to ensure the safety and activity of the consensus system. When there is a problem with the primary node, the timer of the backup node i times out in the current view v. Then, the backup node i triggers the operation of the view change of the primary node and switches the view to v + 1 . The entire view change of primary node mainly includes request, assign, convert, and affirm as shown in Figure 5 The specific process is as follows: FIGURE 5Open in figure viewer The specific process of view change of primary node protocol 4.4.1 Request The backup node sends the request message of view change of acknowledgment node subset to the primary node when the timer in the backup node expires. The request message format sent by the backup node is ⟨ a c k − n o d e − s u b s e t − v i e w − c h a n g e − r e q u e s t , v + 1 , i , σ i ( r ) ⟩ , where i is the sequence number of the backup node, and σ i ( r ) is the threshold signature of backup node i for this message. 4.4.2 Assign After the acknowledgment node subset received at least f + 1 messages requesting the view change of the primary node, it combines the threshold signatures of these f + 1 nodes into a complete signature σ ( p ) . The acknowledgment node subset selects node p as the primary node through primary node selection described in Section 4.2.1. Finally, the acknowledgment node subset sends the assign message to the backup node. The format of assign message is ⟨ p r i m a r y − n o d e − v i e w − a s s i g n , v + 1 , p , σ ( p ) ⟩ , where p is the serial number of the latest primary node. 4.4.3 Convert The backup node uses the MPK to verify σ ( p ) only when it receives at least 2 3 c identical assign messages. If the verification is successful, then the serial number of the primary node is changed to p and the converted message that the verification is successful is sent to the acknowledgment node subset. 4.4.4 Affirm When the acknowledgment node subset receives 2 f successfully verified convert messages, it indicates that the backup nodes have received the sent assign message and successfully changed the primary node sequence number to p. 4.5 View change of the acknowledgment node subset protocol of SBBFT The purpose of the view change of acknowledgment node subset is to switch in time when it has an error. When the backup node does not receive 2 3 c messages sent by the acknowledgment nodes within the specified time T, it triggers the operation of the view change of the acknowledgment node subset. SBFT has no the view change of the collector, so the collector must be a good node. SBFT just is suitable for working in a network that has not many malicious nodes, but SBBFT can work well in networks that have many malicious nodes because of the view change of acknowledgment node subset and mechanism of scoring to nodes. View change of acknowledgment node subset mainly includes request, assign, convert, affirm, re-affirm, and re-start as shown in Figure 6. The specific process is as follows: FIGURE 6Open in figure viewer The specific process of view change of acknowledgment node subset protocol 4.5.1 Request When the timer in the backup node expires, the backup node sends the request message of view change of the primary node to the acknowledgment node subset. The request message format of view change of the primary node is ⟨ p r i m a r y − n o d e − v i e w − c h a n g e − r e q u e s t , v + 1 , i , σ i ( p ) ⟩ , where i is the sequence number of the backup node, and σ i ( p ) is the threshold signature of the backup node i for this message. 4.5.2 Assign After the primary node received at least f + 1 request messages, it combines the threshold signatures of these f + 1 nodes into a complete signa