Understanding blockchain 2. - Consensus
Last week we have started to investigate the main technical components which make up the blockchain with hashing and cryptography. Today we are going to look at the different consensus models, which are a key part of the technology, and define how the new blocks are added to the chain. All of this will lead us to truly understand the technology, and be able to evaluate it from from scratch!
So what are consensus models?
Consensus models are a way to decide how we agree, as members of the network, what are the transactions that we accept, and validate as true. It is a mean to express our common truth on the state of the blockchain, meaning we all except the same data.
Super easy example:
Me, Bob and Alice are members of the blockchain. Our blockchain currently contains apples, oranges and apricots. I would like to add grapes to our blockchain too, so Alice and Bob need to agree, that our new chain will consist of apples, oranges, apricots and grapes. But Alice and Bob do not trust me, so we need to find a common way to agree whether grapes can be added to our chain.
One of the main problems we face on reaching an agreement on the blockchain is the Byzantine Generals Problem: let's suppose there is a large Byzantine army which encircled a city, and they are deciding whether or not to attack. The army has several generals, based all around the city far away from each other. An optimal outcome can only be reached if the big majority of generals decide to attack or to retreat. The problem is worsened by treacherous generals, who may decide to vote against everyone, or even selectively send different responses. Furthermore, the messengers might never make it to their destination, or alter the message along the route.
Putting this into technology, the general become the computers, and their digital communication are the messengers. The consensus model needs to ensure, that the computers reach an agreement whether or not to put transactions on the blockchain, and there are no faulty players intervening. Besides, the messages need to be submitted safely, with no chance for alterations along the way. Hashing technology and public-key cryptography ensure safe communication of the messages. So let's see how we reach an agreement!
We are going to look at the main consensus models in use now, and inspect them from 3 standpoints:
Proof of Work- PoW
Proof of Work is one of the first consensus models in use, it is how Bitcoin, and currently the Ethereum network runs as well. Proof of Work means that a complex computational problem -work- needs to be solved in order to append the the new block. The person who does the computation is called a miner, and gets a reward if he is the first to solve the problem and validate the transaction.
The proof of work solves to a certain extent the Byzantine Generals Problem- the reward can only be reached by substantial amount of work, and the calculation can be checked easily by the other computers to verify the transaction and ensure transparency.
On the downside, proof of work became a very energy consuming, less efficient form of consensus. Miners consume plenty of energy, which has a negative effect on the environment, and makes the system less effective. Because of the high-energy needs plenty of bitcoin miners have gathered into larger farms (see on the graph below who mine the most bitcoins), and currently they mine the majority of blockchain, which makes us question how truly decentralized the system is.
So, on our final rating:
Efficiency - 3/10
Decentralized nature- 6/10
Proof of Stake - PoS
Proof of Stake is a more energy-efficient model, where computers get to validate based on how much can they bet on a certain transaction. Those with the highest stakes validate the block, and get a proportionate amount of reward to their bet. It is a bit similar to voting in a shareholder company- whoever with the largest slice of the cake has the highest authority. Coins are not mined, but minted this way, and proof-of-stake proves to be a more energy-efficient approach. However, the system can lead to 51% attack- malicious party or parties teaming up to have the biggest stake and validate fake transactions. Ethereum is looking into switching from a proof of work to proof of stake validation, and they are currently researching effective ways to control validators and limit the chance of malicious scenarios.
Efficiency - 8/10
Decentralized nature- 6/10
Delegated Byzantine Fault Tolerance- dBFT
In the Byzantine Fault Tolerance systems, we take it naturally into consideration that there are malign actors between our nodes. So in order to make sure, that the right transactions are added to the chain, multiple parties need to agree with the transaction and reach at least 66% consensus. In the delegated system the bookkeepers are the ones who validate the transactions, who are equipped with special equipment, a certain amount of stake and quality internet connection. Transactions are calculated into a hash by a speaker, then sent and validated to multiple bookkeepers. They recheck the hash calculation made by the speaker, and if they get the same outcome they validate the transaction. If the amount of validations reaches 66% the transaction is added to the blockchain. If the speaker is dishonest, and sends a fake message to the parties, then his transaction will not be approved by the majority. If one of the delegates is dishonest, they can not by themselves disarm the transaction. Pretty smart isn't it? Currently the NEO chain runs on this consensus protocol. However, as there need to be special delegates, who hold the power over what gets added to the blockchain, we can not truly see that the network is decentralized. Besides, malicious nodes could possible be more than 66% at certain transactions.
Efficiency - 8/10
Decentralized nature- 5/10
There are a plenty more consensus models, which are spreading in use, and venturing to see whether they could provide a 10-10-10 solution, like:
Proof Of Activity.
Proof Of Burn.
Proof Of Elapsed Time.
Proof Of Capacity
Proof of identity
Proof of importance
Currently consensus models are in their infancy, and there are rapidly developing. At this moment, consensus protocols are like the phone on the left, and they are developing rapidly, to be like to one on the right!
I can not wait to see the new, safe, and effective to use models, which will make sure blockchain technology can be spread all around the world. Let me know your thoughts and comments!