Consensus Algorithms: The Backbone of Web3
1. What’s a consensus and how to reach it?
In any network, where you have to agree on some common data — you’d need either a trusted third party, that has to stake it’s money and reputation in exchange for having the final word on which data is right (remember this part for later), or some mechanism that will provide the rules of the game nobody could read without automatically leaving the game, hence, consensus.
In other words, it’s a way for several independent parties (you may call them agents) to reach an agreement among themselves without relying on some third party. The last bit means that some of the agents may have malicious intent, but as long as the chosen consensus mechanism is good, it will allow us to easily identify the bad players and kick them out of the network with penalties applied.
An important thing to note here, is to remember, that in a decentralised network you are your own police: some agents might do harm, before being identified as malicious. They are called trustless for a reason — don’t just trust one’s word, double check, verify!
Since web3 is decentralised by design, consensus mechanisms play a major role on how network participants interact with each other, resolve disagreements, reward good behaviour and punish malicious intent.
2. Proof of Work: the original Satoshi’s vision
The original Bitcoin paper had a pretty narrow scope: the only thing it was concerned with was how do we make money, that anyone could use, but without some central bank that would verify the transactions? To narrow it down even more, the question Satoshi asked was “how not to let someone spend the same money twice in the network?”.
Proof of Work is based on the idea that each participant could do some amount of work for the network, that would be initially hard (solving a hash with complexity growing proportionally to the size of the network) but easy for others to verify when it’s done.
Basically, miners have to solve the equation and the first one who’s done it gets the reward and is allowed to add a new set of transactions (block) to the network (blockchain). Others can simply double check the solution with the same equation and agree that it’s indeed the right one.
3. Proof of Stake: let’s decentralise a bit
Remember the part where a third party in order to have a final word on who’s right and wrong has to stake its money and reputation? Well, we used the word “staking” for a reason.
Proof of Stake is an alternative to Proof of Work consensus that is based on the idea that those responsible for the network should risk their stake (money/tokens) and reputation in order to do so. The important difference from the centralised world is that we could enter competition between them: why have one central authority and trust it to do the job, when we can have several competing to see who could do it better? And with a much lesser carbon footprint!
PoS allows to delegate network infrastructure to several bigger nodes with high enough stakes, yet again, anyone in the network could verify their work and, in case there’s some inconsistencies, raise a dispute. If the node would be found guilty by the rest of the network, it will lose it’s stake (but if the central bank loses its stake — the whole state might be in jeopardy, while here we just punished one bad node, distributed its stake among other participants and the network overall became stronger).
Written by Artemy Domozhakov-Liarskii especially for Super Protocol