Consensus Mechanisms in Blockchain Technology
Centralized Vs Decentralized Systems
Traditional payment systems usually depend on a central authority trust model responsible to verify all transactions. Exchanges of goods or services are managed by a third party that act as an intermediary between a seller and a buyer – with whom there is no relationship of trust – assisting both parties with a transaction, without representing either. Buyers and sellers alike rely on this third party to validates and finalizes transactions. This is common in a bank setup, where customers trust their financial services provider to protect their data and process their transactions.
The presence of a central authority guarantees the correct execution of transactions, but it also introduces two main issues: the concentration of power on a third party that holds the monopoly of transactions and the rise of a single point of failure in the system. To solve these problems, blockchain uses a decentralized network architecture based on the concept of distributed trust. As a shared and distributed ledger that allows access and modifications only to participants (nodes) distributed on a peer-to-peer network, blockchain does not constitute a single centralized instance, but rather divides powers and rights equally among all nodes of the network and thus eliminates the problem of the single point of failure (since even if some node should fail, the functioning of the entire system would not be compromised).
The Byzantine Generals Problem
In 1982, Leslie Lamport, Robert Shostak and Marshall Pease introduced the Byzantine General Problem:
“[A] group of generals of the Byzantine army [are] camped with their troops around an enemy city. Communicating only by messenger, the generals must agree upon a common battle plan. However, one or more of them may be traitors who will try to confuse the others. The problem is to find an algorithm to ensure that the loyal generals will reach agreement.”
The Byzantine Generals Problem is one of the key challenges for blockchain technology. In traditional software architecture, the consensus is hardly a problem due to the existence of a single centralized instance, hence the other nodes only need to be aligned with the server. However, in a in a decentralized peer to peer network such as blockchain, participants needs to arrive at a common decision – or consensus – upon the legitimacy of submitted transactions, data, and the state of the network. This decision making process ensures transactions can be completed without relying on central intermediaries.
However, software defect, a hardware malfunction, corrupted data and malicious attacks could seriously affect or compromise the achievement of consensus upon the legitimacy of submitted transactions. To deal with this issue – the Byzantine Generals Problem – blockchain platforms have established a set of built-in rules to resolve disagreements within a distributed network called Consensus Protocol. Therefore, consensus protocol can tolerate the occurrence of failures and minimize the harm so as not to affect the final consensus result.
What is a consensus protocol?
Consensus mechanisms (also known as consensus protocols or consensus algorithms) is a fault-tolerant process that allow distributed systems to achieve agreement, trust, and security. It is used to verify the legitimacy of submitted transactions and maintain the security of the underlying blockchain, ensuring all nodes in the network agree on a single chain of transaction history, even in cases of adverse influence of malfunctioning and malicious nodes.
In other words, consensus protocol is the tool by which every nodes in the blockchain determine whether transactions and recorded data are correct. It provides a method of review and confirmation of what data should be added to a blockchain's record. Essentially, the consensus protocol makes sure that every new block that is added to the blockchain is the one and only version of the truth that is agreed upon by all the nodes in the blockchain.
Why blockchain uses a consensus mechanism?
In a blockchain, trust between participants is based on the set of rules that everyone follows to verify, validate and add transactions to the blockchain – the consensus mechanism. In other words, a blockchain network reaches consensus through a consensus algorithm.
But why blockchain uses a consensus mechanism? A consensus algorithm renders a system fault-tolerant. It ensures that the protocol rules are being followed and guarantees that all transactions occur in order and in a trustless way – while all agents in the system can agree on a single source of truth, even if some agents fail – preventing double-spending.
The most popular consensus alghorithms
Proof-of-Work and Proof-of-Stake are the most commonly used consensus mechanisms for permissionless blockchains. Other examples of consensus mechanism include Delegated Proof of Stake (DPoS), Proof of Authority (PoA), and Proof of Capacity (PoC).
Proof-of-Work (PoW)
Proof-of-Work is the first blockchain consensus protocol invented and the mechanism that secures Bitcoin, Dogecoin, Litecoin, and numerous other blockchain networks and their cryptocurrencies. The basic concept of PoW is to identify and determine the node that will obtain the right to append a new block to the existing chain by providing the sufficient proof of its effort. In PoW, the nodes that participate in this process – called “miners” – compete with each other to obtain the opportunity of appending the new block to the current chain, trying to solve a computational problem or a cryptographic puzzle. Only the first node to solves the puzzle wins the right to verify the transaction, validate the new block and receive and also rewarded with a predetermined amount of crypto. The process is called “mining”. The peculiarity of the PoW lies in the fact that the difficulty of the cryptographic puzzle – and therefore the necessary computing power required to solve the puzzles – increase as the blockchain expands.
Proof of Stake (PoS)
Proof-of-Stake mechanism is an improved version of PoW, born to reduce the excessive electricity consumption of PoW based systems. Unlike PoW, PoS does not require participants to use computational power to map blocks and meet math requirements, but does require them to stake their assets to participate in the verification process. Unlike miners, participants are called validators or forgers, and their activity is minting or forging. In PoS, the selection of a creator depends on the wealth, which is the number of coins or stake. The forger puts their coins at stake to create a new block and validates the transactions to add a new block. They can also lose their stake and authority for further proceedings, if validator confirms any fraud transaction.
References
- Leslie Lamport, Robert Shostak, Marshall Pease, “The Byzantine Generals Problem”, SRI International.
- M. J. Fischer, “The consensus problem in unreliable distributed systems” in “Foundations of Computation Theory”, Springer, 1983.
- Shijie Zhang, Jong‐Hyouk Lee, Analysis of the main consensus protocols of blockchain, 2020, ICT Express.
- A. A. Monrat et al.: Survey of Blockchain From the Perspectives of Applications, Challenges, and Opportunities.
- Arun, J. S., Cuomo, G., Gaur, N. (2019). Blockchain for Business. Addison Wesley Professional.
- https://decrypt.co/resources/consensus-protocols-what-are-they-guide-how-to-explainer
- https://repository.psau.edu.sa/jspui/retrieve/4eeae047-64d2-4d01-938c-82059aa39e0b/PoSVsPoW.pdf
- https://www.technologyreview.com/2019/02/19/239592/once-hailed-as-unhackable-blockchains-are-now-getting-hacked/