Different algorithms, same goal
Unlike networks like PayPal or Visa, decentralized systems do not have a central authority that accepts valid transactions and declines fraudulent ones. While decentralization is a big selling point of cryptocurrencies, it also creates a challenge. A challenge of efficiently replacing this central authority transaction approval by some kind of algorithm.
A consensus algorithm.
Despite all the technical differences, every type of consensus algorithm tries to solve the same problem described previously. No blockchain can work without the algorithm: it would be too easy to attack. Here is how these mechanisms work.
Types of consensus mechanisms
Proof of Work (PoW)
Proof of Work was the first-ever cryptocurrency consensus mechanism. In PoW, the transactions get secured during the mining process (here is the ultimate guide to mining).
Miners have to solve a problem by running different characters through the same hash algorithm over and over again. Once the needed result is achieved, the miner who solved the problem gets rewarded and a new block is generated.
Once the block is published, the transactions in the block cannot be reversed. The only way to reverse them would be to mine alternative block.
This type of attack would require 51% of mining power to be successful, making it practically impossible to do due to the massive hash power of Bitcoin network.
If PoW works so well, then why all the other consensus mechanisms were created? The answer is simple: because PoW is not efficient and doesn’t scale well. Bitcoin miners consume more electricity than certain countries, making it a bad option in the long run. What’s more, if workarounds like Lightning Network are ignored, then PoW-based Bitcoin can still only process about 7 transactions per second – unacceptably slow for a global payment network. Other PoW-based cryptocurrencies experience the same problems as well.
- Uses a lot of energy
- Doesn’t scale well
- Bitcoin, Litecoin & more
Proof of Stake (PoS)
Proof of Stake was designed to tackle the problems plaguing the PoW.
In PoS, there is no mining. All the coins already exist, and block creators get rewarded with transaction fees.
The blocks are approved by randomly selected network participants. The more coins a participant has, the more likely he is to be selected for approval.
Note: in order to be eligible, the participant has to “stake” his coins. By doing this, he basically freezes the coins for as long as he participates in the block approval process. Staking is a simple security measure that is used to make sure that the participant doesn’t approve the false block.
Some of PoS cryptocurrency algorithms also take “coin age” into account when selecting the participant to approve the block. In short, such a system allows participants to validate the block only if they meet two conditions. First, the last time they approved a block is more than or equal to 30 days. Second, the coins must stay in the same wallet for at least 30 days before they get any voting power. Such a system is used by Peercoin.
- Efficient, especially compared to PoW
- Can be less secure than PoW
- Tezos, Dash, NEO & more
Delegated Proof of Stake (DPoS)
DPoS is a modified version of PoS. Instead of approving transactions with their coins themselves, participants vote for representatives (a.k.a witnesses, block producers etc.). 1 coin = 1 vote. Important: voting does not require giving coins away.
The exact number of witnesses varies depending on the cryptocurrency. For example, Lisk has 101 representatives, while Bitshares has a dynamically changed witness count.
In general, the less representatives a DPoS-based crypto has, the faster it is. Take EOS, for instance: with just 21 block producers, it is one of the fastest existing blockchains!
However, the smaller number of block producers also means that the network is more centralized. This is the exact opposite of what blockchains were created for in the first place! DPoS projects have to balance speed and decentralization, which sometimes doesn’t go well.
- Can be extremely fast
- More centralized than PoS
- Cryptocurrency projects have to find a compromise between speed and decentralization.
- Steem, EOS, TRON & more
Proof of Activity
PoA is a hybrid of PoW and PoS that attempts to combine the best features of both algorithms. In Proof of Activity, transaction approval happens in two phases.
In the beginning, blocks are mined just as they would be in PoW. However, once a new block is mined, the system switches to PoA. Several random validators are chosen to sign the block. Just like in PoS, the more coins a user has, the bigger the chance that he/she will be chosen to be a validator. The block is published only after being signed.
While PoA is arguably more secure than PoW and PoS, it also combines their drawbacks. For example, its use of mining means that it still experiences energy efficiency problems. This might be the reason why this mechanism is used by so few cryptocurrencies.
- Theoretically safer than the “pure” PoW or PoS
- Not as efficient as PoS
The Tangle’s consensus mechanism
Unlike many other cryptocurrencies, IOTA uses a variation of DAG (Directed Acyclic Graph) called the Tangle instead of blockchain, which requires a usage of a unique consensus mechanism.
In order to post a transaction in the Tangle, a device that posted it has to approve the two randomly selected previous transactions. Such a system makes the Tangle infinitely scalable, but it also requires a sophisticated consensus algorithm.
Some of the transactions posted and initially approved on the Tangle are false – something that doesn’t happen in blockchain-based networks. Nodes have to determine which transactions exactly are not legitimate.
In order to do so, the Tangle uses a series of mechanisms designed to protect network from spam transactions and solve conflicts:
- Voting weight – each node has its own voting weight (“mana”). Mana is hard to earn and easy to lose. Nodes that accept true transactions earn mana. The more voting weight a node has accumulated, the more influential it becomes.
- Shimmer – an algorithm which makes the node adopt the opinion of its nearest neighbors considering the validity of transactions.
- Spam protection – in order to filter out spam transactions, Tangle uses adaptive PoW optimized for low-power devices. If a device used Tangle previously without sending spam, its PoW problem gets easier.
- Highly scalable
- Still relatively new
Proof of Weight
Proof of Weight is not a single consensus algorithm, but a class of consensus algorithms using Algorand model.
Proof of Weight works in a similar fashion to PoS. However, instead of percentage of tokens owned it takes another value into account when determining how likely a user is to mine the next block.
For example, one of the Proof of Weight types is Proof of Space (also called Proof of Capacity). In order to approve block, a participant has to solve a problem that requires a certain amount of computer memory, but is not processing power-intensive. The more memory a participant has, the more problems he/she can solve, the bigger the chance that he/she will mine the new block.
This system is similar to Proof of Work, but is much more efficient. It also leads to better decentralization of network, because memory is harder to scale than computing power.
Pros & Cons:
- Depends on the exact implementation
- Burstcoin, Chia, SpaceMint
Proof of Burn
Simply explained, Proof of Burn is similar to Proof of Stake, but the “staking” is permanent and irreversible in this case.
In Proof of Burn, the users have to “burn” tokens, either blockchain’s own or other, depending on the cryptocurrency. The “burning” is sending these tokens to a certain address; the coins are irretrievable. The more tokens a user has burned, the bigger his/her chance of approving a block.
Proof of Burn is probably the simplest consensus algorithm out there. The more you pay, the bigger part of network you control – brilliantly simple, isn’t it?
Unfortunately, it has several drawbacks.
PoB requires users to destroy tokens, leading to a fast deflation rate. It makes it impractical to spend the currency – why would you, if it will grow in value due to deflation? What’s more, the same deflation rate means that the network will become unusable after some time.
- Does not require mining
- Leads to a faster token deflation rate, making it impractical
- Slimcoin, TGCoin
Other consensus algorithms
Mechanisms mentioned in this material are the most popular ones. However, there are plenty of other ones that are much less popular and are often used just by one or two projects:
- Proof of Identity
- Proof of Existence
- Proof of Believability
Some other algorithms exist only “on paper” and are not even implemented anywhere.
Because of that, don’t be surprised to discover a new consensus algorithm in a whitepaper of some project. Achieving consensus is a complex problem with many correct solutions.
Which are the most popular consensus algorithms?
Currently, Proof of Work, Proof of Stake and Delegated Proof of Stake. However, due to the bad energy efficiency of PoW, many projects are looking to move to more efficient algorithms, such as PoS. That means that in the future, PoW might lose its popularity.