Research Article

A Novel Semifragile Consensus Algorithm Based on Credit Space for Consortium Blockchain

Algorithm 1

Node layering and credit space allocation algorithm.
Input: Cn (node’s credit value array)
Output: spaceArray (node’s credit space array)
(1) spaceArray[] = {0}; //Initialization of Credit Space Array
(2)  for i = 1 to n do //Traversing all nodes
(3)   if JudgePrsion (Cn[i]) //Judge if the node is in the prison layer, if it is, do not allocate
(4)space
(5)    continue;
(6)   end if
(7)   if i =  = 0 //When i is the first node in space
(8)    spaceArray[i]=(Cn[i]/countSum (Cn)) ∗ spaceLength; //Calculating the length of credit
(9)space
(10)    continue;
(11)   end if
(12)   spaceArray[i] = (Cn[i]/countSum (Cn)) ∗ spaceLength + spaceArray[i − 1]; //The length of
(13)credit space after becoming an accounting node, Cn is an array of normal layers
(14)end for