[0028] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative work shall fall within the protection scope of the present invention.
[0029] See attached image 3 According to an embodiment of the present invention, an improved PBFT consensus method based on ISM is provided. The ISM algorithm is run in a blockchain environment, and nodes are layered through transaction relationships between blockchain nodes. Stratification specifically includes the following steps:
[0030] S1: Establish an m*m adjacency matrix A between nodes through transaction relationships, where m is the number of nodes in the blockchain system.
[0031] Adjacency matrix element a ij. among them,
[0032]
[0033] "1" means there is a transaction between the two nodes, where the transaction input points to the transaction output, and "0" means there is no transaction between the two nodes.
[0034] S2: Get (A+I) by adding the adjacency matrix to the identity matrix, and perform the power product operation with Boolean operation logic until (A+I) n =(A+I) n+1 , N is the number of power product calculations. That is, when the power product is iteratively calculated, the result does not change, and the reachable matrix M is obtained.
[0035] S3: In order to decompose the reachability matrix M, calculate the reachability set L and the antecedent set F of each node in the system, as well as the common set (L∩F) of the two, from the above reachability set L and the antecedent set The three sets of F and the common set (L∩F) are used to layer the consensus nodes of the blockchain. If the set corresponding to a node n satisfies (L∩F)=L, then node n is at the top level. After removing node n, continue to select the next-level top node based on the rule that the set satisfies (L∩F)=L, and so on Layer: If the set corresponding to a node n satisfies (L∩F)=F, then node n is at the bottom.
[0036] S4: If the reachability set L, the antecedent set F and the common set (L∩F) corresponding to some nodes correspond to the same, then these nodes have a strong connection relationship, and one node can be selected as a representative to stay in the matrix for subsequent operations , Other nodes eliminate the matrix to achieve matrix reduction. Remove the strongly correlated nodes from the reachable matrix M to obtain the reduced matrix M1. The matrix M is obtained by subtracting the identity matrix I from the matrix M1 2 , By the matrix M 2 The logical relationship of reaction constructs a directed connection graph of blockchain nodes, and realizes the layering of blockchain consensus nodes with transaction logic relationships.
[0037] As an implementation, see figure 1 , In order to achieve node layering and better serve the blockchain consensus mechanism, define layered nodes and establish a layered system of blockchain nodes from bottom to top. In the layering of blockchain consensus nodes, the status of participating nodes in the entire blockchain transaction relationship declines as the level of the hierarchical system rises, because the underlying nodes occupy a major position in the transaction relationship between blockchain nodes. Therefore, the bottom node is the consensus center node (K 1 , K 2.....K i, i is the number of consensus center nodes). In the same way, the second-level node is the consensus first-level node (A 1 , A 2.......A j, j is the number of consensus first-level nodes). As a result, the blockchain consensus node establishes a hierarchical system based on the important position of the node in the transaction relationship.
[0038] As an implementation mode, to better serve the hierarchical and block consensus for ISM, and improve the ISM model. The layering of blockchain consensus nodes is the basis for achieving block consensus. Therefore, after the block chain consensus node realizes the layering according to the important position in the transaction relationship, the node block step is supplemented. In the hierarchical nodes of the blockchain, the bottom-layer nodes are explored layer by layer. If there is a fork, the node and the node after the fork are divided into a consensus node sub-cluster. In this way, the block chain consensus node is divided into blocks, thereby constructing multiple multi-center node clusters participating in the block chain consensus.
[0039] So far, the ISM model has realized the layered block function of the blockchain consensus node. The following will be the operation process of the PBFT consensus mechanism to achieve consensus on the basis of layered block. See attached figure 2.
[0040] As one of the implementation manners, the multi-center sub-node cluster performs consensus in blocks on a hierarchical basis.
[0041] In the pre-preparation phase, node A i Upper node B i To A i Make a request, node A i Write several requests into the block and give it to A i Upper node B i Broadcast pre-prepare message, the format of the message is <
,m> (v is the view number, m is the requested message, and d is the summary of the requested message).[0042] In the preparation phase, the upper node B i Receive node A i Pre-prepare message and send a prepare message to B i Other node B in the sub-node cluster j To verify the signature information, summary information, and request number. The message format is If it is illegal data, the child node cluster discards the information and does not participate in the consensus. If the message is correct, the upper node B i To the first-level consensus node A i Send a prepare message in the format.
[0043] In the submission phase, the first-level consensus node A i And upper consensus node B i After receiving the prepare message, the two-tier consensus nodes in the same node cluster start to hand over the message to verify the prepare message signature, message content and digest, and request encoding. Discard the illegal request. If the message is correct, the upper node B i To the first-level consensus node A i Send a commit message, the message format is.
[0044] In the reply phase, the first-level consensus node A i 2f+1 verified commit messages (where f is the number of Byzantine nodes) have been received, and a PBFT consensus has been reached in the single sub-node cluster network of the blockchain. So far, a single sub-node cluster network has reached a partial consensus in the entire blockchain network.
[0045] As one of the implementation modes, after the sub-node cluster consensus is completed, the first-level consensus nodes (A1, A2...Aj, j is the number of consensus first-level nodes) perform the second transaction verification, of which, one The consensus node Ai and the node An of the same layer enter the preparation phase and send a prepare message to the node An of the same layer of Ai to submit the signature information, summary information and request number. The message is correct and enter the next layer of consensus center node Kn The polling for inspection. The consensus center node performs transaction verification and PBFT consensus through polling, and finally puts the block on the chain to complete the overall consensus.
[0046] The consensus mechanism applied by the present invention is a preferred embodiment and is not used to limit the protection scope of the present invention. All modifications, substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.