Consensus Mechanism: PoW vs PoS
To be able to transfer money or value Peer to Peer (P2P) without any central authorization has been the dream of cypher punk since the 60s. However, the concept of decentralized digital money possessed a long unsolvable problem called The Byzantine Generals’ Problem. It questions the possibility of forming a consensus in a computer network.
In 2008, an unidentified person using the pseudonym Satoshi Nakamoto published a paper “Bitcoin: A Peer-to-Peer Electronic Cash System”. Satoshi proposed a distributed ledger system encrypted by cryptographic and run automatically by algorithm. All the nodes (the computer connected to the network) will always get an updated ledger of all transactions in the network. New multiple transactions will be pooled together as a ‘block’. The algorithm will verify the block using a consensus mechanism called Proof of Work. The confirmed block is added in a linear & chronological order to the chain. The technology of these chained blocks will create an auditable and transparent record of transactions which later is known as the blockchain.
Most of the cryptocurrency today uses the technology blockchain as their infrastructure. However, each blockchain has a different consensus. Consensus is the heart of decentralized blockchain because, without any central authority, the participants have to agree on rules on how to operate the blockchain. Throughout the years, people try to create better consensus algorithms.
The Byzantine Generals’ Problem
To understand the seriousness of consensus, we need to understand the Byzantine Generals’ Problem. Imagine a group of generals, commanding Byzantine armies, surrounds an enemy city and can only communicate by messenger. To conquer the city, the generals have to agree on a battle plan. However, one or more generals might be traitors and sabotage the message plan. How many traitorous generals can the army have to still be able function as one?
The analogy depicts the problem with digital currency where there is no central authority to be the custodian of assets and no central authority to verify assets and transactions. In distributed ledgers, the different nodes act like generals. How many transactions can be malicious without the system having to refuse a transaction?
Proof of Work
Proof of Work means participants (nodes) must proofread works (using participants’ computing power to verify & add transactions to the public ledger) in order to earn Bitcoin as rewards. In permission less blockchain, the nodes do not know each other (just like the generals). How can Bitcoin blockchain maintain a decentralized network if there are traitors?
In order to add new data entries (block) to the chain, nodes need to solve a hard computational challenge which consumes high computing power and processing time. There is a small chance any single node can generate the required proof-of-work without high cost of computing power. Thus, minimize the spamming attack. Every 10 minutes, a valid Proof-of-Work (PoW) is produced. If there are two blocks created at the same time, the one with the longest chain is accepted as valid. Proof of Work does not have any central authority, but systems assume that the honest nodes (the longest chain) control the majority of computing power.
However, there are several problems regarding PoW:
- Energy Consumption: Every year the mathematical problems continuously become more difficult to solve which require more amount of electricity.
- Centralization: PoW creates an unfair system because those who have powerful and expensive hardware devices will have greater chance of winning the mining rewards.
- 51% Attack: A group of people who hold more than 51% of the system's computing power can alter the blocks for their gains.
Proof of Stake
Proof of Stake created in 2012 to solve the PoW’s problem. If the PoW rewards the miners for solving computational problems, the validators of PoS earn the transaction fees when creating the next block based on how much they have ‘staked’. The validators are people who lock up (stake) particular coins of blockchain.
Validators are randomly chosen by the network to propose new blocks. The network also selects multiple validators to attest the proposed block. The chosen validators who proposed and attest the block will earn transaction fees. Validators who are offline or not making correct attestations will receive a penalty (slashing of their stake). If validators try to attack the network, they can lose their entire stake.
Earning transaction fees in PoS do not require fancy hardware and less energy consumption. Therefore, more ordinary people can be validators in PoS rather than in PoW which will allow a more decentralised network. PoS punishes nodes that do not follow the consensus mechanism which reduce the 51% attack possibility.