Consensus Mechanisms (Part 1 of 2): Proof of Work

Shivanshu Madan
2 min readMar 2, 2022

Proof-of-Work (PoW) is a popular consensus mechanism that decentralized networks like blockchains use to make decisions.

PoW solves a famous consensus problem:

Byzantine’s general problem

Byzantine’s generals want to attack a city, but face two problems:

  1. The generals and their armies are far apart, so centralized authority is impossible
  2. The city has a huge defense, so coordinated attack is vital

The generals could send a messenger to coordinate, but the messenger could be captured or compromised.

Satoshi Nakamoto’s solution:

  • The sender-general, appends a “nonce” (an arbitrary number) to the original message.
  • Then, this nonce-appended text is “hashed” (hashing generates a unique fixed-length output for every input string)
  • Suppose, the generals decide to only share messages which, on hashing, give a result that starts with 5 zeroes (they keep changing the nonce until the 5 zeroes are obtained). Useful and extremely time-consuming process.
  • If the city tampers the message, the hash itself will change drastically, and the receiver-generals will suspect foul-play.

Loophole: What if the city tampers the message, and changes the nonce until it gets a 5-zero hash? Extremely time-consuming, but possible.

Counter: The generals will use strength in numbers. Suppose, there are 3 sender-generals instead of one — they can make their own messages, hash the cumulative message, append a nonce to the resulting hash, and then hash it again.

Now, the amount of time it will take for the city to tamper the cumulative message and find the corresponding nonce for the hash will be infinitely more. By the time they solve it, the city will be destroyed.

All the receiver-generals have to do, is append the message with the correct nonce that will be given to them, hash it, and see whether the hash matches or not. This in essence is the process behind Proof-of-work:

  • Finding a nonce for the appropriate hash, is extremely difficult and time-consuming — miners solve cryptographic puzzles to “mine” a block in order to add to the blockchain
  • Verification of that block is very easy

This post was created with Typeshare

--

--