Research Article
Blockchain Consensus Mechanism for Distributed Energy Transactions
Algorithm 2
Description of primary node election algorithm.
Algorithm: Master Node Election Algorithm | Input: Candidate Node Set. | Output: Master Node Serial Number. | 1. Trigger the smart contract to call a random verifiable function to generate a random number for this round of elections | 2. The candidate node calls the random verifiable function to generate the random number of this round | Calculate: | 3. If candidate node generates random numbers. | Broadcast the request verification message. | 4. When the consensus node receives the first request verification message | Timer start | Verificate | If signature is incorrect | Delete this message | Verificate | If is incorrect | Delete this message | End timer | Compare < the health score value of all requesting verification nodes > | Select | 5. Broadcast master node serial number | 6. End |
|