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.
- 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.
- 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.
- Now there are no generals. Everyone can vote.
- To vote, you need to pass a test.
- There is a new test for every voting round.
- The more people want to vote – the more complicated the test becomes.
- If you managed to pass the test and then do the BFT-voting thing – you will be awarded.
- 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.