What is Consensus Algorithm?

Advanced

8 mins read April 26, 2021

The blockchain network is the foundation on which all cryptocurrencies and DeFi projects are set. The blockchain helps to attain transparency and advanced security and minimise fraudulent practices. The foundation of the blockchain is so impressive that some people are advocating that the blockchain network be integrated with other institutional structures to solve existing problems or limitations.

It is no surprise that its popularity has increased over the years. But what makes blockchain technology so successful and able to attain all of this and more? No one governs most blockchains, but how can it maintain its decentralised nature and enforce contracts on its users? The answer to this is known as consensus algorithms.

What is a consensus algorithm?

A consensus algorithm is designed on a computer system so that members of a group can reach a joint agreement on issues that concern the group. The blockchain consensus algorithm allows its users to reach a consensus on the blockchain network's decisions. The decentralised nature of the blockchain prevents a single authority from having sole control over the system and connects millions of users from across the globe. These users have no reason to trust each other, but the consensus algorithm of the blockchain can be trusted to protect their interests.

It also enables users to coordinate the structure and the protocol of the network to reach a decision that would benefit the entire group. It aims to solve the consensus problem resulting from multiple unreliable nodes (individuals spread across the globe) that run the blockchain. It understands that some systems may be down during the decision-making period, making it challenging to communicate.

In this regard, consensus algorithms ensure that the blockchain is fault-tolerant. That is, the system can still operate when one or more of its components are down. For instance, it runs on the assumption that only a portion of the nodes would be active. The active nodes are given the power to make a decision, and a consensus is reached when at least 51% of available nodes come to an agreement. For this to happen without a hitch, each peer maintains a copy of the ledger. This is why all transactions and updates are automatically reflected in all users’ computers. In this way, the blockchain ensures that all new blocks added to its network are the community's specific type.

Consensus algorithms aren't limited to the blockchain network. It also powers some technological instruments like Google's Page Rank, drones, clock synchronisation, and many other examples.

What makes for a good consensus algorithm?

The blockchain consensus protocol is designed to attain certain objectives to maintain the decentralised nature and functionalities of the blockchain. These objectives include:

  • Fusion/ agreement: The consensus protocol of a blockchain is designed to ensure that there is a cooperative agreement among users.
  • Equality and fairness: The consensus mechanisms employed in a blockchain ensures that anyone can participate in the network. This is why blockchains are considered to be open-source software. Anyone can participate in the network using the same basics.
  • Security from fraudulent practices: The consensus algorithms prevent "double spending,” a fraudulent practice, by ensuring that all transactions recorded on the ledger are verified and valid.
  • Fault tolerance: The blockchain consensus algorithm is designed to be fault-tolerant and reliable even in the face of computer threats and failure.
  • Align objectives of the group: The consensus protocol aims to align its users' objectives and ensure they can operate without a hitch in a trustless, decentralized system. Users who are active participants and help towards achieving the objectives may be rewarded with incentives (tokens). At the same time, those who flaunt the regulations are punished accordingly

The consensus protocol of the blockchain ensures that all data is accurate and that the public ledger is up-to-date. There are different variations of blockchain consensus algorithms in existence. However, it is crucial for these blockchains to generate a valid result and be inclusive in their operations and voting. The votes are given equal value to promote good participation among voters.

These properties ensure the smooth running of a blockchain. However, if a blockchain isn't correctly developed, it may result in blockchain forks when modifications need to be made. A poorly-developed blockchain may also result in a poor user experience when it cannot handle the functionalities expected of it. This may be because a poorly developed blockchain algorithm would not be fault-tolerant. When systems are down, they won't be able to achieve the desired accurate result. Therefore the consensus algorithms of a blockchain network must be appropriately designed to enable it to attain its set functions.

Consensus algorithms and cryptocurrencies

Cryptocurrencies are built on blockchain technology. The transactions of users are recorded on a ledger, the blockchain; in order to ensure there is no duplicity, each computer node (every user) has an identical copy of the ledger. This would prevent conflicting information on the blockchain network.

The consensus protocol is designed to prevent users from spending each other's coins. The first consensus algorithm was proposed by Satoshi Nakamoto, the creator of Bitcoin. He proposed an algorithm, the Proof of Work, to ensure that the regulations are met and that there is coordination among its thousands of users.

The consensus algorithm ensures that only validated blocks are introduced to the network. It enforces a punishment on miners who try to manipulate this process, and it ensures that the objectives of the digital currency are aligned by providing a reward for mining bitcoin. All users of cryptocurrencies can easily access this information from their computer nodes to ensure that there is no manipulation.

Read also: Bitcoin Halving

Types of Consensus Algorithms

Proof of Work (PoW)

Proof of work is the first of all blockchain algorithms. It was developed by Satoshi Nakamoto, the creator of Bitcoin. It was implemented in the creation of Bitcoin, although earlier developers may have toyed around with the idea before then. The Proof of work is a consensus algorithm that determines how new blocks are added to the blockchain.

Proof of work determines the protocol on which blocks are validated. This means that a miner needs to meet some set of conditions to introduce a new block. Therefore, miners have to tweak the data inputted into the hash function until they can attain one that produces the right hash. Miners (validators) are required to hash certain data sets and proffer a solution to them before introducing a new block.

Miners often need to set up a workspace full of special hashing hardware (ASICs) to stand a chance of generating a valid block. This is because they are in active competition with other miners. However, these machines cost a lot of money and require a lot of power to run them.

The network verifies that a miner has created a valid block by running the data through the hash function to validate the claims. If your claims are validated, you get the reward for mining; if not, the network would reject it, and you would receive no incentive.

The proof of work algorithm is used to run cryptocurrencies like Bitcoin, Zcash, Litecoin, and Monero. The proof of work has been used to facilitate multiple channel payment; it's on the fast track to being used in other applications such as health, financial institutions, governance, and more.

Proof of Stake (PoS)

The proof of stake was proposed as an alternative to the proof of work system. It was designed to eradicate the need for a computer (specialist) in introducing a new block to the blockchain. It would also remove the need for the complex hardware and machinery used in the mining process, reducing energy consumption. This would make it easier for individuals who are not computer specialists to participate in the mining process from their personal computer.

Proof of stake doesn't require hardware, but it functions with the use of cryptocurrencies. The miners, in this case, serve as investors; however, you need to hold a minimum amount of funds before you can participate in this process. The funds you hold would be locked up in a crypto wallet (staking), and they cannot be withdrawn until the staking process is completed. A pool of investors would need to agree on the next block to be added to the blockchain.

Theoretically, proof of stake seems to be a more eco-friendly and user-friendly alternative to proof of work. However, it is yet to be proven that it can stand as an alternative to PoW and meet all the applications. Cryptocurrencies that have applied the proof of stake update include Ethereum 2.0, Dash, Reddcoin, and PivX. The Ethereum blockchain operated the proof of work before it shifted to the proof of stake mechanism.

In order to enable the proof of stake to accomplish its functionalities, two variations were developed, which include:

§  Delegated Proof of Stake (DPoS)

Leased Proof of Stake (LPoS)

The leased proof of stake operates on the Waves platform. For the LPoS, users lease their funds to full nodes to generate a new block. The percentage of transaction fees you receive is dependent on how large the lease is.

Proof of Activity (PoA)

The Proof of Activity blockchain consensus model combines the features of both Proof of Work and Proof of Stake algorithms. The miners compete to solve the mathematical puzzle using electricity and power. However, in this case, the block only contains information on the reward and identity of the block winner.

Stakeholders who act as validators are appointed to validate the block. If the block checks out, it is activated as a complete block. The validators then receive a share of the divided block reward. Real-life applications of Proof of Activity include Decred coins and Espers.

Proof of Burn (PoB)

Byzantine Fault Tolerance (BFT)

The Byzantine Fault Tolerance (BFT) is built towards correcting the Byzantine Generals Problem, also called the Byzantine fault. The Byzantine fault is a situation in which users have to come to a consensus on the best way to solve a significant breakdown of the system. There are two variations to the BFT used in the Blockchain protocol, and they are:

Practical Byzantine Fault Tolerance (PBFT)

PBFT solves the problem of Byzantine fault by allowing select users to confirm the validation of messages used through systematic computation. The information is then passed down to other nodes to deliberate on it. This allows for digital democracy on the consensus mechanism. Ripple, Stellar, and Hyperledger are famous use cases of this consensus algorithm.

Delegated Byzantine Fault Tolerance (DBFT) 

The Delegated Byzantine Fault Tolerance was introduced by NEO and allowed the NEO token holders to vote.  However, voting rights were independent of the amount invested. This means that anyone who meets the basic requirements: the right equipment, verified identity, and 1000 Gas can function as a delegate. The delegates are then selected at random to become speakers. The DBFS is also referred to as the Ethereum of China.

Proof of Capacity (PoC)

The Proof of Capacity (PoC) stores the solution for its mathematical puzzles in hard disks or similar storage devices. It follows a systematic process known as plotting. In which, users can use these hard disks when producing blocks and the fastest users to solve the mathematical puzzle stand a better chance of creating a valid block. Cryptocurrencies that rely on the proof of capacity algorithm include Spacemint and Burst coin.

There are many more consensus algorithms, including Proof of Identity, Proof of Importance Proof of Elapsed Time (PoET), Proof of Authority and Direct Acyclic Graph (DAG). These algorithms are usually either an improvement of a current algorithm or a new way to verify on a blockchain.

Final note

Consensus algorithms are fundamental in running a distributed system as conflicts may result in disputes. These hard forks may affect the smooth running of the systems. Consensus algorithms are an essential tool that facilitates decision making while ensuring that the system remains decentralised. The consensus protocol sets the rules that would guide this process, incentives, sanctions, and disputes.

Disclaimer: This article is meant to provide general guidance and understanding of cryptocurrency and the Blockchain network. It’s not an exhaustive list and should not be taken as financial advice. Yellow Card Academy is not responsible for your investment decisions.

Crypto scoop

Sign up for our weekly newsletter

Stay informed with the latest updates to buy, sell, and store your crypto on the go.

phone

Download the Yellow Card app

Start trading crypto with ease

Get the Yellow Card app to buy, sell, and store your crypto on the go.