What is Consensus  ?

Consensus is the validation mechanism that a blockchain network uses . These are the validation rules by which the network automatically validates a transaction . Consensus is required to maintain the world state of the blockchain network. While deciding which Blockchain platform to choose it is important to understand the consensus mechanism that it deploys because the underlying philosophy and risk to business depends a lot on the chosen consensus mechanism.

The consensus protocols vary basis the nature of the ledger  because depending on whether the identity of nodes are identified or unknown , different algorithms may be deployed to achieve a state of consensus.

Different Types of Consensus

Proof of Work :

In order to change a record on the Blockchain, a peer needs to perform a complex computational task that requires brute computing power. This was the first consensus mechanism that Satoshi Nakamoto devised for the bitcoin network.

Some of the puzzles or proof of work functions could be Integer Square Modulo of a Large Prime, Shamir Signatures, Partial Hash inversion, Hash Sequences, Hokkaido, Cuckoo cycle, Merkle tree based and Guided puzzle protocols.

In short, the method relies on peers investing energy in doing useless work with no connection to the actual business problem or reason why they are on the network. It is akin solving a complex mathematical problem to play football .  If you solve the puzzle , someone pays you to play !

Pros :
  • Mechanism ensures that there will be only one version of truth ie. the next block creation.
  • Successful forking is ensured
Cons :
  • It is energy expensive
  • It can take up to 60 minutes before the next block gets created.
  • Miners typically from countries where energy is cheap hence geographically undemocratic
  • Limited scale
Who Uses :
  • Bitcoin
  • Ethereum Homestead Release (Ethash)

Proof of Stake :

Transactions are validated on the basis of a peer’s reputation or stake in the network.  Consensus is deemed when valid peers agree. In this protocol , the miners are paid in transaction fees alone as no new coins are created.  Unlike proof or work where miners race to create coins , in proof of stake the ‘validator’ invests in coins /assets of the system itself. A random group of signers may be chosen to sign off a transaction. The philosophy underlying proof of stake is distributed consensus.

Pros :
  • Incentivizes good behaviour
Cons :
  • Difficult to succeed on a public network
  • Trust and reputation of participants is the driving factor.
Used By :
  • PPCoin
  • Ethereum Serenity

Proof of Elapsed Time:

The Proof of Elapsed Time consensus protocol is what is used by Intel Sawtooth now IntelLedger (under Linux Hyperledger Foundation) . This consensus algorithm has vouched for a random leader election methodology. The leader can be any of the participating active nodes. The chosen leader finalizes the block . It is an interesting method because the system intelligently ensures that the leader is chosen without manipulation and all participating notes verify the same and also deploy random leader distribution method.

Pros :
  • Randomness of leader selection ensures equal distribution and no chances of polarization
Cons :
  • This is reliant on Intel’s Software Guard Extensions(SGX) .
Used by :
  • IntelLedger

The Byzantine General’s Problem

Before we approach to discuss any of the byzantine models , it is important to understand the Byzantine General’s Problem.

A  group of generals, each commandeering  a  part  of  the  Byzantine army has surrounded an enemy city.  The generals have to agree to a common battle plan to seize the city . However, the generals can communicate via messengers only. The   messengers might be captured by the enemy and the message might never reach the other general. The difficulty  in  the  agreement is that one or  more  generals  might  be  traitors and interested in sabotaging  the  battle  plan.  They are likely to send false messages, distort messages or suppress messages. All loyal generals will act according to the plan. A small number of traitors can upturn the course of events in the loyal generals’ plan.

In the Byzantine general’s problem are embedded to key threats – How does one deal with failure of any one general? What if the identity of a general is forged? When applied to the blockchain network, the answer to the first question lies in the provisioning of a fault tolerance mechanism (recovery mechanism) and the answer to the latter question lies in security mechanism deployed by the Blockchain network can protect itself from Sybil attacks.

PBFT (Practical Byzantine Fault Tolerance)

The PBFT algorithm was the first practical solution to achieving consensus in the face of Byzantine failures. It uses the concept of replicated state machine and voting by replicas for state changes. It also provides several important optimizations, such as signing and encryption of messages exchanged between replicas and clients, reducing the size and number of messages exchanged, for the system to be practical in the face of Byzantine faults.Assuming there are n traitors in the group , there would need to be  “3n+1” replicas , at least “2n+1” communication paths and “n+1” rounds of messages exchanged.

Used by :
  • Hyperledger Fabric V1.

Other variances of the PBFT are SIEVE and Cross Fault Tolerance (XFT)

PBFT Replica Model
PBFT Replica Model

Federated Byzantine Agreement:

Stellar Consensus protocol algorithm uses the concept of quorums and quorum slices. Quorum is a set of nodes sufficient to reach agreement. A quorum slice is a subset of a quorum that can convince one particular node about agreement. An individual node can appear on multiple quorum slices. Stellar introduces quorum slices to allow each individual node to choose a set of nodes within its slice thereby allowing open participation. These quorum slices and quorums are based on real life business relationships between various entities thereby leveraging trust that already exists in business models. To reach global consensus in the entire systems, quorums have to intersect. Overall consensus is reached globally from decisions made by individual nodes.

The Ripple Consensus Algorithm is another example of a federated byzantile agreement model

Used by :
  • Ripple
  • Stellar 
Pros:
  • Tolerant to a failure of minority of nodes
  • Privacy
  • Low Latency of transactions
  • Inherent trust leveraged of the permissioned Blockchain
Cons:
  • Security
  • More Centralized
  • Failure of over 1/3rd of nodes will result in a lack of consensus and transactions fail to get committed

 

Conclusion:

Consensus mechanisms will evolve over time but the choice of algorithm is key to the nature of the Blockchain network’s future roadmap and what services it would like to offer on it. While Hyperledger and Ripple have clearly emerged as permissioned business ledgers , Ethereum has continually toyed with the idea of different consensus algorithms as it evolves . As the world moves towards faster transactions , the success of Blockchain has much to do with the consensus method chosen and the latency involved in addition to security.

References

  1. https://en.wikipedia.org/wiki/Proof-of-work_system
  2. https://www.persistent.com/wp-content/uploads/2017/04/WP-Understanding-Blockchain-Consensus-Models.pdf
  3. https://www.stellar.org/papers/stellar-consensus-protocol.pdf
  4. http://pmg.csail.mit.edu/papers/osdi99.pdf
  5. http://www.gartner.com/document/3426425?ref=AutoReg
  6. https://bytecoin.org/blog/proof-of-stake-proof-of-work-comparison

Leave a Reply