Blockchain Consensus


Blockchain is a distributed peer-to-peer technology. All nodes in the network have to agree on the state of chain and what are its valid blocks. Since there’s no centralized control, and nodes cannot be trusted, reaching this agreement is not trivial. Every blockchain implementation must therefore define what’s called a consensus algorithm to arrive at an agreement. This is also called consensus protocol.

What are consensus mechanisms?

This is how Wikipedia defines consensus decision-making:

“Consensus decision-making is a group decision-making process in which group members develop, and agree to support a decision in the best interest of the whole. Consensus may be defined professionally as an acceptable resolution, one that can be supported, even if not the “favourite” of each individual. Consensus is defined by Merriam-Webster as, first, general agreement, and second, group solidarity of belief or sentiment.

In simpler terms, consensus is a dynamic way of reaching agreement in a group. While voting just settles for a majority rule without any thought for the feelings and well-being of the minority, a consensus on the other hand makes sure that an agreement is reached which could benefit the entire group as a whole.

From a more idealistic point-of-view, Consensus can be used by a group of people scattered around the world to create a more equal and fair society.

A method by which consensus decision-making is achieved is called “consensus mechanism”.

So now what we have defined what a consensus is, let’s look at what the objectives of a consensus mechanism are (data taken from Wikipedia).

  • Agreement Seeking: A consensus mechanism should bring about as much agreement from the group as possible.
  • Collaborative: All the participants should aim to work together to achieve a result that puts the best interest of the group first.
  • Cooperative: All the participants shouldn’t put their own interests first and work as a team more than individuals.
  • Egalitarian: A group trying to achieve consensus should be as egalitarian as possible. What this basically means that each and every vote has equal weightage. One person’s vote can’t be more important than another’s.
  • Inclusive: As many people as possible should be involved in the consensus process. It shouldn’t be like normal voting where people don’t really feel like voting because they believe that their vote won’t have any weightage in the long run.
  • Participatory: The consensus mechanism should be such that everyone should actively participate in the the overall process.

From the general viewpoint of distributed systems, consensus is a challenge when nodes are either faulty (gone rogue) or unable to communicate reliably. The former is called Byzantine Generals Problem and the latter is called Two Army Problem. A consensus algorithm must therefore be fault tolerant.

How does Bitcoin achieve consensus?

Consensus achieved using Proof-of-Work.

  • New transactions are broadcast to all nodes.
  • Each node collects new transactions into a block.
  • Each node works on finding a difficult proof-of-work for its block.
  • When a node finds a proof-of-work, it broadcasts the block to all nodes.
  • Nodes accept the block only if all transactions in it are valid and not already spent.
  • Nodes express their acceptance of the block by working on creating the next block in the chain, using the hash of the accepted block as the previous hash.
  • Nodes always consider the longest chain to be the correct one and will keep working on extending it.

Consensus is achieved by a simple rule that only the longest fork will survive. In other words, the fork on which most compute power has been expended (PoW) will survive. If two blocks are mined at the same time, there will be a fork. PoW therefore intentionally slows the mining process so that forks don’t happen faster than they are discarded by the network

Possible attacks on blockchain

The idea of any attack is to prevent nodes from reaching consensus or mislead them to a wrong consensus. Here are a few common attacks:

  • 51% Attack – 51% attack refers to an attack on a blockchain – usually bitcoin’s, for which such an attack is still hypothetical – by a group of miners controlling more than 50% of the network’s mining hashrate, or computing power. The attackers would be able to prevent new transactions from gaining confirmations, allowing them to halt payments between some or all users. They would also be able to reverse transactions that were completed while they were in control of the network, meaning they could double-spend coins.
  • Double-Spend – Applicable to cryptocurrencies, this is a case when the same coin is used for multiple transactions.
  • DDoS Attack – Distributed Denial of Service (DDoS) attacks are nothing new, but recent attacks are increasing in severity, complexity, and frequency and have therefore become a mainstream concern for businesses and private customers alike. In Blockchain Sending nodes lots of transactions will prevent them from working on legitimate ones. Distributed DoS is a variant of this.
  • Sybil attack – creating fake identities to take over network consensus (mitigated by mechanisms like Proof-of-Work, Proof-of-Stake, Proof-of-Elapsed-Time, etc.).
  • Eclipse attack – trying to isolate some node by controlling all peers that it connects to, so that e.g. you can lie to it about the best chain.
  • Finney attack – abusing merchants that accept zero-confirmation transactions by mining a block that refunds coins to you, sending the coins, then after the merchant accepts, broadcasting the block (making the unconfirmed transaction invalid).
  • Cryptographic Attack – Quantum computing will bring computing power 100 million times that of conventional computers. This shifts the balance in favour of nodes with such power.
  • Byzantine Attack – A single or few nodes prevent consensus.
  • Time warp attack – messing with the block timestamps to cause the network difficulty to be reduced (recently used against the Verge cryptocurrency).
  • Malleability hacks – changing transactions in a way that changes their hash, but doesn’t make them invalid (e.g. because the signature doesn’t cover the same elements that the transaction hash does).

Recommended: Algorithm Basics: A Beginner’s Guide to Computational Thinking

What are the different types of blockchain consensus algorithms out there?

There are plenty of them and the following are some well-known ones:

Proof of Work (PoW): An expensive computation is required and this can be verified by other nodes. Nodes can remain anonymous and anyone can join. PoW is synonymous with mining. Systems that don’t use PoW can be said to be doing virtual mining.

Proof of Stake (PoS): Stakeholders are those having coins or smart contracts on the blockchain. Only they can participate. Those with high stakes are chosen to validate new blocks. They are rewarded with coins. While coins are “mined” in PoW, they are “minted” in PoS. Blocks may still need to be signed off by other nodes before added to the chain.

Delegated Proof of Stake (DPoS): In PoS, those with large stakes can take control. In DPoS, delegated nodes represent the interests of smaller nodes.

TAPOS:Transaction As Proof Of Stake or TAPOS is a feature of the EOS software. Every transaction in the system is required to have the hash of the recent block header. This does the following:

  • Prevent transaction replay on different chains.
  • Signaling the network that a user and their stake is on a particular fork.

Some another examples of consensus algorithms are Delegated Byzantine Fault Tolerance (dBFT), Practical Byzantine Fault Tolerance (PBFT), Federated Byzantine Agreement (FBA), and proof-of-weight etc.

Conclusion – Without consensus mechanisms we wouldn’t have a Byzantine Fault Tolerant decentralized peer-to-peer system. It is as simple as that. While, proof of work and proof of stake are definitely the more popular choices, there are newer mechanisms coming up every now and then. There is no “perfect” consensus mechanism, and chances are that there never will be, but it is interesting to see these newer cryptocurrencies coming out with their own protocols.

Blockchain Killers

Two of blockchain’s most pressing challenges are:

  1. Scaling – many protocols are incapable of handling a large volume of transactions. And when considering transaction speed, they often pale in comparison to their centralized peers such as Visa and PayPal.
  2. Transaction fees can be costly, especially if there’s a huge backlog of unverified transactions on the network.

A growing number of cryptocurrencies are using DAG instead of blockchain, including IOTA, which refers to its DAG as a ‘tangle’; and Byteball which uses DAG to offer a digital currency, a privacy currency and several more use cases.

Directed Acyclic Graph (DAG) is a graph of nodes with topological ordering and no loops.

Consensus algorithms used by some well-known blockchains

  • Proof of Work used by  Bitcoin, Ethereum, Litecoin, Dogecoin etc.
  • Proof of Stake used by Ethereum (soon), Peercoin, Nxt.
  • Delayed Proof-of-Work used by Komodo
  • Delegated Proof-of-Stake used by BitShares, Steemit, EOS, Lisk, Ark
  • Proof-of-Authority used by POA.Network, Ethereum Kovan testnet, VeChain
  • Proof-of-Weight used by Algorand
  • Proof of Elapsed Time used by HyperLedger Sawtooth
  • Chinese platform NEO uses Delegated BFT

Suggested: Quantum-Inspired Algorithms: Unleashing Computational Innovation

How Blockchain technology could promote a secure IoT

The most recent DDoS attacks have been observed to hijack connected devices such as webcams, baby phones, routers, vacuum robots, etc. to launch their attacks.

The number of devices remotely controllable via apps is growing exponentially and the Internet of Things (IoT) is expected to easily surpass 20 billion connected devices by the end of 2020.

Today’s IoT ecosystem follows a centralized paradigm, which relies on a central server to identify and authenticate individual devices. This allows malicious devices to launch attacks against other equipment by means of a brute force Telnet attack or other attack vectors.

Blockchain technology could enable the creation of IoT networks that are peer-to-peer (P2P) and trust-less; a setting which removes the need for devices to trust each other and with no centralized, single point of failure.

A Blockchain, being a universally distributed ledger, ensures the security of all transactions through the cryptographic work of certain participants called nodes which validate those transactions, in return for rewards in the form of cryptocurrencies such as Bitcoin. This removes the need for a central authority to authenticate a device to interact with another device and also authenticate a user to login to a device.

Hi, I'm Harshvardhan Mishra. Tech enthusiast and IT professional with a B.Tech in IT, PG Diploma in IoT from CDAC, and 6 years of industry experience. Founder of HVM Smart Solutions, blending technology for real-world solutions. As a passionate technical author, I simplify complex concepts for diverse audiences. Let's connect and explore the tech world together! If you want to help support me on my journey, consider sharing my articles, or Buy me a Coffee! Thank you for reading my blog! Happy learning! Linkedin

Leave a Reply

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

Back To Top