| Algorithm 1. The leader node selection algorithm |
Input: L, V, l, tN //L is an array to store LV, each element stores an ID of a validating node; V denotes the number of elements in LV; l denotes the number of validating nodes that have already acted as the leader node in a consensus round; tN denotes the timestamp of the latest block BN.
Output: L; L[i]
int i,j;
i = V-l;
{
C[i] = QRNG(ID(V-l),tN); // ID(V-l) denotes identity of the current leader node
j = C[i]%(i+1);
tmp = L[i]; // L[i] stores ID of the i-th validating node in LV
L[i] = L[j];
L[j] = tmp;
}
if(l < V)
l = l + 1;
else
l = 0;
return L[i]; //The element in ith position in L, that is, L[i] stores the identity IDL[i]will be elected as the leader node in the forthcoming (K+1)th consensus
|