Research Article

HLOChain: A Hierarchical Blockchain Framework with Lightweight Consensus and Optimized Storage for IoT

Algorithm 1

Proof of random.
Require: params: ; ; ; , : time interval
Ensure: consensus
(1)procedure
(2)
(3)if () then
(4)  generate
(5)  broadcast
(6)  waiting for , and:
(7)  receive (incrementing )
(8)  if () then
(9)   update ()
(10)   broadcast “consensus failure, new
(11)   go to (line 2)
(12)  else
(13)   select the luck : the of is minimum
(14)   if (my is the luck) then
(15)    generate a new block
(16)    update block height:
(17)    update
(18)    update
(19)    broadcast new (, , )
(20)    go to (line 2)
(21)   else
(22)    waiting for , and:
(23)    if (the new Block has arrived) then
(24)     verify it
(25)     if (the Block passes validation) then
(26)      update Blockchain
(27)      update (, )
(28)      broadcast new (, , )
(29)      go to (line 2)
(30)     end if
(31)     else
(32)      update ()
(33)      broadcast “consensus failure, new
(34)      go to (line 2)
(35)   end if
(36)  end if
(37)end if
(38)else
(39) wait for the new (, , ) or (consensus failure, new ), go to (line 2)
(40)end if
(41)end procedure