January 2019
Beginner to intermediate
372 pages
11h 17m
English
In the previous section, we covered how Proof of Work used a hashing algorithm. We also looked at computing a target hash to solve the hashing puzzle. We're now going to implement a Proof of Work algorithm using the SHA-256 algorithm in order to analyze how hashing and probability contribute to this consensus algorithm.
Since the main intention of the Proof of Work algorithm is to find a nonce that, when attached to the blockchain header, results in the required target hash value, the task here is to randomly guess a nonce value and establish the digest value of the block. Thanks to the properties of hash functions, which make guessing the nonce really hard and non-deterministic, the only way to ...