What Is A Consensus Algorithm?
A “consensus algorithm” is essentially the mechanism that allows a decentralized network to come to a consensus on the state of the blockchain. “Consensus” means agreement. The nodes in a network need to be in agreement and have a consistent view of the data being processed and stored. They need to be in “consensus” on the validity of the transactions.
When it comes to blockchains, the two most popular consensus algorithms are “proof of work” and “proof of stake” – each of which have their pros and cons. In this article, I’ll give an overview of the difference between proof of work and proof of stake, and how they work to achieve consensus on a blockchain network.
What Is Proof of Work?
Proof of Work (PoW) is the most well known consensus algorithm. It’s the consensus algorithm that Bitcoin network uses, and it was the first consensus algorithm that was introduced into a blockchain. Proof of work is what initially solved the “double spend problem” – which was preventing decentralized digital currencies from becoming reality until that point.
Proof of work requires participants in a network to perform computational work in order to add new transactions to the blockchain. This computation work is referred to as “mining”, and the network participants who perform the work are called “miners”. You can learn about the mining process and the rigs the “miners” often use here.
Anyway, when a new transaction is added to the network, it, along with other transactions are grouped into a “block”. Miners then compete to solve a complex mathematical problem, called a “hash puzzle”, that is associated with that block. Whichever miner solves the puzzle first gets to add the block to the blockchain. When they do, they get rewarded with a certain amount of cryptocurrency. This process is called “mining”, and the reward the miner receives is called a “block reward”.
The idea behind proof of work is that it is costly and time-consuming to perform the work required to solve the hash puzzle. This makes it difficult for any one individual or group of individuals to take control of the network and manipulate it for their own gain. It also makes it difficult for someone to launch a so-called “51% attack” on the network, where an individual or group of individuals would take control of more than 50% of the network’s computational power, allowing them to control the blockchain and approve fraudulent transactions.
What Is Proof of Stake?
Proof of stake is a newer consensus algorithm and it’s an alternative to proof of work. In September 2022, Ethereum made the transition from proof of work to proof of stake. This event was dubbed “the Merge” by the crypto-community.
Rather than requiring network participants to do “mining”, as proof of work requires, proof of stake blockchains require participants to lock-up some of their own cryptocurrency as collateral in order to participate in the validation of transactions. This token lock-up is called “staking”. The idea behind “proof of stake” is that the more tokens a network participant is willing to stake, the more “skin in the game” they have, and the more invested they are in the network’s success.
With proof of stake, instead of miners, it’s the validators who are chosen to add new blocks to the blockchain. Validators are oftentimes chosen based on the amount of cryptocurrency they have staked, as they’re incentivized to act honestly and to validate correct transactions. If they act maliciously, their stake gets “slashed”, and they will lose some of their collateral.
Proof of stake is more energy efficient than proof of work because it doesn’t require computational power to validate transactions – which is one of the reasons why Ethereum made the transition.
Proof of Work vs Proof of Stake Comparison
Both systems are effective at achieving consensus on a blockchain network, but they have some key differences. Proof of work is more secure. This is because it’s time-consuming and costly to perform the work required to solve the hash puzzle, making it difficult for someone to take control of the network. However, it requires a lot of computational power, and therefore consumes a lot of energy.
On the other hand, proof of stake is more energy efficient because it doesn’t require computational power to validate transactions. Rather, it relies on the honesty of validators and their willingness to stake a large amount of their own tokens as collateral. This can create a concentration of wealth in the hands of a few large stakeholders, who may have more influence over the network.
When you’re trying to earn rewards with a proof of stake blockchain, it’s good practice to delegate some of your tokens to some of the smaller validators to balance out control of the network.
On Cosmos for example, sometimes the teams who are distributing their token in an “airdrop” will say that only those who have delegated their “stake” to validators outside the top 10 will receive the drop.
The purpose of such a policy is to incentivize a more even distribution of voting rights and control of the network.
Defence Against Sybil attacks
A “sybil attack” is when multiple false identities are created on a network in an effort to trick the system or gain an unfair advantage. These false identifies, also known as “sybil nodes,” can be used to control or disrupt the network. It’s a kind of attack that targets decentralized systems and aims to take control of the network by flooding it with fake identities.
Both proof of work and proof of stake are designed in a way that makes these attacks difficult to carry out. Proof of work requires each “sybil” identity to perform as much computational work as the honest, legitimate notes – which is prohibitively expensive.
With proof of stake, in order to carry out a sybil attack, the attacker would have to stake a significant amount of tokens to gain control of the network. This would come at a high cost, and if you were heavily invested in a project, why would you want to attack it and erode public trust?
Of the two, proof of work is considered to be the more robust defence against sybil attacks, but both algorithms do a good job against them.
Summary
Proof of work and proof of stake are both effective algorithms. Each, of course, have their own unique pros and cons. Proof of work is more secure, and oftentimes more decentralized. However, it tends to be slower and more energy intensive.
Proof of stake, on the other hand, is more energy efficient as it doesn’t require as much computational power. However, anyone who has the means to invest heavily into the project can accumulate a “whale share” of the tokens and have disproportionate control over the network.