How Consensus is Reached on The Blockchain

The Byzantine General’s Problem

The Bitcoin blockchain claims to have solved a significant age-old problem known as the byzantine general’s problem. 

The problem?

“How do you make absolutely sure that multiple entities, each separated by distance, are in absolute agreement before an action is taken?”

Simply put, how do entities that exist separately and independently of one another find a way to ensure complete agreement among one another?

Still don’t get it? here’s a clearer picture.

Imagine you’re a general in the Byzantine army with plans to attack an opposing city. There’re four regiments of your army surrounding the city you want to take down with each regiment led by a general.

But, each one of the regiments is camped far away from the other. 

If the attack on the city from the four regiments surrounding the city on four sides is harmonized, victory is sure. But, if the attack is disorganized, it could mean doom and defeat.

You have decided to attack the next day. But, there is no technology for you to communicate with the other generals. Remember this is a medieval setting sometime around 1600 with means of communication as sound and fire. But, going the sound and fire route would only give your plan away to the opposing army. This is a dilemma.

How do you ensure that the generals leading the 4 regiments agree to attack at the same time in the morning without alerting the enemy?

You could decide to send messengers on horses to each of the 4 generals with the same message and have the four generals send messengers on horses with replies to you.

But, there’s still a problem with this. What happens in a situation where one or more of the horsemen is captured by the enemy and replaced with a messenger from the enemy? There could be misinterpreted and intercepted information. And, how can the generals be sure that the message they get from you is, in fact, genuine? That it has not been intercepted by the enemy? 

Even worse, what if one or two of the generals are traitors and send messages back to you stating that they would attack in the morning when they don’t plan to. How can you be sure that every one of your generals would agree to attack at the same time together? 

This problem which has existed for years is about separate individuals who exist apart from one another being able to trust one another to reach an agreement. 

This is the problem that Bitcoin claims to have solved.

via GIPHY

Now, imagine that each of the four Byzantine generals is a computer on a network. Then, also imagine that the generals are copies of a computer program running a ledger. This ledger records transactions and events in the exact order that they happen via a complex mathematical equation. Every single copy of this ledger is exactly the same. Once an alteration is effected on one copy of the ledger, all other copies of the ledger are updated to match if it is proven to be true via maths. 

Thus, we now have a situation where each copy of the distributed ledger is in agreement with every other copy. An understanding of this is fundamental to grasping how the entire Bitcoin network works. The mind-blowing thing about this technology is that it is the first full consensus distributed ledger ever known to man. With this technology, people from different geographical locations in the world can come to an agreement about an event without involving a third party or an intermediary. 

Whether it’s an order from a general to his troops or an order for a pair of shoes, a distributed ledger confirms via maths whether an event is true and records it permanently.

Now, let’s take a look at some of the practical methods the blockchain uses to reach a consensus.

How Consensus is Reached on the Blockchain

The consensus algorithm is the soul of the blockchain network. It is a way to reach an agreement on the blockchain.

Blockchain is a distributed ledger. This means that if there are 7 mining nodes (computers), each node would have a copy of the blockchain.

Thus, in a situation where there are a set of new transactions, this block would need to be integrated into the blockchain as a part of it. But, there needs to be a system that makes this possible. The first option that comes to mind could be to allow the last node which is node 7 to verify the new block as authentic and add it to its own version of the blockchain which would automatically update the version of other nodes to reflect the added block. But there is a big problem with this solution. What if node 7 is mischievous? What if they are con artists or a threat to the entire system. Giving just one node such immense power is not a wise thing to do. 

via GIPHY

So, what is? 

A consensus algorithm.

Diverse consensus algorithms are used in blockchain today. These consensus algorithms answer the questions – “If a new block is to be added to the blockchain, who will add it?” and “How are we even sure that the transaction is authentic?” 

Based on the permissioned and the permissionless blockchain types, there are different types of existing consensus algorithms. The first and most popular one is “proof of work (POW)”. Bitcoin, for example, uses proof of work where all the nodes in the network spend significant computing power to solve complicated mathematical equations. When a Bitcoin miner successfully solves an equation, a block is added to the bitcoin blockchain and the miner is rewarded with Bitcoin.

Another type of consensus algorithm that’s used in the blockchain is proof of stake (POS). One of the downsides that the proof of work consensus algorithm has is that it requires a lot of computational power to run. Miners have to pool resources together in a mining pool to mine successfully. And, entire mining farms are even dedicated to this end.

In proof of stake, however, there’s next to no computational power involved. The proof of stake works with the amount of cryptocurrency owned by individuals. Here, transactions are verified based on how much stake of that coin an individual has.

In addition to proof of work and proof of stake, there are other consensus algorithms.  Here are several.

  • Delegated Proof-of-Stake
  • Leased Proof-of-Stake
  • Proof of Elapsed Time
  • Practical Byzantine Fault Tolerance
  • Simplified Byzantine Fault Tolerance
  • Delegated Byzantine Fault Tolerance
  • Directed Acyclic Graphs
  • Proof-of-Activity
  • Proof-of-Importance
  • Proof-of-Capacity
  • Proof-of-Burn
  • Proof-of-Weight

Proof of work and proof of stake are the two most popular consensus algorithms. So, let’s take a look at both of them.

Proof of Work

The proof of work is the biggest idea behind Nakamoto’s invention. But, it existed way before Bitcoin. Satoshi only used it in his invention. 

POW was the first consensus algorithm in the blockchain. In this consensus algorithm, miners solve increasingly complicated mathematical equations to verify transactions. This process demands a lot of computational energy. In fact, a recent study records that Bitcoin mining now consumes more electricity than 159 countries including Ireland and most countries in Africa. 

You can take a look at the previous and current Bitcoin energy consumption index here.

Proof of Stake

The proof of stake was introduced as an alternative to the proof of work. 

In proof of stake, people can validate transactions based on how much of that cryptocurrency they own. For instance, if Bitcoin used a proof of stake system, members of the Bitcoin community would be able to mine or validate transactions based on how much Bitcoin they had locked up in the network. This would mean that if a person owned 5% of the Bitcoin network, they would only be able to mine 5% of the Bitcoin network.

Ethereum uses proof of stake to validate transactions. 

QuidaxHQhttp://www.quidax.com
Quidax is an African focused cryptocurrency exchange that provides a simple platform for you to send, receive, store, buy and sell digital currencies. Our aim is to educate you about cryptocurrency. It should not be considered as financial advice. We recommend conducting your own research before deciding to buy, sell or hold any cryptocurrency.