What is the best consensus algorithm?

Blockchain Security + blog Z. Oualid today

Background
share close

When building a Blockchain solution for a company or an organization, one of the decisions that the architecture may need to take, is choosing a consensus algorithm. So what is the best consensus algorithm?

The best consensus algorithms that suit a permissioned Blockchain are the PBFT, IBFT as they are faster and consume less energy. However, in the case of a permissionless situation, using consensuses like PoW or PoS is the best choice to ensure the security and reliability of the data.

In this blog post, we are going to explain the difference between the most popular consensus algorithms, and the pros and cons of each one of them that lead to favor one over the other. In addition, we are going to explain in detail how you can choose the best consensus algorithm for your Blockchain in a methodical way. We will also discuss some cyberattacks that can be performed against each consensus ruin or manipulate the Blockchain network. Therefore, if you are interested just keep reading.

The problem of reaching an agreement in the presence of faults or Byzantine consensus is a very old and popular research problem that was first formulated by M. Pease, R. Shostak, and L. Lamport in 1982 and is known by the Byzantine generals problem. However, after Blockchain technology started to rise, many researchers become interested in this problem and start looking for better solutions to it.

Each consensus algorithm should respect the following properties, otherwise, they cannot be used in the blockchain:

  1. Safety:
    • All the process decide the same value
    • The decided value should be proposed by a valid process
    • A process must decide only once
  2. Liveness:
    • A decision should always be taken in the network no matter what

The best consensus algorithms for permissioned Blockchain

As already mentioned in the previous blog posts, Blockchain technology is divided into two main categories, permissioned, and permissionless Blockchains. Therefore, choosing the right consensus algorithm to use in your Blockchain will require knowing what kind of Blockchain are you willing to develop.

In this section of this blog post, we are going to present some of the most popular permissioned Blockchain consensus algorithms. In addition, we are going to see the pros and cons of each one of them and where it is more suitable to use each one of them.

PBFT

PBFT or practical byzantine fault tolerance algorithm is the first proof of the ability to use the Byzantine fault tolerance algorithm in the blockchain context. PBFT is a protocol developed to provide consensus in the presence of Byzantine faults. You can imagine it as a practical way of using the byzantine fault tolerance algorithm in the context of blockchain.

PBFT ensures that transactions are completed in a timely and predictable manner. This is in contrast to the PoW protocol, which requires a large number of confirmations to ensure that a transaction is completed with a high probability. In comparison to PoW, which uses a large amount of energy, PBFT is also energy efficient.

Unfortunately, PBFT isn’t very scalable. This is why it should be used in consortium networks rather than public blockchains. However, it is still significantly quicker than PoW techniques.

IBFT

PBFT works effectively in the classic client-server architecture, but in the case of blockchain, implementing PBFT in its original condition may not be possible. Therefore, many variations of the PBFT algorithms were developed by researchers.

One of the most popular ones is the IBFT (Istanbul byzantine fault tolerance). Here are the main differences between PBFT and IBFT:

  • In IBFT, there is no distinguishing idea of a client. Instead, the proposer may be thought of as a client, and all validators can be thought of as clients.
  • In contrast to the original PBFT, which had static nodes, there is a notion of dynamic validators. In IBFT, however, validators may be voted in and out as needed.
  • In contrast to PBFT, IBFT depends on a more clear structure of view-change (round change) signals, and there is no real idea of checkpoints in IBFT. Each block, on the other hand, might be viewed as a measure of the progress made thus far (the chain height).
  • The garbage collection concept does not exists in IBFT.

However, the IBFT algorithm still not be designed for public blockchain networks as it still requires a certain level of trust between nodes to correctly operate. For a private blockchain with a defined cadence and predictable transaction processing rate, this is the most suitable solution.

The best consensus algorithms for permissionless Blockchain

PoW

In the context of permissionless blockchain networks, the trust between nodes does not exist at all. Therefore, using the previously presented algorithms to get an agreement will not work as a Sybil attack is very likely.

A Sybil attack happens when a malicious node tries to obtain a majority of the network’s influence in order to take control of it.

To solve this issue, the PoW algorithm was invented by Cynthia Dwork and Moni Naor in 1993. However, this concept has become more popular after it was used in Bitcoin by the famous Nakamoto (PoW sometimes is even known by Nakamoto consensus). This consensus is based on solving hashing puzzle by the network nodes to be able to add a block in the ledger. This puzzle-solving process requires a tremendous amount of hashing power to be able to solve it, which helps mitigate the Sybil attack.

For example, in the case of blockchain, the miner should find a nonce (random number), the previous block header hash, and the hash value of all the transactions in the block and then perform a hash function on the three of them combined. Then to solve the puzzle the result of this hash process should be less than the target value specified by the network (which is the puzzle).

If that is the case, the block is then added to the blockchain and the miner is reworded. However, if the resulting has was greater than the target, the nonce is then modified and the hashing process is restarted again.

This Consensus algorithm was also used in many other applications, like DDOS attack remediation and spam defense. The idea is to ask the attacker or the email sender to solve a puzzle that requires a lot of computation and time, which will reduce the amount of time between each email or test and make it inefficient.

PoS

Even if the PoW consensus is considered very secure and has proven its efficiency with the time test, this consensus is going to its end as the complexity of the puzzles is going high to get to the point where mining will not be profitable. Moreover, this concept is suffering from the energy consumption that is also getting high which has a big impact on the environment.

Therefore, to solve those problems, a new concept where proposed called Proof of Stack (PoS). In the PoS algorithm, the concept of mining is not present, and the validators or minters are reworded from the transactions fees and other operations.

To validate the transactions the idea used in this concept is purely economic. To be part of blockchain every node should deposit a certain amount of money in the network. Then the higher value you deposit the better chances you get the ability to validate a block. If a node performs a malicious activity in the network, it will lose a part of its stack (deposit).

Therefore, the more the node stack is higher than what it will get from validating a transaction, the more the blockchain can trust it to correctly perform its job.

However, the 51% attack is still applicable even in the Proof of Stack algorithm. This means if you could get 51% of the whole network stack you will be always chosen for validating the new blocks.

However, this attack is less likely to happen as It is not just extremely expensive to own 51% of a staked cryptocurrency, the staked money serves as security for the ability to be a validator. All staked coins would be lost if a miner attempted to retract a block via a 51 percent assault. This incentivizes miners to act in good faith for the cryptocurrency’s and network’s benefit.

Written by: Z. Oualid

Rate it

About the author
Avatar

Z. Oualid

I am a Cyber Security Expert, I have worked with many companies around the globe to secure their applications and their networks. I am certified OSCP and OSCE which are the most recognized and hard technical certifications in the industry of cybersecurity. I am also a Certifed Ethical hacker (CEH). I hope you enjoy my articles :).


Previous post

Post comments (0)

Leave a reply

Your email address will not be published. Required fields are marked *