Figure 3. Merkle tree structure in blockchain
After determining Merkle root hash value, PoW algorithm proceeds to assemble block header, filling in corresponding fields with the hash value of previous block header, current timestamp, target value for generating new block, etc. The target value for generating new block is defined by blockchain network protocol and is updated at specified intervals. The value of random number (nonce ) in block header is determined through iterative calculation process of PoW algorithm.
During iterative calculation process, except for the random number (nonce ) field shown in Figure 1, all information of new block has been determined. At this point, PoW algorithm fills in a random value innonce field and calculates current block header hash value. If this hash value is less than target value, the new block is considered as a ”valid” block and will be broadcast to blockchain network. If the hash value does not meet target value requirement, PoW algorithm will regenerate a new random value to fill in nonce field and perform hash value verification.
During the execution of PoW algorithm, if a host receives a ”valid” block generated by other nodes from blockchain network, it adds such block as the latest block to blockchain and executes PoW algorithm again on the updated blockchain[6].
2.2. Challenges of Proof of Work Algorithm
Blockchain system has solved the problem of constructing a trustworthy distributed database in a network environment where communication conditions are unreliable, and member information remains anonymous. Based on blockchain technology, decentralized digital currencies, smart contracts, distributed data storage, and other applications have been realized, with consensus algorithms playing a vital role.
As one of the most successful consensus mechanisms to date, PoW algorithm has been proven in practice to maintain long-term secure and stable operation of blockchain system. Its core concept is to select nodes to generate new blocks in proportion to the computing resources possessed by each node. Due to the adjustable difficulty and easily verifiable results of hash operation used by PoW algorithm, blockchain network can dynamically adjust the target value parameter in PoW algorithm according to the overall computing power of blockchain network, and quickly propagate a ”valid” new block to every node once it is generated by a particular node.
However, while PoW algorithm effectively achieves decentralized data storage, traceable data operations, and immutable on-chain information, it also faces challenges such as high electric power consumption, long time of new block generation, and low bandwidth of data upload.