What is Proof Of Work (POW)
When it comes to Bitcoin and different consensus protocols, proof of work is one of the most popular.
Consensus is a computer protocol in which nodes agree on the same world state.
Essentially Consensus helps to fix the Byzantine generals problem whereby none of the generals truly know if the other general wants to proceed or not.
It’s a bigger issue and one we will cover in another article.
For now, understand that consensus needs to be achieved to make sure that transactions are valid.
This proof-of-work is the consensus protocol that allows all nodes to agree on the network's system.
In other words, this is why there can be a trust-less society through cryptocurrency.
USING BITCOIN PROOF-OF-WORK AS AN EXAMPLE
If you have heard of “mining” then in a sense you have heard of POW.
Proof-of-work is what Bitcoin mining is doing - while verifying transactions and contributing to the network.
It is also reaping a small transaction fee, depending on the protocol it starts when someone wants to send a coin, make a transaction, or use a feature that needs consensus.
When that first computer (or multiple) propose adding a transaction to the block, it’s called a “proposer.”
Nodes typically stay with the majority.
We talk about when the majority goes against the original chain in the article on a 51% attack.
Rarely does that happen.
When that does happen, and a node goes in the wrong direction, all of the mining power is wasted, and that node reaps no rewards.
Which leads to a lot of wasted time and energy.
And there is never a step where the nodes have to reset and figure it out.
It all works instantly.
This makes POW both noninteractive and allows the network to scale.
What makes it work is that the heaviest chain is one that the majority of nodes select and one that if the computer doesn’t go with it doesn’t receive a reward.
By using game theory, there is no enforcement.
You can go against consensus but not only are you not rewarded you lose.
HOW DO NODES PROPOSE A NEW BLOCK?
By solving a very hard puzzle - the computer has to show dedication.
Each node in the system is continually trying to solve these puzzles, and the ones that do first are rewarded with Bitcoin.
That’s a quick synthesis of Bitcoin mining.
These computers compete and whoever solves it first gets a number called a nonce, which allows for the creation of the next block.
Putting together the block requires a few steps:
- Validate transactions waiting to enter a block
- Use nonce and associate it to them
Hash all of them
- Check the leading 0s of the hash
If the hash has the required leading 0s, then the block is created
- If not retry the hash
Typically it can take trillions of 0s to find the actual hash.
Which is the difficulty often talked about.
Now the rate is a lot more vast than people think.
Where currently Bitcoin is over 2 exa hashes per second, or every sextillionth hash has a hit.
This merely has happened because people started to use mining as a way to make money instead of the original intention of verifying transactions.
Once this nonce is found it only takes one calculation to verify it, which is why it becomes so difficult to find.
And that is how proof-of-work happens.
A SUMMARY OF PROOF-OF-WORK
- POW follows a model of consensus
- When nonce is found, it enters transactions into a block
- Then computers follow this transaction via consensus
- If a computer diverges from the largest chain, they are penalized
POW uses game-theory
- In the end, a new block is formed, and the transactions are valid
There are another couple methods of proof.
Learn more about Proof-of-stake by clicking here - Proof of Stake