Algorithm 1 Add node to blockchain network. |
Input: NewNode Output: UpdatedBlockchain Initialization: nodeID←NewNode’s unique identifier; nodePublicKey←NewNode’s public key; blockchain←Existing blockchain network; Procedure: NewNode sends a request to join the network; Request is approved newBlock←CreateGenesisBlock(); newBlock.header.previousHash←blockchain.getLatestBlock().header.blockHash; newBlock.header.timestamp←CurrentTimestamp(); newBlock.header.nonce←CalculateNonce(); newBlock.header.merkleRoot←CalculateMerkleRoot(); newBlock.header.nodeID←nodeID; newBlock.header.nodePublicKey←nodePublicKey; newBlock.header.blockHash←CalculateBlockHash(newBlock.header); blockchain.addBlock(newBlock) Broadcast the new block to the network; Update the blockchain network; Return UpdatedBlockchain |