When we start talking about securing Blockchain technology, people always think about Bitcoin. However, Bitcoin is only one implementation of one of the Blockchain types. Therefore, to be able to ...
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:
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 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.
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:
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.
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.
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.
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
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 :).
In the intricate landscape of cybersecurity, understanding the concept of malware artifacts is paramount for safeguarding digital environments. All malwares has their own digitale signature that is represented by their [...]