In this my previous post I gave a brief introduction on Blockchain and Decentralised Consensus Technology (DCT) and how it uses consensus protocols to record authentic transactions.
Traditionally, businesses and trade networks used intermediaries to authenticate and validate transactions. In a large network these intermediate steps would add a delay to the entire process. This means that trustworthy authentic transactions lead to higher costs and longer transaction times.
For example, consider cross border payments. Currently it is an expensive and slow process. Blockchain can expedite international money transfers and significantly cut remittance costs by eliminating the intermediaries involved in the process.
This can be done because consensus protocols are used in the peer to peer network to authenticate all transactions eliminating the need of third parties. Consensus protocols define rules dictating who gets to update transactions on the blockchain.
Permissionless VS Permissioned Blockchains
In blockchain platforms, consensus protocols can be divided into permissionless (Bitcoin, Ethereum) and permissioned (Azure, Ethereum Private).
In permisionless blockchains there is no barrier to entry and use as long as the consensus rules are followed. Anyone can run a node, use mining software/hardware, access a wallet and write data onto and transact within the blockchain provided they follow the rules of the netowrk. Identities are pseudo-anonymous and the real world identities associated with the address will be hard to be mapped.
In a permissioned blockchain, all nodes are pre-authenticated. No one can join the network without the prior permissions from the network owners. It can also be considered as private network. This allows us to use consensus protocols that provide high transaction rate.
There are many consensus protocols available today. We will look at the top 3:
- Proof of Work (PoW)
- Proof of Stake (PoS)
- Proof of Authority (PoA)
PoW and PoS are mostly used in permissionless blockchains and PoA is used in permissioned blockchains.
Proof of Work (PoW)
This was the first consensus protocol and was implemented in the Bitcoin Blockchain.
Proof of work is a piece of data which is difficult (costly, time-consuming) to produce but easy for others to verify and which satisfies certain requirements.
This protocol is used to authenticate transactions and add new transaction blocks to the chain. With PoW, nodes compete with each other to solve a computationally intensive mathematical puzzle which can be easily validated.
There are many ways to create this puzzle. Bitcoin uses the Hashcash function to create the puzzle. The puzzle is finding a random number (nonce), that when added to a block of transactions and hashed (i.e. run a mathematical formula on it), results in a smaller number than the target set by the network. The target set by the network varies basis the number of transactions being done in the network.
The only way to find this magical nonce is through brute force trial and error. So nodes keep guessing the nonce until one of them finds the right one. Given that the puzzle is very computationally intensive it takes time and computational power. This protocol ensures that only a node who has invested enough computational power ( or “work”) can guess the nonce.
This node is called a miner. Miners get incentive for solving the puzzle and adding transaction blocks to the chain. The incentive is derived from miner rewards and the transaction fees associated with the transactions in the block. The peers in the network can trust the miner block as authentic since the miner has invested substantial computational power to solve the puzzle. No rational entity will want to undermine their investment by committing fraudulent transactions.
PoW has some issues though.
- A lot of computational power and electricity is wasted just for the sake of generating random guesses.
- Miners can create mining pools, which can lead to centralization of a specific pool which can conduct a 51% attack (i.e. gaining control over the blockchain).
- By scaling mining operation miners are exponentially more likely to mine the next block. This gives richer miners an unfair advantage.
Proof of Stake (PoS)
Given that there some severe drawbacks to PoW alternate consensus protocols such as Proof-of-Stake (PoS) have been developed.
Proof of Stake protocols achieve consensus by requiring users to stake an amount of their tokens so that they have a chance to get selected to validate a block of transactions, and get an incentive for doing so.
PoS uses a pseudo-random election process to choose a node as the validator of the next block. The selection is based on a combination of factors such as
- the staking age,
- randomization, and
- the node’s wealth
This is done to to ensure that wealthier nodes don’t centralise the validation process.
In PoS, blocks are said to be ‘forged’ rather than mined & validators are forgers rather than miners. When a node gets chosen as a validator, it will ensure that the transactions in the block are valid. It then signs the block and adds it to the chain. The node receives transaction fees that are associated with the transactions in the block as an incentive.
The stake works as a financial demotivator for the validator node and prevents it from approving fraudulent transactions. If the network identifies a fraudulent transaction, the dishonest validator will lose a part of its stake and also the right to participate as a validator in the future. As long as the stake is higher than the reward, the validator will lose more coins than it would gain in case of attempting fraud.
The main advantages of the Proof of Stake algorithm are energy efficiency and security. Given that there is no need to run computational intensive puzzles like PoW it is energy efficient. This means that there is no need to invest in expensive resources and a greater number of nodes can run nodes since it’s easy and affordable. The randomization process also makes the network more decentralized.
One concern with PoS is that someone with enough money to invest exclusively into the destruction of this system can do so by investing only money, as opposed to PoW where they need to invest money, time, expertise, hardware, electricity, etc. Therefore randomization and staking age play as important factors to deter this.
Proof of Authority (PoA)
Proof of Authority (PoA) is a reputation-based consensus protocol. It uses a practical and efficient solution for blockchain networks. This is used specifically in private blockchain network as identity of all participants is known.
In PoS nodes stake their wealth and in PoA nodes stake their reputation in the network. The validating nodes are arbitrarily selected as trustworthy entities.Blocks and transactions are verified by pre-approved participants, who act as moderators of the system.
Since the PoA protocol relies on a limited number of validators it is a highly scalable system. The Proof of Authority model enables companies to maintain their privacy while availing the benefits of blockchain technology.
While PoA is very fast it lets go of the decentralized philosophy underlying blockchains. This consensus protocol is an effort to make centralized systems more efficient.
Consensus protocols help blockchain network to eliminate the need of intermediaries to authenticate transactions. Consensus protocols can be divided into permissionless and permissioned .
Bitcoin PoW was the first successful implementation of permissionless blockchain consensus protocol. PoW utilizes computationally intensive cryptographic puzzles to identify honest nodes. Given that PoW is a highly computationally intensive process alternate protocols such as PoS and PoA have been developed.
In PoS, validators stake their wealth to participate in the validation process and are incentivised for doing so with transaction fees. To prevent centralization additional factors such as randomization and stake age are considered to choose validators.
PoA is used in a permissioned network where validators stake their reputation as their identities are known. This makes it very fast and scalable but more centralised.
As we have seen every consensus protocol has some advantages and disadvantages. Choosing a protocol depends on the use case that we are working on.