Research Article

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

Algorithm 2

Random selection accounting node algorithm.
Input: spaceArray (Node’s Credit Space Array)
Output: i (accounting node’s serial number)
(1) while (nodeSelect) //nodeSelect is whether to select the miner to complete the identifier,
(2)the initial value is true
(3)  rand.Seed (time.Now().Unix()); //Set random number time seed
(4)  randomSize = randomFloat (0, spaceLeangth); //Random number selected in space
(5)  node = judgeSelect (spaceArray, randomSize); //Determine which node is selected
(6)  if CoutArray [node] ≤ Exceeded //The requirement cannot exceed the threshold
(7)   nodeSelect = false; //The selection is complete, jump out of the loop, otherwise
(8)continue to choose
(9)   Cc[i]++; //Count value plus 1
(10)   return i;
(11) end if
(12) end while