What’s the big deal?
Over the past few years, you may have heard a lot of talk about consensus mechanisms.
Bitcoin’s proof-of-work (PoW) against Ethereum’s upcoming proof-of-stake (PoS), or even other, more alternative mechanisms like proof-of-burn (PoB) or proof-of-elapsed-time (PoET).
What the heck is that?
Why is so much being made about these consensus mechanisms and what does it have to do with cryptocurrency?
Let’s take a look.
Let’s say we have a distributed ledger that keeps count of how many apples an individual has in their basket.
Because the ledger is open to the public, all apples sent or received - by anyone - are added to the ledger as a new transaction. The ledger is then updated with the new balance of apples in each person's basket.
Additionally, anyone - who desires - can grab a copy of the ledger which displays all transaction information as it happened and the current balance of apples in each account.
We'd hope that anyone posting a transaction to the ledger would be honest and fair about their apples, but of course, this isn’t always the case.
Assumption: someone wants to steal an 🍎.
Tim, an apple thief, thinks he can game the system by posting two simultaneous transactions that contradict one another.
But posts two transactions simultaneously..
Because Tim’s account doesn’t hold enough apples, he shouldn't be allowed to complete this transaction.
So, how do we stop Tim from making illegitimate transactions?
This is where consensus mechanisms come into play.
Here's an easy intro.. 🪂
Just like our example with apples, blockchain networks are distributed ledgers with no controlling entity.
This means, anyone can post data to a public blockchain.
It gets reviewed and added to the ledger.
These networks have a series of participants who check over each transaction and validate that all transactions on the network are correct before they are posted.
But these validators all have to be on the same page.
You can’t have some validators confirming transactions while other validators reject those same transactions. Therefore, blockchain validators must come to a consensus on the state of the network at any given time.
A consensus mechanism is a way in which all network participants agree on the state of the blockchain. The mechanism determines what method is used to come to a consensus while ensuring that each participant validating the network is doing so fairly. For instance, in PoW, the mechanism used is electricity output — or the “work” required to secure the network.
In a PoS mechanism, on the other hand, the mechanism is “stake” or the economic incentive from validators.
Now that we know what a consensus mechanism is, we can better understand how it would help keep Tim honest.
Tim would actually be paid to help maintain the system rather than attempt to fraud it.
That's called incentivized.
Because a 'consensus mechanism' is in place, Tim - who wanted to cheat the game - learned he makes more to play it right.
I'll go a little deeper on it..
When Tim was attempting to send invalid transitions, we needed a mechanism that allowed the individuals checking over the ledger to confirm if each transaction submitted is valid.
To check that the apple actually left one basket and was received elsewhere.
These validators check in with one another and can prevent transactions that seem suspicious.
However, we also need to ensure that everyone confirming the validity of transactions is acting fairly and not approving Tim’s transactions because they want the entire system to fail, or because they are in cahoots with Tim in his scheme.
Therefore, the consensus mechanism needs to stop Tim, but also to catch any anonymous raccoons teamed up with him, who would allow Tim to send more apples than he owns.
Here's what they'd have to do..
Tim and his band of cohorts would not only have to insert false data into the block, they would also have to deny the correct data coming in.
This would cause the good nodes to have a choice.
The good guys gotta choose between a mean fake account (a) or a true and honest account (b).
So Tim and the boys would need to change the data in 51% of the nodes online, to get away.
Individually attack 51% of all online nodes.
In about 10 minutes.
After that, when they fail, they'd have to try again from the very beginning.
Wasting all resources - while mining would've allowed them to be stacking by now.
As we just saw, our consensus mechanism needs to incentivize validators to act fairly on behalf of the network.
The incentivization structure for validators is what differentiates consensus mechanisms between one another.
There are a whole host of consensus mechanisms either currently utilized by blockchain networks or being tested for future use. While this list isn’t comprehensive, it should give you a brief understanding of the benefits and drawbacks of using them to secure a distributed ledger.
“The purpose of a consensus algorithm is not to make a blockchain fast. The purpose of a consensus algorithm is to keep a blockchain safe.”
“Nodes work all at once with little coordination. They do not need to be identified, since messages are not routed to any particular place and only need to be delivered on a best effort basis. Nodes can leave and rejoin the network at will, accepting the proof-of-work chain as proof of what happened while they were gone. They vote with their CPU power, expressing their acceptance of valid blocks by working on extending them and rejecting invalid blocks by refusing to work on them. Any needed rules and incentives can be enforced with this consensus mechanism.”
“The main difference between consensus mechanisms is the way in which they delegate and reward the verification of transactions. (…) In one way or another, blockchain consensus algorithms boil down to some kind of vote where the number of votes that a user has is tied to the amount of a limited resource that is under the user’s control.”
“The Bitcoin protocol is composed of three moving parts: miners, Bitcoin’s blockchain, and bitcoin (the currency). The miners are the machines that mathematically compile transactions—employing a robust consensus mechanism to maintain an ongoing blockchain (i.e., digital ledger)—and bitcoin is the fuel that incentivizes the machines to churn, while also serving as a unit of account within the ledger.”
“Consensus prevents anyone from robbing Peter to pay Paul.”
As you can see, no one consensus mechanism is foolproof.
Humans have been the cause of all security beaches in history. These lines of codes have separated us from trusting those systems.
Consensus means Bitcoin (the network) will probably never be hacked, and does nothing (other than prevent fraud) in regards to the trading of bitcoin (the coins).
Blockchains are still relatively new, and the boundaries of consensus mechanisms are continuously being pushed to their limits.
While some believe proof-of-work is the only real way to have decentralization, others see proof-of-stake or proof-of-burn as better alternatives that are less energy-intensive.
Keep in mind that the "non-obvious" benefit of the energy consuming Proof of Work is that spammers are now incentivized to help rather than cause harm.
We might never see the perfect consensus mechanism, and anyways, it’s more likely that distributed ledgers will be built across the spectrum of consensus.
We've got more content on staying safe. check it out here, or here.
If you want to get weekly emails like this then sign up below 👇.
P.s.. If you made it through this journey and still want more, you should consider joining our private group. It's only for the initiated.
You'll understand the crypto-verse, get weekly deep dives & frameworks, PLUS network with our private little group.