Skip to main content
. 2023 Jul 28;23(15):6762. doi: 10.3390/s23156762
Algorithm 1 Add node to blockchain network.
Input: NewNode
Output: UpdatedBlockchain
InitializationnodeID←NewNode’s unique identifier;
nodePublicKey←NewNode’s public key;
blockchain←Existing blockchain network;
ProcedureNewNode 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