The main characteristic of blockchain technology is the distributed ledger system. The distributed ledger system keeps a record of all the previous transactions. Since all the transactions are not held at a single location but instead are vast spread over a network of computers, the entire network collectively agrees on the contents of the ledger. The means through which the contents of the ledger are agreed upon is known as the consensus mechanism. Proof of Work (PoW) and Proof of Stake (PoS) are the two most prominent consensus mechanisms today. In this article, we provide an easy and intuitive explanation of PoW and PoS and do a comparative analysis of the two.
Why Consensus Mechanism came into play
In a centralised system, such as a bank, all the data, transactions, and information is held and verified by the centralised system, in this case, the bank. If John paid Amy $1000 through the bank, John first deposited the amount in the bank. The bank verified this transaction and then transferred the money to Amy’s account. In this transaction, both John and Amy trusted the bank to complete the transaction on both ends. The entire process of adding/deleting and updating the data is performed by the central authority and in this case the bank. The main characteristic of a centralised system to work is the faith and the trust people hold in that institution.
In a decentralised system, users broadcast the transactions on the entire network. The responsibility for validating these transactions lies with the nodes on the network. In a centralised system, the central authority would look into each transaction and check their legitimacy. However, in a decentralised system, such as blockchain, there lacks centralised authority i.e. no one person is the ultimate leader. Due to this, the network has to collectively agree on whether the broadcasted transactions are valid or invalid. This is done through a consensus mechanism. If the network collectively agrees on a transaction being valid, it is added to a block.
In short, the consensus mechanism is a system of regulations that ensures all the nodes on the chain are in sync with each other and agree on the fact that all the transactions that have been included in the blockchain are legitimate. There are multiple forms of consensus mechanism but the two most prominent ones are:
(a) Proof of Work and
(b) Proof of Stake.
The Basics: What is Proof of Work?
Proof of work is the consensus mechanism that was invented by Satoshi Nakamoto for the bitcoin blockchain. In PoW miners compete against each other to solve complex mathematical equations. Once a miner has solved an equation for the new block, the miner broadcasts the block to the network. The other miners will then verify the solution and once the solution is verified, the block is added to the chain. The mechanism is based on a trial and error method.
If mining hub A guesses the key to for creating a valid is 00000123##4a5b, the rest of the miners will verify the key is indeed 00000123##4a5b. Mining hub A will receive a reward for creating this new block. The faster you guess the key, the greater are the chances of you receiving the reward. The bitcoin protocol aims to generate a new block approximately every 10 minutes. Consequently, as the combined computational capacity (known as hash power) of the network increases, the difficulty of the puzzle increases to keep the block time same. Conversely, reduction in hash power leads to lowering in difficulty of the puzzle. There are a few terms that one needs to know about PoW
- Hash Function – The input required to know the output
- Hash – The answer to a mathematical puzzle
- Nonce – The integer value added to present a number as a multiplication of two other numbers
Let’s say, for example
The input is ‘Hi, Welcome!’ The hashing algorithm used is SHA-256. You want the result to begin with a 0aa. Here, as you can see, you keep trying ‘Hi, welcome!’ with different trial numbers from 1 onwards.
Hi, welcome!1 – 923e7b4f09a71e8972bed351f1bcb5a7ff444122ab0d075f2d7f25e3fe1a4dad
Hi, welcome!2 – 5c13280a8d7dd7d637f17acfb1612d5ea04efb9339a7e38aa5ac20c5a13f74ba
Hi, welcome!3 – 14179962f6a2367359b758f063030f2ad026f904ef302716044e40b24539c36f
Hi, welcome!998 – e5561541bd86083472f7bea13d4cf1eb4e5edf62be176b01819c65a150696a30
Hi, welcome!999 – 5f16f2b07f979a05dc3534f3abf45d2347a305e86a6897c541ea2a9774204f07
Hi, welcome!1000 – 0aa64d625ad4a23daf5c590afa9f0e6cd220df1cbd7d3fc35ba99710cfd1b032
It took 1000 trials to reach to the final hash. In real life, however for a computer to compute a 1000 trials does not take more than a few seconds. The trial and error method is required because, as you can see from the above example, SHA-256 is a one-sided algorithm. It can give the output to input but it does not work the other way round. Hence, the computer has to try various permutations and combinations to reach the final hash.
The Basics: What is Proof of Stake?
The first-ever cryptocurrency to use Proof of Stake was Peercoin. Dash and NEO are other famous crypto assets that use this form of consensus mechanism. The Proof of Stake model uses the same idea of decentralised transactions to reach the final answer; however, the path to reach there is different.
In Proof of Stake, there is no mathematical equation. Instead, a coin holder can participate in the validation of new blocks by ‘staking’ their coins. Validator for the next block is selected randomly from the pool of network participants that are staking their coins. The probability of getting selected to validate transactions increases with the amount staked. Suppose A has put 20 coins to stake and B has put 100 coins to stake, B has increased his chances by 5x to be chosen as the next block validator. Just like in PoW, validators earn a reward for creating a new block.
The staking requirement ensures the validators have enough skin in the game to stay honest. As a node has to keep some of their coins at stake, the staking works as a financial motivator for the node to not engage in fraudulent transactions. To keep a check on the validators, there’s a penalty system. In this system, when a validator validates an incorrect block, a portion of his stacked coins are locked or they face penalty charges. Furthermore, once someone participates in a fraudulent transaction, they lose their rights to validate future transactions. Thus, as long as the penalty for dishonest behaviour outweighs block reward, validators have the economic incentive to behave honestly.
Pros and Cons – PoW vs PoS
Every coin has two sides. Now that you know a little more about PoW and PoS, you might wonder which is the better mechanism. So to say, no one mechanism is perfect. Each of them has its pros and cons.
Advantages of PoW
- Since PoW requires great computing skills and capabilities to solve puzzles, no matter how much money one has in their wallet, they cannot influence the decisions made on the chain. This ensures there is the decentralisation of power and holders of large capital cannot make decisions for the network.
- PoW is the consensus mechanism used in bitcoin blockchain, which is the oldest and inarguably the most established blockchain. PoW has also been tried and tested way more than PoS, thus having fewer unknown risks. Because the tasks on PoW require considerable effort and investment, it is not easy to plan an attack. This increases the layers of security on the network.
Disadvantages of PoW
- The primary challenge with the PoW mechanism is that only technically savvy individuals/groups who can endure the expensive cost of running can participate in the mining process. This creates a disparity between the individuals due to capital constraints.
- A major drawback revolving around the PoW mechanism is the amount of energy and electricity required for mining.
Advantages of PoS
- PoW consensus mechanism entails solving mathematical puzzles through trial and error and this places a natural limit on the rate which new blocks can be added to the blockchain. Thus, PoW blockchains tend to have low throughput. This constraint doesn’t apply to PoS. The validator selected to mine the next block needs only to check that the proposed block is valid. This can be very quick. Thus, PoS blockchains can achieve very high throughput.
- Users can participate on the network without the need for supercomputers or expensive hardware. This increases the participation of the network, giving the users a fair chance.
Disadvantages of PoS
- While the Proof-of-Work mechanism is dependent on mining and computing power, Proof-of-Stake is based on the actual possession of the digital currency. For instance, participants that hold the most significant amount of coins would have the privilege of authenticating transactions on the network. This would lead to influence and vulnerability on the network.
- Token holders are more akin to hold on to their tokens, and even a bit too much. Some PoS protocols lead to extremely low liquidity on exchanges, which is a minus for newcomers and speculators.
Both the consensus mechanisms, PoW and the PoS have their pros and cons. In PoS a small group of validators are gain significant influence on the network by staking a lot of tokens. Since heavy investments are required in PoW, the power of mining has become centralised to those who can invest heavily in the system. This increases the risk of the mechanism being centralised, beating the purpose of the technology. Thus, in both PoW and PoS blockchains, power can potentially centralise into parties that have access to capital.