What is Consensus Algorithm in Blockchain and Why Do We Need it?
Blockchains are not decentralized by default, which is where consensus protocols come into play. This post discusses how consensus algorithms work and gives examples of some of the most popular ones.
The properties and features certain blockchains have solely hinge upon the problems they are to solve. This simple idea has an infinite load of underlying content related to popular delusions among people, reviews on blockchain classifications and so on.
In order to avoid repetition in this article, we will delve deeper into the most popular consensus mechanisms. Understanding of how they work and namely when and why do you need one or another mechanism will help you break the myths about blockchain and get a practical understanding of the technology. Before we identify each consensus mechanism, it’s better to understand why do we actually need them.
Blockchain is only a means for organizing data
Let’s consider blockchain point by point:
- A new approach to organizing database
- Stores history of every single change that has ever occurred
- Arranges data in the chain of blocks, rather than processing the last state of the accounting system
As you can see, there’s no any reference to decentralization here. Because blockchain itself doesn’t organize trustless relationships in a decentralized environment. Blockchain only provides a very flexible and secure way of arranging data, that in combination with the consensus mechanism, may allow for a successful operation of a fully or partially decentralized system.
Conclusion: Blockchain technology allows you to build a block-structured database that stores the whole history of changes, but whenever you need to organize trustless relationships in a decentralized environment — there is no way around the consensus mechanism.
So, what does consensus mechanism do?
It’s quite simple. Consensus is a way of coming to an agreement. A decentralized system without a common consensus will fall into pieces in a second. It doesn’t even matter whether participants of the system trust each other particularly or do not trust at all. All the same, they need to agree on certain principles of functioning that would be common for all of them. And this is the direct role of a consensus mechanism.
For the moment, there are several various consensus mechanisms. Before we review the most popular, it is important to understand two things:
- So far, there is no one universal method of reaching consensus
- At the same time, there is no good or bad algorithm — it’s only about the requirements of the accounting systems.
Proof of Work (PoW)
Explanation of Proof-of-Work mechanism is in its name. In order to participate in transaction validation, you should publicly proof that you did a certain amount work. This rule prevents an attack on the system when an adversary creates fake voters. The more work you’ve done — the more chances you have to propose the next block (and obtain the reward). But, it’s important to note, that it’s only the chances, but not a general rule.
If you have one lottery ticket and your friend — 10, it doesn’t mean that you’re doomed to defeat.
POW is considered the easiest and at the same time the most sustainable algorithm (in the context of complete decentralization and anonymity).
Saw is always more reliable than the mill.
That’s how you can describe POW by the side of other consensus mechanisms. It’s not that fast, but firm.
In order to increase the winning chances, users aim to increase the amount of work they do, (Speaking of Bitcoin, they need better mining equipment) which usually leads to some kind of ‘arms race’.
Proof of stake (PoS)
This mechanism is very similar to voting among shareholders in a company — whoever holds the largest slice of the pie gets the highest authority. So, it’s not about the number of voices but the weight of them.
Users who hold a lot of coins on stake have high incentive to make sure that consensus between the nodes of the system is achieved in the right way. Above that, it’s of their concern to keep the network safe from all kinds of attacks, failures, fake transaction confirmations and other kinds of swindlery.
The advantage of the algorithm is a simple motivation for validators’ honesty. Disadvantage — it’s actually hard to build the PoS-based system that considers all possible malicious scenarios of behavior.
In PoW, a 51% attack is theoretically possible, though it doesn’t really make a lot of sense for the attackers. While the PoS system will have serious problems if more than half of stakeholders collude with each other. Apparently, the design of PoS system is much more complex than that of PoW.
Until now, there’s no time-proven and guaranteed resistant system based on PoS in the anonymous environment. They're all at the development stage
Delegated Proof of Stake (DPoS)
The main idea with DPoS is that each user can vote for the delegates — those who approve transactions. In general, the identities of delegates are initially known. They can be some respected people known for their achievements in the sphere, who have accounts in the system for which regular people vote.
It is important to note that system considers the weight of votes. The more native currency (stake) a particular voter has — the more he/she can influence the ‘election’.
Due to the limited amount of validators, the DPoS algorithm provides for much higher validation capacity and faster transaction confirmation. The best example is BitShares. Having DPoS implemented, it is so far the only decentralized system that is able to compete against centralized services such as Visa or MasterCard. In this way, DPoS allows reaching a compromise between capacity and decentralization.
Proof of Importance (PoI)
PoI is kind of an extended version of PoS. Apart from considering the amount of coins participants possess, the algorithm recognizes the behavioral component between them. (For example, where, when and how often the coins are transferred) In such manner, you can eliminate the situation when only the rich become richer. Among the most popular implementations of PoI there’s NEM (New Economy Movement).
Multisignature/Byzantine Fault Tolerance (BFT)
These algorithms are primarily used for achieving consensus among a limited group of people (In case of Multisignature, it’s a question of few participants, in BFT — dozens). BFT usually makes sense when all the parties in the process know each other, that said, they are apt to change very rarely. A good example is voting of housemates on the subject of collectively-organized repairs.
Federated Byzantine Agreement (FBA)
FBA was initially applied in Ripple and later improved in Stellar. The mechanism permits reaching consensus among a large number of participants, the total number of whom is not known.
Each participant chooses to trust a limited (by number) group of other participants, forming a circle of trust in which they easily reach consensus. Eventually, you get a number of trusted circles that somehow or another overlap, making it possible to achieve an overall consensus in the whole network.
You can draw a parallel with how seeds of revolution are sowed in the society. People spread ‘the word’ from mouth to mouth. As a result, the society becomes enthusiastic with a general idea because the chats overlap with each other.
We have examined the most popular consensus mechanisms, which were tested in the real-world uses. Though, it’s important to remember that none of them is absolutely perfect and there is no any universal method of reaching consensus in a decentralized or partially decentralized environment. Each has its pros and cons. That’s why algorithms are being continuously updated and complemented with various add-ins. Sometimes the approaches from even different consensuses mix together forming hybrids.
As you can see, the creativity field for developers is quite broad. And that’s an exceptionally good news. Because blockchain without consensus is similar to a Smartphone without the Internet connection — kind of makes sense, but barely.