The decentralized nature of blockchain technology is the core reason behind the development of the first cryptocurrency, Bitcoin, and subsequently the others. How can distributed systems such as blockchains forgo the authority of third parties and synchronize transactions seamlessly through the network? The answer to this: cryptography and consensus algorithms (consensus mechanisms or consensus protocols) that help sustain blockchain development in such a trustless infrastructure. By using consensus, thousands of nodes scattered around the world can agree on the creation of blocks mathematically.
Consensus algorithms let all the peers of a blockchain network reach a common consensus on the current state of a distributed ledger to enable trust in blockchain networks and between unknown peers in distributed computing environments. Essentially, a consensus protocol ensures that each new block added to the blockchain is the only version of truth agreed upon by all nodes on the blockchain.
Blockchain consensus protocols consist of specific goals such as consensus, collaboration, cooperation, equality for all nodes, and mandatory participation of all nodes in the consensus process. Consensus algorithms, therefore, aim to find a common consensus that is a win for the entire network.
Here we discuss 5 different consensus algorithms and how they work.
Proof-of-Work
Fig.1 Proof of work
Proof-of-Work consensus blockchains (e.g., Bitcoin) require participating nodes or miners to compete, where the first to generate a valid cryptographic hash is selected to propose their block to the ledger. PoW and mining are closely related ideas. The reason PoW is called so is that the blockchain networks require tremendous processing power. Proof-of-work blockchains are secured and verified by virtual miners around the world competing to be the first to solve math puzzles. The winning miner will be able to update the blockchain with the latest verified transaction and will be awarded a predetermined amount of crypto by the network.
Proof-of-work has several advantages, especially for a relatively simple but highly valuable cryptocurrency like Bitcoin. It is a proven and robust way to maintain a secure decentralized blockchain. As the value of cryptocurrencies increases, more miners will join the network, improving its performance and security. However, the amount of processing power involved makes it impractical for any individual or group to interfere with the blockchain. While PoW offers a high degree of decentralization, machine trust, and high security, it comes with a long confirmation time of blocks and is also energy-intensive, resulting in the wastage of hardware and resources.
Proof-of-Stake
Fig.2 Proof of stake
Proof-of-stake (PoS) is a consensus mechanism used by blockchains to achieve distributed consensus where validators explicitly stake capital in the form of crypto. Once Ethereum adopts PoS, users can stake Ether. This staked Ether would serve as collateral that can be discarded if the validator behaves in dishonest or lazy ways. Validators then ensure that the new blocks propagated throughout the network are valid, and possibly create and propagate new blocks themselves.
Proof-of-Stake brings many improvements to Proof-of-Work systems:
- Greater energy efficiency since proof-of-stake does not use much energy.
- Lower barriers to entry reduced hardware requirements. Users do not need expensive hardware to participate in creating block creation.
- Reduced concentration risk since PoS has more nodes protecting the network.
- Low energy requirements that incentivize participation.
- Economic penalties for cheating make 51% attacks exponentially more expensive for attackers compared to that in proof-of-work.
Delegated Proof-of-Stake
Fig.3 Delegated proof of stake
Daniel Larimer developed Delegated Proof of Stake (DPoS) in 2014. There are several cryptocurrency projects that use the DPoS consensus algorithm, including Bitshares, Steem, Ark, and Lisk.
Blockchains based on DPoS entail voting systems in which stakeholder work is outsourced to third parties, enabling them to select several delegates to represent them in the network. During block generation and verification, delegates or witnesses are responsible for coming to a consensus.
The number of coins owned by each user determines their voting rights. The voting system varies from project to project, but each delegate usually puts forward their own proposal. Delegate rewards are generally shared proportionately with their respective voters.
The DPoS algorithm determines who votes based on their reputation. Whenever a node displays poor behavior or is not functioning efficiently, it will be quickly removed and replaced by another. A DPoS blockchain is more scalable than a PoW or PoS blockchain and can process more transactions per second (TPS).
Byzantine Fault Tolerance
Blockchain allows computers and humans to agree on things without having to trust each other. This network of people and computers must be able to trust the rules to be trustworthy. Byzantine Fault Tolerance (BFT) is one of the fundamental properties when creating trustworthy blockchain rules or protocols. As long as two-thirds of the network agrees or reaches an agreement, the system has Byzantine Fault Tolerance (BFT). BFT is a property or feature of a system that allows up to one-third of the nodes to fail or behave maliciously.
All decentralized blockchains run on a consensus protocol or rules that all nodes on the blockchain must follow in order to participate. Proof-of-Work and Proof-of-Stake are Byzantine fault-tolerant by default, so they can withstand up to one-third as many nodes.
Concept of BFT
Fig.4 BFT
The BFT concept comes from the Byzantine general problem, a logical thought experiment in which there are multiple generals who must attack a city. The generals are all in different locations and can only communicate with each other one message at a time.
Everyone must coordinate the same actions for a successful attack or retreat. It is okay to attack everyone and retire. The problem arises when some generals attack, and others retreat. In this case, it is bad for everyone. The twist is that some generals are unfaithful and trying to confuse others.
Proof-of-work, proof-of-stake, proof-of-authority, and other consensus protocols most commonly used in blockchain networks all share some characteristics of BFT. By applying BFT, we can design systems that are not controlled by a single entity and do not depend on any particular trusted party. This is the basis for building decentralized networks.
Ripple Protocol Consensus Algorithm
The Ripple protocol is said to offer an improved transaction platform. It aims to enable fast and cheap decentralized trading. This solves the three most important cryptographic problems: agreement, correctness, and utility.
Correctness
Correctness means that the system distinguishes between correct and fraudulent transactions. Centralized financial systems rely on trust between institutions. It also uses cryptographic signatures to verify the origin of a transaction. Distributed ledgers lack this kind of trust.
Agreement
It refers to the need to maintain a single global truth, i.e., to have only one set of globally recognized transactions. This is a surefire way to a system without double-spending.
Utility
Utilities are all about components of utilities for your system, such as the technical proficiency of users and computing power. Accuracy and consistency are worthless if they are not consistent with usage. For example, it won’t help if it takes months to complete an accurate and satisfying transaction. The usability of the system makes consistency and accuracy applicable. It also reduces the computational power required to do both. The system is only available to all users if all components interact.