One of the most popular Consensus Methods used today is Proof Of Work. As I write this post, Bitcoin and Ethereum both still use the Proof Of Work consensus method. Ethereum is set to switch to Proof Of Stake in it’s upcoming Casper update. However, the first iteration of this update will be a hybrid of PoW & PoS. Bitcoin will continue to use Proof Of Work for the foreseeable future.
Regardless of the consensus method used,
Bitcoin & Ethereum are still blockchains. And such, both networks rely on the Longest Chain Rule when coming to consensus.
In this post, I’ll attempt to dive a little bit deeper into The Longest Chain Rule while still keeping things as simple as possible 🙂
Longest Chain Explained - A Farmer Analogy
Let’s pretend we’re all farmers living in a small town. Majority of us farm rice as our major source of income. Weharvest the rice and pack them into 1KG gunny sacks and then carry the sacks to the Townhall. The sacks are then placed onto the only carriage the town has and transported to The Main City and sold.
The Town Hall Meeting: One day a Town Hall meeting is called to discuss the size of the gunny sacks...
An angry debate ensues on whether or not they should increase the size of each gunny-sack. Some farmers want the increased gunny-sack size for increased profits. But other farmers are against the idea – and claim it will make it more difficult for the older/younger/weaker farmers to carry the gunnysack to the Townhall.
The Mayor suggests that a vote should be conducted to solve the matter. However, an objection is raised:
“How is that fair? I do more work than these guys. I harvest far more rice. My vote should count more”
The Vote : That’s when a farmer named Satoshi comes up with an idea. He suggested that the next time they come to the town hall – they vote with their gunny-sacks of rice.
Each gunny-sack would represent a vote. That way, if you have more gunny-sacks you can cast more votes.Each sack of rice would be proof of their hard work. Farmers who worked harder, had more rice – and hence got to cast more votes
The Result : Everyone loved the idea. The next day, two rows were laid out near the Town Hall. The first row represented “Increase Gunny Sack Size” and the second row represented “Don't Increase Gunny Sack Size”
Farmers would carry their gunny sacks to the town hall and place each sack in one of the two rows – thus casting their vote. The row that had the longer chain of gunny sacks would be picked as the final decision.
At the end of the day, the “Don't Increase Gunny Sack Size” row had the longer chain of gunny sacks – and thus was the winner!
Disagreements within a blockchain are pretty much solved the same way. Each gunnysack represents a “block” in the blockchain. A row of gunny sacks represents a chain.
Whenever there’s a disagreement, network participants can “fork” off the current chain. Thereby starting a new chain of blocks. Participants who agree with this new chain can now start applying their “blocks” to the new chain as well. Eventually, if the new chain extends the old chain – the Longest Chain Rule will kick in and will be declared the winning chain.
Longest Chain & “Work”
In our analogy, farmers were adding sacks of rice to “vote”. These sacks of rice are tangible and represent work done. The longest row of sacks represents the majority.
Similarly, in the blockchain, miners add a block to the chain to cast their vote. And the longest chain of blocks represent the majority.
But - How does a “digital” block represent something tangible/work?
Therein lies the beauty of Proof Of Work – but also a lot of confusion. In a previous post we discussed how Proof of Work uses the Cryptographic Puzzle to determine who represents the majority in the network.
To recap: Miners on the network compete against each other by attempting to solve the puzzle – in order to win the “right” to add the next block onto the chain.
A miner consumes a lot of electricity to solve these puzzles. But each time he wins (i.e solve it before someone else does) – his block gets added to the chain.
In a way, the miner has permanently applied his electricity onto the block he just created. Since he won the solved the cryptographic puzzle, his block (with his ‘electricity’) gets added to the chain.
So now you could say...
The farmers ‘proof of work’ was his sack of rice – and hence got to vote. After all the farmers place their sacks of rice in each of the two rows, we have our decision because:
“The longest row of sacks represents where the majority farmers have placed their vote”
The miner’s proof of work is his winning “block” of transactions - since each block represents a miner’s electricity consumed – the entire chain represents the consumed electricity of all the previous winning blocks.
“The longest chain of blocks represents where the majority miners have placed their vote"
Concluding Thoughts - Longest Chain & Immutability
Remember, energy is never destroyed – simply transferred. In the proof of work, you could say that the energy is transferred to secure the blockchain.
Why ‘secure’? Because to change a block, you’ll have to redo the “work” that was needed to create that block.
To undo any of the previous blocks, you’ll have to redo the work for that block and every block that followed it. I’ll explain (in detail) why in another post. But this is what gives Bitcoin it’s strong immutability.
In essence, an attacker will have to start a new chain and do enough work to also become the longest chain. If and only if his chain is the longest chain will it be considered the winner and valid. And you may understand now – to achieve this, would require consuming a lot of electricity. This is why The Longest Chain rule is so crucial to understand 🙂
Did this post help you?
Help Us Keep Doing What We Do Best!
Tip Jar 🙂
Did you enjoy this post?
Help Us Keep Doing What We Do Best!
Tip Jar 🙂
Get my upcoming eBook for Free!
"The Mango Guide TO Understanding Blockchain"
Offer Valid For FIRST 500 registrations only
[…] the previous post I explained the Longest Chain Rule using an analogy. The analogy seemed to help several of the Mango Readers grasp the importance the rule plays. If […]
[…] B and Block B2 are now both in contention to win the Longest Chain Rule. Another block (Block C) gets added – but it gets added behind Block […]