This guide to consensus algorithm takes a look at a common question on what is consensus mechanism and why it’s needed for blockchains.
Introduction to Blockchain
Blockchain technology is widely regarded as a disruptive innovation that could revolutionize the way we do things. In fact, many have compared blockchain to the introduction of the internet back in the 1990s, which was a ground-breaking advancement for humanity.
A litmus test to assess the internet’s revolutionary impact is to ask ourselves: “Can we really survive without the internet?”
The creation of Bitcoin in 2008 spearheaded a technological revolution that threatened the very fabric of our society, in a good way. Bitcoin’s underlying technology, called blockchain, was a radically new system that facilitates trustless, transparent and secure transactions across an open, decentralized network that empowered the masses. Suddenly, intermediaries and entities that had a monopolistic control over our vital systems felt threatened. The advancement of cryptography and computer sciences has converged into a powerful new technology called blockchain, which is set to redefine traditional systems and network.
In order for us to truly understand the potential of the technology, let us uncover a core component of blockchain that allows it to function without a central authority or entity: Consensus Mechanism. This guide will be dedicated to exploring all about consensus mechanisms. Before we move further, let’s take a look at the difference between blockchain and traditional systems to understand the need for consensus mechanisms.
(Read more: Evolution of Cryptocurrency: What is Cryptocurrency?)
Centralized vs Decentralized System
Centralized Systems: In a centralized system, only the central figure has the authority to maintain and update the database. All data flows are controlled and managed by the central authority; they decide what type of data is needed, relevant or is allowed in the database. In maintaining the database, the central entity has complete authority in adding, deleting or updating the data depending on the rules and policies it has set for itself. All other nodes (devices) connected in the network have minimal access to the data, subject to the permission granted by the central authority.
An example of a centralized system is Facebook and Google, which collects a tremendous amount of user data every second in their centralized database.
In simple words, all decisions are made by the central authority.
Decentralized Systems: A public, decentralized system, on the other hand, does not rely on any single authority and is self-regulated. Blockchain technology uses a decentralized network architecture. Anyone can be a node, and every node is a server. Full nodes are equal in hierarchy, meaning there is no node or entity that has more access than another. Participants in the distributed network work collectively in verifying and validating a huge amount of transactions in real-time. The critical questions pertaining to a distributed network would then be;
- How are decisions made in a distributed network?
- How do all participants agree to the current status of the database if there is no central authority?
- How can we confirm that there is only one version of the truth in everyone’s database?
- How can we be sure that transactions in the network are real and authentic?
- How do we ensure that everyone works together to secure the network and no one will act adversely?
In the field of computer science, these issues relating to distributed systems have been widely explored and debated but there were no viable solutions. The advent of blockchain technology provided a solution to solve these critical questions, through the use of consensus mechanisms. Before we look at what a consensus mechanism is, let’s take a deeper look at the issue of distributed computing that didn’t have a solution until blockchain came along.
The Byzantine Generals Problem: Classic Problem of Distributed Computing
A classic problem of a distributed computing system is called the Byzantine Generals Problem.
It can be understood through the analogy of several Byzantine army that is laying siege to an enemy castle. The Byzantine (Roman) army is divided into several battalions that are each controlled by a general. The generals communicate with each other through messengers.
In order to achieve victory, ALL generals must attack the enemy castle in unison. Therefore, a consensus must be achieved by all generals in order for the Byzantine army to attack the enemy castle and win. However, there are a few risks that could prevent victory;
- Not all generals are trustworthy; some may be traitors
- Not all messengers are trustworthy; some may be traitors
- A messenger could be caught by the enemy and replaced by a fake messenger to relay fake news
Here is a visual representation of the problem:
Faced with multiple risks that can compromise the victory, there need to be certain processes that can guarantee:
- Authenticity of Message: The message must be easily verified to ensure it is authentic and hasn’t been altered with or changed
- Unity: There needs to be a collective consensus by all generals to engage in the battle plan
- Fault-Tolerant: A few traitors or bad actors cannot compromise the entire processes
These are the risks and considerations that a distributed computing network must address. The participants in a decentralized network – called nodes – must all agree to a certain set of protocols and rules to achieve consensus, with each node agreeing with the validity of each transaction added to the database. It is not easy, but the advancements of cryptography and computer science – through blockchain technology – has enabled this possibility. The solution is achieved through blockchain’s consensus mechanisms.
(See also: Guide on Identifying Scam Coins)
What is A Consensus Mechanism?
Let’s break down the two components:
Consensus: A general agreement amongst all participants in a group, implying everyone accepts and support the decisions.
Mechanism: Established process made up of defined rules to achieve specific goals
Consensus mechanisms refer to the process of attaining a unified agreement (consensus) on the state (status) of the network in a decentralized way. Also known as consensus algorithm, it facilitates the verification and validation of information being added to the ledger. This ensures that only authentic transactions are recorded on the blockchain.
Consensus mechanism is therefore responsible for securely updating the state of the data across a distributed network.
Rules that have been hard-coded into the protocol ensure that the single source of truth will always be found and agreed upon amongst a global network of computers. These rules secure the entire network, enabling a trustless network without the need for central figures or intermediaries.
Objectives of Consensus Mechanism
Let’s take a look at the different objectives that consensus mechanisms set out to achieve:
- Achieve Unified Agreement: Consensus mechanisms try to solve one of the most complex issues surrounding a distributed system; achieving a unified agreement on which data is true and accurate. Unlike centralized systems that require trust towards the central authority, users do not have to trust anyone in a decentralized system. The protocol rules embedded in the network ensures that the status of the public ledger is always updated with the consensus of the masses.
- Prevent Double-Spending: Consensus mechanisms prevent any users from double-spending, which has been a long-standing problem of digital currencies prior to Bitcoin. Double-spending refers to the possibility of a digital currency being spent twice. The protocol rules embedded in a blockchain’s consensus mechanism ensures that only valid and authentic transactions are included in the public, transparent ledger. As miners expand huge amounts of computational resources to secure transactions (and therefore, the network), it becomes exponentially harder to double-spend or alter transactions.
- Align Economic Incentives: Creating a trustless system that is self-regulating requires aligning the interest of participants in the network. A consensus mechanism does this by incentivizing good behavior and in some cases, punishing bad actors. The first consensus mechanism used by Bitcoin (called Proof-of-Work), incentivized miners by rewarding them Bitcoins for each block of transactions that were successfully secured and validated. Any effort to act against the network (through hacks or double-spending) requires a huge amount of computing and financial resources, which would be better utilized working for the system (as one would be rewarded for their efforts) rather than against the system.
- Fair & Equitable: An important advantage of the decentralization of blockchain is distributive empowerment, where anyone can participate in the network and be on the same footing. The open source nature of public blockchains enables anyone to inspect and verify that the underlying source code is fair to all participants in the network. If you wanted to, you can easily set up a node to become a participant or even a miner. In short, the consensus mechanism ensures that blockchain doesn’t discriminate.
- Fault-Tolerant: In the space of computing, fault-tolerance refers to the property of a distributed system in operating indefinitely even at the face of threats or failures. Consensus mechanisms ensure that blockchains are fault-tolerant and therefore, reliable and consistent.
Comparison of Consensus Algorithms
There are many consensus algorithm models in the cryptocurrency landscape that possess different features and properties to achieve consensus in a distributed manner. The first distributed consensus mechanism is Proof-of-Work (POW), pioneered by Sataoshi Nakamoto when he created Bitcoin in late 2018.
POW requires miners to compete amongst each other to solve mathematical functions using advanced computing hardware. The winning miner must have ‘proof’ that he has done the (mining) ‘work’, which then gives them the rights to add new transactions on the public ledger (blockchain) and earn a reward for their efforts. The higher the computational power of a miner, the greater the probability that he will win the mining race. The collective computing power of participants secures the entire network.
POW laid the foundations for other exciting consensus mechanisms to spring up. Although POW is super effective in generating distributed consensus and securing a decentralized network, the process is energy intensive and environmentally unfriendly. Not only that, scalability is also a huge concern for Bitcoin and blockchain technology. Due to this, there have been numerous attempts to conceive different variations of consensus models that address the weaknesses of Bitcoin’s POW. In fact, the infancy of this technology enables an exciting degree of innovation, with each consensus algorithm possessing different merits and tradeoffs.
Let’s take a look at a comparison of the different consensus mechanisms that are widely used in the cryptocurrency industry:
We’ve compared the features of the 5 most popular consensus mechanisms used in the blockchain space. It is interesting to note that almost all of the consensus models that came after Bitcoin were much more energy efficient, thereby proving that consensus can still be effectively reached without requiring a massive amount of computational and electrical resources in an environmentally-friendly way. There are many other consensus mechanisms out there that are variants of the major categories as shown above.
Stay tuned, we’ll be explaining how these consensus mechanisms work in the future!
(You might also be interested in Guide to Smart Contract: What are Smart Contracts?)
Beneficial Resources To Get You Started
If you’re starting your journey into the complex world of cryptocurrencies, here’s a list of useful resources and guides that will get you on your way:
Trading & Exchange
- Crypto Guide 101: Choosing The Best Cryptocurrency Exchange
- Guide to Bittrex Exchange: How to Trade on Bittrex
- Guide to Binance Exchange: How to Open Binance Account and What You Should Know
- Guide to Etherdelta Exchange: How to Trade on Etherdelta
- Guide To Cryptocurrency Trading Basics: Introduction to Crypto Technical Analysis
- Cryptocurrency Trading: Understanding Cryptocurrency Trading Pairs & How it Works
- Crypto Trading Guide: 4 Common Pitfalls Every Crypto Trader Will Experience
- Guide to Cryptocurrency Wallets: Why Do You Need Wallets?
- Guide to Cryptocurrency Wallets: Opening a Bitcoin Wallet
- Guide to Cryptocurrency Wallets: Opening a MyEtherWallet (MEW)
Get our exclusive e-book which will guide you on the step-by-step process to get started with making money via Cryptocurrency investments!
You can also join our Facebook group at Master The Crypto: Advanced Cryptocurrency Knowledge to ask any questions regarding cryptos!