Proof of work is a computational search for a value that satisfies a difficulty condition. In a blockchain, repeated hashing makes a block expensive to produce but easy to verify. section 7.4.2 section 1.6
A basic proof-of-work loop:
- Derive a hash prefix from the block’s difficulty, using leading zeroes as the acceptance condition. section 7.4.2
- Increment the block’s nonce and recalculate its hash. section 7.4.2
- Repeat until the hash starts with the required prefix, then return the mined block. section 7.4.2
Mining a block asynchronously
A synchronous proofOfWork function can occupy the JavaScript thread for seconds. A proofOfWorkAsync wrapper starts a Node.js Worker, passes serialized block data to it, resolves with the mined block, and rejects on worker errors or abnormal exit. section 8.3

