Silent Guide To Consensus Protocols

Silent Guide To Consensus Protocols

Why Bitcoin is different from other currencies? Why the information that is stored and processed “on-chain” is considered to be “more reliable”?

The answer for these basic questions is usually some kind of curiosity-killing fog of buzzwords. Can we get beyond the fog and get an actual understanding of the answers to these “why”? You are welcomed to find out.

The first key concept to understand the buzzwords is the concept of “Decentralized networks”. Centralized network is a network that has a single access point to control the network. “Decentralized” means that instead of having a single network administration node we have a script that gathers “votes” from entire network and then governs the network decision according to the vote results.

This script is called “consensus algorithm”.

One quick recap – a decentralised network (like Bitcoin blockchain) is a network that operates with a consensus algorithm instead of a central access point.

If you do a bank transaction then bank server decides whether the transaction is legit.

But in a bank there is always an administrator capable to interfere with software algorithm and change database entries and transaction outcomes. Administrators are humans and humans are not secure elements of the system.

A decentralized network has no single human administrator, even though every node of the network has one.

So how exactly does this magical consensus algorithm takes us from a bunch of non-trustworthy network nodes to a system, whose consensus we can trust?

Computer scientists and decision theorists tackled this issue long before Blockchain became a thing. There are many ways to solve this problem but we will focus on the solution that is used for cryptocurrencies.

A common problem of any distributed system is where any part can give wrong output and still behave like it’s properly functioning. And the system needs to figure this out and fix it. There is a name and a cool story explaining algorithm for that kind of problems.

The metaphor is called Byzantine generals’ problemand its fable goes like this:

Once upon a time a Byzantine  army besieged a town.

The Byzantine generals had to decide whether they attack or hold their ground.

The decision has to be coordinated: if the army would attack all together then they would win;  if they held their ground together, well…at least nothing terrible would happen!

But if some generals would attack while other generals were holding their ground then attackers would be overwhelmed and routed, which would be a disaster for the whole empire!

Back in the days there was no such thing as an army HQ where all generals could gather and make the decision. Therefore the generals had to vote by mail with the majority of votes and decide if everyone attacks or not.

Each general would send a mail to all other generals with his decision. Then the generals count the mails for attack or defence and do whichever option won the vote.

Now we spice things up with why exactly this whole enterprise is Byzantine. Byzantine Empire had a very corrupt army. Some of the generals could be bribed to sabotage the voting process and lead the entire army to a disaster.

What is the optimal way for the traitors to sabotage the voting process? Just send “Attack!” mail to one half of the generals and “Hold Position” mail to the other half.

And that is enough to wreak havoc since everyone will have a different picture of the voting.


How do the loyal generals can account for that?
They still have a trick in their sleeve (under their toga?) to increase the number of traitors needed to cause a disruption. What do they do?

The generals decide to modify the mailing vote algorithm. Now they do it this way:

  1. Each general sends his vote to every other general.
  2. All generals count the votes they received from each other and write them down on a spreadsheet where they point out who voted for what.
  3. All generals make a copy of this spreadsheet and send it to each other.
  4. All generals check the spreadsheets they received from each other and check if everyone else has the same picture of voting.
  5. If the voting spreadsheets are consistent then count the votes and come up with a decision.
  6. If the voting spreadsheets are inconsistent – then look who’s votes deviate from one spreadsheet to another. Those are the traitors. Exclude them from the voting count and go to step 1.
  7. When agreed save all the voting documents with their results in a chest that is called “block”. Therefore a sequence of all successful “blocks” lying in a row look like a chain of blocks = blockchain.

Long story short, if there is less than one-third of the traitors then the generals can use this voting algorithm and come up with an agreed decision.


Want to know more about that? Here is an in-deep mathy look at the problem.

This way of counting votes and figuring out who misbehaves is called “Byzantine consensus”. If any system uses this model then it is called “Byzantine fault-tolerant system” or BFT system. It means that this system will provide a correct output if less then (33.333…%+1) of it’s elements are compromised.

Bitcoin is a BFT system… With several tweaks.

Imagine you are Satoshi Nakamoto who designed the world first blockchain: you have implemented Byzantine consensus into your software for Bitcoin network.

First issue is… you have to somehow motivate people to donate their computing power into your network.

So let there be mining! Mining is paying salary to the generals for doing their voting stuff. Except instead of generals we have here wallets of people who own mining farms that do the calculation. Also we could have some owners of mining farms who try to double spend their BTC as the possible traitors. The reward from mining comes in two sorts: a small transaction fee that network users pay when they do transactions and one new BTC that is created every voting cycle and dropped into a wallet of a randomly selected miner.

But with this mining and growing network we will eventually face another problem is inflation. The more people joins the network the higher computing power of the network the faster the voting goes and number of bitcoins growing at an accelerating pace reducing it’s market value.

How do we fix this? Well… Satoshi came up with a two step solution.

  1. The number of Bitcoins (and many other altcoins) ever to be mined is limited. The limit for BTC’s is 21 million. After the last one has been mined – only transaction fees remain.
  2. The complexity of mining scales with the computing power of the system. This complexity scaling is called proof of work.

How this proof of work thing works? Let’s get back to our Byzantine generals metaphor. Because it’s so fun to use.

  1. Now there are no generals. Everyone can vote.
  2. To vote, you need to pass a test.
  3. There is a new test for every voting round.
  4. The more people want to vote – the more complicated the test becomes.
  5. If you managed to pass the test and then do the BFT-voting thing – you will be awarded.
  6. Your award is proportional to how good were you with your test score compared to other people who take the test.

This algorithm is called Byzantine Proof of Work or just PoW for short. Proof of work is a consensus algorithm that is used by Bitcoin, Ethereum and… well… by the majority of altcoins for now.

The major issues with Byzantine Consensus for our first blockchain  are solved with Byzantine PoW. Miners are rewarded for computing power they donate. The more computing power they donate the more they are rewarded and reward vs inflation is dynamically adjusted.  There is only one minor issue remains…

Can you see it?

The rules of PoW consensus algorithm create incentives for an arms race amongst the miners. Having more computing power to solve the PoW test means more rewards for you and less rewards for everyone else who mines. So miners are very incentivized to improve their hardware to solve PoW tests as efficiently as possible. The majority of miners simply can’t afford R&D of new mining hardware and the chosen few owners of ASIC (computers specialized to solve POW tests) data centers remain in business of mining. Which means our decentralized network becomes less decentralized and most of power it uses is wasted to solve pointless puzzles instead of doing something useful. Every big enough PoW blockchain network is either in that state or heading there.

Is there a way to do better? Well… Kind of.

Instead of running the tests we can use old good net worth census.

The rules for this new consensus algorithm are following:

  • No time wasting tests
  • Everyone who is rich enough can vote
  • Everyone wanting to vote attaches his money to his vote mail. This is called “Stake”.
  • Your vote value is proportional to your stake value.
  • If the vote counting finds out that you are a traitor – you lose your stake.

This consensus algorithm is called “Proof of stake” or PoS for short.. So… use that and everyone will leave happy ever after? Well… Not exactly. Proof of stake also has it’s problems. One of them is Proof of Stake system is very vulnerable to traitors trying to overtake it with their votes.

The attempt to solve this issue is yet another consensus algorithm that is called “Delegated Proof of Stake” or dPoS.
The rules for “dPoS” are:

  • Except networth census there is also competence census to vote. It’s not automatically scaling puzzles. Just some bottomline requirements for computing power and bandwidth you need to meet to be accepted for vote.
  • If you don’t meet this requirements – no problem! Just pick a trustworthy guy among the current voters and make a stake that he will vote properly. You will gain some rewards for confirming transactions by your stake.

This is what EOS has implemented and what Ethereum is going to implement. Also this is a consensus algorithm for our upcoming Chain In Law network.

Anyway, if you read up to this point then you have a remarkable attention span and you learned about how Blockchain works and why it is valuable where we need trust.

Subscribe To Our Newsletter

Subscribe To Our Newsletter

Join our mailing list to receive the latest news and updates from our team.

You have Successfully Subscribed!