Research Article

Research on Grain Food Blockchain Traceability Information Management Model Based on Master-Slave Multichain

Algorithm 5

PLEW algorithm.
Input: Candidate: Candidate
Output: Improve PoW Leader: P-leader
(1) timeWait = true
(2) Candidate——>server
//Broadcast the request to be the leader in the candidate queue and wait for the approval of other candidate nodes
(3) for ! timeWait do
(4)  if reciveResponse () ! = true then
(5)  //There are candidate nodes with longer waiting time in the queue
(6)   sever.State = follower
(7)   Candidate.Delete (server)
(8)   return null l
(9)  end if
(10)  server.State = leader
(11)  server.Wait = 0
(14)  def hash (server)
(15)   def proof (server)
(16)   server.leader = P-leader//Select leader node
(17)  return P-leader
(18) end for