Naveen Saraswat

@naveen_saraswat

Consensus Mechanisms — As Detailed and Concise as possible!

Blockchain, known to be a shared, immutable ledger for recording the history of transactions is expected to disrupt and correct almost every industry out there. The surge in the number of dApps and companies adopting enterprise blockchain is a testament to this belief. One important thing to notice about blockchain is that it makes the trust intrinsic in whatever network it’s applied.

Decision makers, from Walmart to Google, and from IBM to the hottest startups around you, everyone is going big on Blockchain. And that’s not without any profound reason, you can have a look at how Walmart decreased the food traceability time from 18 hours to 2 minutes using Blockchain here.

However, for creating the impact that it’s expected to make, a lot of factors have to be weighed in, and Consensus is one of the most important among them. The Consensus mechanism of any blockchain is responsible to maintain the sanctity of data that is recorded over the blockchain while being resilient enough to combat instances of failures of nodes, partitioning of the network, message delays, messages reaching out-of-order and corrupted messages. In this work, we will be discussing the importance of Consensus mechanism for Blockchain platforms, what should a reliable and robust consensus mechanism look like, and then discuss the consensus mechanisms in use presently.

What makes a Great Consensus Mechanism?

With plethora of Blockchain platforms already around, and new ones popping up day-in and day-out, it’s important to understand what determines whether a consensus mechanism is good enough or not:

Safety: A consensus mechanism can be termed “safe” if all the nodes are able to produce output that is valid according to the rules of protocol.

Participatory: The consensus mechanism should be such that every node is actively participating in the process of updating the database on blockchain.

Inclusive: The inclusion of all the nodes must be there in the decision-making. No node should feel low about the value or impact of their vote.

Egalitarian: A great consensus mechanism must be egalitarian in every possible way. What this means is, that every vote must have equal value and weightage for the network to reach consensus.

“A Blockchain-Powered platform is as secure and robust as it’s consensus model.”

A poor Consensus Mechanism leads to:

A poor consensus mechanism exposes the Blockchain network to a number of undesirable issues. Have a look at some of them:

Blockchain Forks: A poor and not-rugged consensus mechanism opens the blockchain to a number of vulnerabilities, and possibility of a Blockchain Fork is one of them. Blockchain forks are known to wreak havoc over the blockchain network as it leads to completely inconsistent view of data recorded on the blockchain thereby forcing applications to behave in an unpredictable manner.

Blockchain Fork, in simple terms, is basically a change to the protocol in which a group of participants/nodes diverge from the original version of blockchain. There are two types of forks in the blockchain platforms so far:

1. Hard Fork: Say a group of nodes go rogue, or has a potential disagreement with the blockchain (or with something that is being introduced to the original blockchain). Now, the said group will decide to go their own way eventually leading to a “forked” version of this blockchain. Rest of the nodes will now have the option to update their systems in order to work with this blockchain or stick to the original one. The important thing here is that the nodes running with previous blockchain are not allowed in the new one. A hard fork essentially leads to creation of two separate blockchains.

2. Soft Fork: This is somewhat an optional upgrade to the original blockchain and this too leads to two different blockchains. However, it’s totally upto the nodes whether they want to upgrade their systems or not for using the soft fork.

Some of the forks from the Bitcoin blockchain are:

a. Bitcoin XT: August 2015

b. Bitcoin Classic: February 2016

c. Bitcoin Unlimited: May 2017

d. Bitcoin Cash: August 2017

e. Bitcoin Gold: October 2017

f. SegWit2x: a proposed fork that has been suspended.

Consensus Failure: Certain consensus mechanisms may not be able to help the nodes reach a consensus at all. Say a consensus mechanism requires a super-majority vote from a percentage of nodes failing which the Blockchain stands the risk of Consensus Failure. Common reasons which can cause the Consensus failure are as follows:

a. Node or Network Failures.

b. Non-Compliant Nodes.

c. Valid honest nodes failing to make a decision.

Poor Performance: While this one is totally dependent upon the very design of the consensus mechanism, it is a crucial point regarding the success of any blockchain platform. The consensus Conditions could be dynamic where other nodes have turned malicious or a network partition may delay messages that are exchanged between nodes which may manifest as high-latency in the applicatons based on that blockchain.

Putting some light on Consensus Attacks in Bitcoin’s Blockchain:

Bitcoin’s consensus mechanism is one of the most secure and immutable at the moment. However, there are various vulnerabilities that it is still exposed to, at least theoretically. The consensus mechanism depends on whether or not a majority of miners are acting honestly out of self-interest. So, if a group of miners is able to attain a significant amount of mining power, they can easily attack the consensus mechanism to disrupt the security and availability of the blockchain, which by the way, can be true for any blockchain that uses Proof-Of-Work as it’s consensus mechanism.

As notorious and dangerous as a consensus attack would look in the bitcoin’s blockchain, the “dishonest” miners cannot steal bitcoins, spend bitcoins without any signatures or change any blocks from past, all they can affect are the most recent blocks and perhaps cause denial-of-service leading to cause disruptions in the creation of future blocks.

Speaking of the “51 % attack”, one doesn’t actually need a 51% hashing power to compromise the blockchain. As a matter of fact, this type of attack can be carried out with a smaller percentage of hashing power. 51% is assumed to be a threshold beyond which such an attack has a 100% chance of succeeding when it comes to the bitcoin’s blockchain.

Let’s have a look at how the most popular consensus mechanisms of today work:

Proof-Of-Work

PoW, perhaps the most widely-used consensus algorithm at the moment, criticised as “killer-of-planet” pertaining to the enormous amounts of computational energy it requires, as a matter of fact, dates back to 1999 when it the term was coined by Markus Jakobsson and Ari Juels.

It’s first application of a very early version was in giving value to the shell money of Solomon Islands.As far as cryptocurrency goes, Bitcoin is the first Proof-of-work cryptocurrency. HashCash too, is a proof-of-work algorithm aimed at eradicating the denial-of-service cases.

However, Bitcoin’s proof-of-work is considered to be much more legitimate because of it’s use to prevent double-spending using a decentralized P2P protocol for tracking transfer of coins, unlike Hashcash’s hardware trusted computing function based on RPoW.

Bitcoin’s PoW has the USP of being able to ensure that every block that is mined on the blockchain is the one and only version of the truth while successfully keeping the mercenaries unable to fork the blockchain successfully.

However, as we move ahead in our quest to discover faster, more-decentralized and environmentally sustainable methods of Value-Transfer, alternatives to PoW have emerged.

Here are some of them discussed briefly:

Proof-Of-Stake

The notion that Ethereum is migrating to PoS probably makes it the hottest girl on the floor. And that’s not entirely without reason, 51% attacks or Blockchain Forks are much more expensive with this consensus mechanism.

Not only this, the lower amount of computational-energy that is needed with this mechanism gives it an upper-hand to the PoW consensus mechanism.

A notable feature of this consensus algorithm, the wannabe “minter” or “validator” is needed to invest in creating his stake by buying coins on the network rather than spending shitload of money over GPUs to solve useless computations as in the case of PoW.

Although, PoS too, comes with it’s own shortcomings. One of the most popular of them is the “Nothing at Stake” problem. To put it in simple words, a validator or a signer can create and sign two blocks simultaneously in order to claim transaction-fees for both of them.

To explain it with enhances, who’s to stop a participant in the network to behave suspiciously if He/She has “Nothing-At-Stake”.

Delegated Proof-Of-Stake.

DPoS, introduced by Daniel Larimer is unique in the sense that the token-holders or validators aren’t the one’s who directly vote or create a block, they vote in order to elect delegates who then will do the validation on their behalf.

Larimer wanted to devise a consensus algorithm which will be capable of transaction speeds as high as 100,000 per second, which is way more than any of the PoW or PoS based counterparts manage to run at.

The system is also capable of flushing out bad actors while recognising and rewarding valuable participants at the same time.

The top 100 witnesses elected by the users are paid for their services. Also, the top 20 among these witnesses are entitled to a salary along with a pool of backup witnesses at the disposal of network since a lot many individuals strive to be made a witness.

Now, the credibility or effective “vote” of a person is determined by the number of tokens they hold. Not only this, the voters have the authority to vote-out the witnesses if their work is not creating value for the network or behave as a bad-actor since the voting us always ongoing.

One more thing that is interesting about DPoS is, miners are collaborating (not competing as in the case of PoW or PoS) to make blocks which makes DPoS to run orders of larger sizes faster than other consensus mechanisms.

Transactions as Proof-Of-Stake

Transaction as Proof-Of-Stake is used by EOS. It prevent the transaction-replay problem on different chains. This is how this works, and how TaPoS solves it:

The malicious participant first locks in the profits from a certain block, broadcasts a longer secret blockchain in order to invalidate the original transaction. The selfish-mining attacks use this too as it’s more effective and easier than acquiring 51% of the hashing power.

Now, say every transaction contains the hash of a recent block and the blockchain makes it a point of giving transaction’s proof of stake only in the blockchains that build off of that block. This will make it practically impossible for any bad actor to build secret chains.

Leased Proof-Of-Stake

In the traditional consensus mechanisms, Nodes and inviduals with low balances find it near to impossible in finding the staking or mining a new block because of their extremely low hashrates. This further translates into the big majority of holders with low balances not having a say in running the node, and a small number of large players taking the shots. However, it’s no secret that “more-the-merrier” is true when it comes to the security of any blockchain-based network. This is where Lpos comes in.

Lpos facilitates the small players to take part in the network with the feature of leasing their balances to the staking nodes. What it does is, increases the weight of “staking node” ultimately increasing their chances of being able to mine a block. That being said, the profit thus generated is shared in an initially agreed-upon proportion.

Delegated Byzantine Fault Tolerance (dBFT)

Another interesting consensus algorithm that brings scalability and low-cost transactions to the table. The Byzantine fault tolerance is related to the reliability of fault-tolerant computer system.

The network participants choose delegates based on a number of factors. These delegates have to elect a speaker amongst themselves who is supposed to evaluate the various transactions and hence add blocks to the current blockchain. The delegates need to double-check the calculations and claims made by the speaker, and approve or disapprove based on their matching. To approve addition of any block, a certain percent of delegates must give their approval.

The interesting variants of dBFT in different cases of speaker and delegates in different combinations being malicious indeed make it a promising consensus mechanism.

Wrapping-It-Up!

There are a lot of other Consensus Mechanisms being talked-about. However, I’ll leave their analysis for a different time. However, you can have a look at these in-depth analyses of other consensus mechanisms if you want:

Check out our White-labelled Decentralized Exchange Solution

If you liked this blog, don’t forget to read other blogs of mine at https://medium.com/sodio-tech.

Your feedback has an incredibly profound impact on products and content that we develop at Sodio Tech, don’t hold back!

More by Naveen Saraswat

Topics of interest

More Related Stories