Learn Consensus Mechanism in the most simple way.
Proof Of Work | Proof Of Stake | Proof Of Authority
Consensus Mechanism- The heart of Satoshi Nakamoto's Blockchain
When we live in a centralized system, which is almost everywhere currently- be it your office, or your government- There is always a higher authority to make decisions for you in case of any dispute. And not just in case of dispute, they also possess the unfair power of changing your decision. So making or taking decisions is pretty simple in a centralized network, but we're already aware of the unfair practices it can cause.
So the question here is- How does a decentralized peer-to-peer network with no authoritative figure take decisions??
The answer lies in the consensus model.
The word itself is pretty self-explanatory. It's made of consensus + mechanism. The consensus part means to have a bunch of people agree to a certain decision and the model part means the routine procedure to get to that decision. So Consensus Model is just a complicated term for saying that this is the procedure we'll be using to agree on something.
There are various types of consensus mechanisms. You can think of this mechanism as some sort of protocol or rule and all of them serve the same purpose which is to ensure the records are true and honest and the difference is the way consensus is reached.
There are various types of mechanisms. However, in this blog, we'll be learning about 3 mechanisms and keep the rest for the next maybe.
Before we dive deep into these mechanisms let's take an analogy: As we know blockchain is a distributed ledger so there are various nodes and all of them have the same copy of the blockchain possessing the same state i.e exact copy of the blockchain.
But suppose we got a new block to be added to the blockchain. Now which mining node will take the responsibility for adding the new node to itself and then replicate it to other blockchains in different nodes? Like, suppose if we decide to give it to Node 2. What if it turns out to be malicious? So in an ever-changing blockchain, we need a Reliable, Fair, Real-time, Efficient and Transparent way to do it. So how do we make sure all nodes come to a consensus (agreement) and have a copy of it? That's when we follow certain algorithms called consensus algorithms to make a decision. Let's discuss a few of them:
1. Proof Of Work
This algorithm works like a puzzle game. In a puzzle game, we've many participants solving a puzzle, making random computed guesses to solve the puzzle, and the one who solves it first wins the game. The winner gets some cash or any other thing as the winning prize
Something similar happens in Proof of Work we've all these nodes, they'll spend some computing power doing some mathematics or calculations (called hash functions) and whoever wins the calculation or whoever finishes it first, they'll add this new block in the blockchain. This is typically done by powerful computers and is known as mining. A reward in the form of cryptocurrency is issued to the winner i.e. the first miner that cracks the problem.
Cryptocurrency like Bitcoin and Ethereum uses the Proof Of Work Mechanism to validate the transactions.
2. Proof Of Stake
The first question that pops our mind is: Why do we need PoS when we already have PoW?
There is a huge issue with PoW. What's that?
A huge amount of computing power is used during the calculation as well a lot of computing power is wasted by miners who did not win it. And In a world where we are already in so much scarcity of resources, wastage of more resources is not the most efficient way. In fact media, environmentalists and many people across the world have been criticizing blockchain just because of this.
A fun fact:
Bitcoin, the world’s largest cryptocurrency, currently consumes an estimated 150 terawatt-hours of electricity annually — more than the entire country of Argentina, a population 45 million.
This is why Proof Of Sake (PoS) comes into the picture.
Suppose we have a car we no longer need or we simply want to sell to get some bucks. So what do we do? We go online or to some agency and put it out for an auction. The one who agrees to pay the most or the highest bidder gets to keep the car.
This concept of PoS is very similar. Here we don't really do a lot of computation and it's more about stake here.
The higher the stake place, the higher the chance to be selected.
Ethereum is in the first phase of moving to what it calls the Beacon Chain, which utilizes a consensus mechanism called “proof of stake.”
3. Proof Of Authority
Suppose you have got a very important event such as an interview coming up. And you need a tailored outfit for yourself. Who would you go to? A very common answer would be to go to someone you believe in. Someone you know would make the best fitted tailored outfit for you.
So similarly here in the case of PoA, only approved miners based on their reputations and trustworthiness are selected to become validators of our blockchain.
IBM Hyperledger and Ethereum's Kovan Testnet are some examples of blockchain systems that use Proof Of Authority.
These are not the only consensus present in the market there are various other consensus mechanisms present.
There are also companies that run on various consensus protocols at the same time which I might discuss later in different blogs.
I hope I was able to convey this in the most simple words possible. If any doubts please let me know in the comments below.
Thank you for reading!