We have discussed in the previous blog that different Blockchains use varying consensus methods. The consensus is a secure, real-time, fault-tolerant mechanism. It helps different nodes to verify transactions and agree on the current state of the Blockchain network. It also prevents the entry of false transactions and blocks on the network.
Blockchains use different consensus methods such as:
- Proof-of-Work (PoW)
- Proof-of-Stake (PoS)
- Delegated Proof-of-Stake (DPoS)
- Byzantine Fault Tolerance (BFT)
- Practical Byzantine Fault Tolerance (PBFT)
- SIEVE
- Proof-of-Weight (PoW)
- Unique Node Lists (UNL)
- Proof-of-Burn (PoB)
- Proof-of-Activity (PoA)
- Proof-of-Capacity (PoC)
We will discuss Proof-of-Work (PoW) and Proof-of-Stake (PoS) methods of consensus in this post.
Proof of Work in Blockchain
Before understanding the consensus method called Proof-of-Work (PoW), let us first know what is mining in the Blockchain?
Mining is the process of adding transactions to the Blockchain by creating a hash of a block of transactions, which is very difficult to forge. Mining requires a fast CPU, has a higher electricity consumption, and generates more heat than typical computer operations. Hence, not all nodes (computers) in the Blockchain are useful for mining.
The Blockchain of cryptocurrency Bitcoin rewards users opting to do mining with 25 bitcoins per hash. The purpose of mining is to keep the Blockchain decentralized and secure. Hence, miners must ensure that the transactions are valid before adding a new block of transactions to the Blockchain.
They must also ensure that no one is duplicating the bitcoins. It is a risk associated with cryptocurrencies, and is called double-spending.
To get the block reward in the form of bitcoin and transaction fees, the miners must verify one megabyte worth of transactions and solve a complex computational math problem, also called Proof of Work.
Example of Proof of Work in Blockchain
Suppose a miner called Peter, is competing to validate the block 701811. But someone else solved the problem before him. Hence, Peter must update his local copy of the Blockchain and start to create a Candidate Block, the block 701812.
When his computer was trying to find the Proof of Work for the previous block, it was simultaneously gathering new transactions to include in a new block.
Peter’s computer starts creating a Candidate Block after it gets the notification that the previous block has a valid Proof of Work. It uses the transaction pool to form the block while removing any transactions from the previous block.
The node also constructs the block header, which includes the previous block hash, the Merkle tree or binary hash tree root, and data for the mining competition. Peter’s computer then goes on to mine.
Bitcoin uses the hash function called SHA-256, which always produces an output 256 bits long. It is impossible to compute the same hash with two different inputs or predict the output in advance.
All the miners run the hash function using their nodes and try to prove if it is valid or not by solving a mathematical problem. The problem requires considerable work but is easily verified to be correct.
In technical terms, they try to determine a number (nonce), so the cryptographic hash algorithm of block data results in less than a given threshold or difficulty. The 1st miner with the valid hash has to work to get it, thus, displaying Proof of Work.
The impact of the Proof of Work consensus method
The threshold in solving the math problem determines the competitive nature of mining. It means that miners must add more computing power to the network. As this parameter increases, it also raises the average number of calculations needed to create a new block.
Since this method pushes miners to improve the efficiency of their mining systems to maintain a positive economic balance, it also increases the cost of the block creation. As a norm, Blockchains update the parameter every 14 days, and the miners generate a new block every 10 minutes.
The disadvantages of Proof of Work
- Excessive energy consumption
Experts have long debated and criticized the PoW consensus method for using a lot of energy, which is an unsustainable protocol. As per the 2015 data from VICE Motherboard, one transaction of Bitcoin required energy equivalent to the amount of power needed by 1.57 American households in one day.
- Huge costs
You need to pay for the energy expenses using Fiat Currency, i.e., the money which the government declares as legal tender. This practice leads to constant downward pressure on the underlying digital currency value.
- Economy of scale
As PoW uses computation power to determine the validity of a block, people with more computation power are at an advantage of reducing per-unit cost. Hence, people are more interested in building large mining farms instead of running individual mining nodes. This practice hurts the fundamental principle of decentralization.
- Mining Pool
When several miners combine their computational power to compete for PoW, it is called a Mining Pool. Sharing leads among a group of miners drags the system towards centralization, which is supposed to be decentralized. It is a matter of concern that an increasing number of mining pools and companies are representing the majority of computational power on the Bitcoin network.
Proof of Stake
Proof-of-Stake (PoS) is another method that Blockchains such as Algorand, Cardano, Cosmos, Dfinity, etc. use to validate blocks and achieve consensus. Peercoin became the first cryptocurrency to implement PoS in 2012 and uses a mixed system of both PoW and PoS methods.
PoS offers energy efficiency over PoW as there are validators instead of miners in this method. A randomized system determines who will create the next block based on how much and how long a person or entity holds the cryptocurrency. PoS uses the randomized system to prevent centralization by the richest individuals.
The Proof-of-Stake consensus algorithm provides better security because an individual or group will have to own the majority of coins on the network to carry out a 51% attack. It also eliminates reward for the creation of block in the form of cryptocurrency and gives a transaction fee instead.
Even if someone owns 51% of coins on the network, PoS makes it disadvantageous for the person to attack the network as an attack would diminish the reputation and price of the cryptocurrency that the attacker holds. Hence, it incentivizes the majority stake owner to work towards maintaining the security of the network and not otherwise.
Why Ethereum wants to use Proof of Stake?
Ethereum started the process of switching completely from a Proof of Work to a Proof of Stake system in 2017 and is said to launch in 2020. Ethereum wants to leverage on the benefits of PoS such as energy efficiency and security. However, PoS also has its share of risks.
The disadvantages of Proof of Stake consensus method
- Monopoly problem
As the PoS method allows the major stakeholder to enjoy extensive control and authority over technical as well as economic aspects of the network, it gives rise to a significant monopoly problem.
- Centralized power to make changes
PoS gives major stakeholders the technical ability to make changes without considering the will of the miners, businesses, developers, and community.
- Nothing at stake
In a Blockchain, when two blocks have the same height or when a Blockchain diverges into two paths, it is called a fork. In PoW, miners dissolve the fork by mining on any one block as mining requires computational power and costs them.
However, when a folk takes place in PoS, the validators could vote for both forks of the Blockchain because it doesn’t cost them anything to validate transactions on multiple forks
As PoS does not use computational energy, it is inexpensive to create a block, the validators could simultaneously mine on multiple chains to increase their chances of collecting transaction fees on whichever chain wins. This practice could disrupt consensus and make the network more vulnerable to double-spend attacks.
To make the scenario of Nothing at Stake impossible, Caper (a consensus mechanism) of Ethereum recommends penalizing validators building on all forks by making them lose a portion or all of their security deposit.
The Take-away
Both Proof-of-Work (PoW) and Proof-of-Stake (PoS) methods of consensus have their pros and cons. As the Blockchain technology develops further, we will see Blockchains coming up with measures to reduce the disadvantages of particular consensus methods and make their best use.