The consensus algorithm is the rules by which blocks are generated in the blockchain. Depending on the algorithm used, some blockchains have a mining mechanism for extracting new coins, while others have staking, some networks work faster, but are subject to centralization, others are slower, but it is difficult for unscrupulous network participants to take control of them. Therefore, it is important to understand the differences between PoW, PoS, PoA and other consensus algorithms in order to correctly assess the prospects of a blockchain project. We have made a detailed guide on the most popular consensus algorithms presented in advanced blockchain projects.
What is the consensus algorithm in the blockchain
Let's start with the basics. Blockchain is a decentralized network of blocks containing various data. In cryptocurrencies, these blocks store information about all operations within the network. All blocks are written to the network sequentially one after another and are connected in a chain. In this case, each block contains information about all the previous blocks. You can't delete, edit or change anything from such a network retroactively - after all, you would have to rewrite the entire chain from the very beginning.
In the blockchain, a special built-in mechanism called the consensus algorithm is engaged in checking operations and confirming that they are recorded correctly.
The blockchain consensus algorithm is a method by which the decentralized nodes of the network reach agreement (or consensus) on the current state of data in all blocks. A node is any computer connected to the blockchain that verifies and confirms transactions, and stores a copy of the blockchain.
The consensus algorithm guarantees compliance with the protocol rules and the reliability of all transactions. In other words, it is responsible for ensuring that all nodes of the network agree with the addition of a new block to it. In this way, the consensus algorithm maintains the integrity and security of the network.
At the same time, it is important to understand the difference between the consensus algorithm and the protocol:
- The protocol is the rules of the blockchain, according to which the network nodes interact, transaction data is transmitted and block mining is confirmed.
- The consensus algorithm is a mechanism for checking the implementation of the rules: whether the balances and signatures are correct, whether all transactions are correct.
For example, Bitcoin and Ethereum are protocols, and Proof-of-Work and Proof-of-Stake are consensus algorithms.
There are many variants of consensus algorithms. Let's take a closer look at the most popular among the best blockchain projects.
Proof-of-Work (PoW)
Proof-of-Work is a consensus algorithm that was first introduced in the network of the first Bitcoin cryptocurrency.
A little history. The concept was first introduced in 1993, and in 1997, Adam Back, one of the contenders for the role of Satoshi Nakamoto, developed the Hashcash algorithm based on it, which was supposed to protect email from spam. In 2004, Hal Finney, another candidate for the role of Satoshi, suggested using PoW for electronic currencies. And in 2008, this algorithm was used by Satoshi Nakamoto himself in his cryptocurrency bitcoin. Later, Proof-of-Work (PoW) was also used in the blockchain of other early cryptocurrencies: Litecoin, Ethereum (before the launch of the update that launched the multi-year transition to PoS), Bitcoin Cash, Bitcoin Gold, Dash, Dogecoin, Monero and Zcash.
The essence of PoW is as follows: network nodes (miners), in order to confirm transactions and not allow other participants to spend the same coins twice, must solve complex mathematical problems (hash functions). The node that first found the solution receives a reward — new coins of the network. At the same time, the complexity of mining protects the network from possible threats in the form of DDoS attacks, 51% attacks (when attackers gain control over transaction confirmation and block creation) and other types of attacks. If the tasks were too easy, attackers could easily break into the network.
PoW was a breakthrough for its time and allowed the launch of the first cryptocurrencies. It makes the network decentralized and resistant to hacking.So, Bitcoin is almost impossible to crack — you would need a quantum computer and huge resources to gain control over the network.
But with the popularization of cryptocurrencies and their mass introduction, the disadvantages of this algorithm began to become more noticeable. Moreover, now these vulnerabilities hinder and limit the development of early cryptocurrency projects.
Among the main disadvantages of PoW:
- Mining is too energy-consuming. Many nodes in the network compete with each other, constantly performing complex calculations. But in fact, most of them work in vain, since the reward goes to only one node. Bitcoin mining consumes more energy than countries such as Switzerland or Greece;
Users have to pay miners fees for verifying transactions. The busier the network, the higher the commissions in it. For small transactions, the commissions may even exceed the amount of the transfer itself; - Low speed and poor scalability. PoW - blockchains are sorely lacking in speed. For example, the maximum throughput of the Bitcoin network is only 7-10 transactions per second. Such low indicators are not suitable for mass and everyday use;
- Centralization of miners who unite in pools. This reduces the security of the network, increases the complexity of mining and contributes to the growth of commissions.
Proof-of-Stake (PoS)
Proof-of-Stake is a consensus algorithm presented at the Bitcointalk forum in 2011 as an alternative to PoW. The purpose of this algorithm is to try to correct the main disadvantages of PoW, in particular, low speed and weak scalability of the network.
In 2012, this algorithm was first integrated into the blockchain of the PPCoin cryptocurrency (currently PeerCoin). Today, such blockchains as Cardano, Binance Chain, IOTA, Nano, TRON, TomoChain and Ziliqa work on the basis of PoS. And in December 2020, after several years of development, the Ethereum network also began the transition from PoW to PoS as part of the launch of the Ethereum 2.0 version.
There is no mining in PoS. Instead of solving mathematical problems, new coins are mined through staking-a mechanism that allows adding new blocks by proving ownership of the cryptocurrency of this network, which was previously also called forging. The nodes of such a network are called validators,and their balance is called a steak. The more coins a node has in its wallet, the more chances it has to confirm a new block and get a reward.
Thus, staking can be compared with a bank deposit. The more coins are frozen in the network, the higher the reward. For validators, this is an opportunity to earn passive income.
But staking, as well as mining, requires expenses and technical knowledge. To become a validator, you need to have the minimum required number of coins. For example, in Ethereum 2.0, this is 32 ETH (about $41,000 at the current exchange rate). These coins must be kept locked in the wallet for at least several months. You will also need to configure the equipment and keep it constantly connected to the network.
The main advantages of the PoS algorithm:
- Low power consumption compared to PoW algorithms;
- No special equipment is needed (miners);
- High speed and scalability. For example, the speed of the TRON network is 2,000 transactions per second;
- Low commissions;
- Participation in the development of the project. Validators should take part in voting on the future development of the project.
The main drawback of the PoS algorithm is the threat of centralization. The validators with the most coins will eventually control most of the network. Therefore, in recent years, blockchain developers have introduced new versions of the PoS algorithm, which will be discussed below.
Proof-of-Authority (PoA)
Proof-of-Authority is a consensus algorithm that takes into account the "merits" and the rating of validators. It is considered an effective mechanism for private blockchains, was first conceptualized in 2014 by one of the creators of Ethereum, Gavin Wood, and has been used for several years in the Microsoft Azure cloud platform, which includes more than 200 products and services.
PoA is a kind of attempt to combine PoW and PoS. There is no mining at all, and, therefore, there is no race of computing equipment, as well as huge energy costs. In PoA, validators do not use the power of the equipment or the number of coins to generate blocks, but their own reputation.
Thus, a fixed number of validators who were selected by network participants or project developers are responsible for the network performance. This approach guarantees high transaction processing speed and good scalability. At the same time, validators are interested in ensuring that their work is honest and transparent, otherwise they will lose their status and reputation as a reliable network participant.
The main disadvantage of PoA is the possibility of excessive centralization and the lack of motivation of users who do not receive remuneration for mining or staking. Moreover, within the framework of classical PoA, an ordinary user cannot influence the operation of the blockchain network in any way, since this is done by trusted nodes, usually belonging to the same company.
Crypto projects using PoA are well aware of the disadvantages of consensus and try to circumvent them in various ways. For example, the developers of the UMI cryptocurrency, in an attempt to get rid of the restrictions of PoA, created their own variation of this algorithm. The main differences between the PoA mechanism in UMI and the classic PoA are decentralization and staking.
Decentralization is achieved by dividing the nodes into two key groups:
- Master nodes - create blocks and confirm transactions. This is the UMI team and the main partners of the project;
- Validator nodes - ensure the network performance, check the correctness of blocks and monitor the operation of master nodes. Anyone can run such a node.
The reward for maintaining the UMI network is available through staking. But since there is no staking in the classic PoA, the mechanism is implemented in UMI using a smart contract. A smart contract is a special program on the blockchain that automatically performs specified actions when pre-specified conditions are reached. The smart contract in UMI ensures the fulfillment of all conditions, the correct operation of the staking and accrues rewards 24/7.
Here are other features of UMI staking that were achieved thanks to the smart contract:
- There is no need to freeze coins during staking. They can be withdrawn at any time without losing interest;
- Coins are credited immediately to the wallet of users who have full control over their assets;
- There are no requirements for a minimum stake — a user with any balance can start staking and generate new coins;
- Security and accessibility for everyone. The user does not need to start the node, configure the equipment and network parameters, understand the technical nuances. It is enough just to connect to one of the existing staking pools in a couple of clicks (today there are two of them: ROY Club and ISP Club) or create your own. At the same time, the pool creators do not have access to user assets, only the users themselves have it;
- Staking is provided with liquidity in bitcoin. In a glass on a crypto exchange SIGEN.pro More than $12 million has already been raised to support the UMI course. These funds support the exchange rate of the coin and do not allow it to fall below $0.95, while nothing prevents the UMI rate from growing.
Thanks to this, the UMI ecosystem has become a unique decentralized environment for the crypto market, allowing any participant to transfer coins inside the network for free and multiply them with the help of staking, which brings up to 40% of new coins per month.
At the end of 2020, the test version of the updated UMI network took the 4th place in terms of speed among other blockchains, and the average time for generating a new block in the latest version is only 1 second. Soon these changes will be integrated into the main network. All this makes UMI the optimal blockchain environment available for truly mass use. So, already now the speed of the UMI blockchain is 4,369 operations per second, after the upcoming updates it should increase to 65,535, and potentially it can reach 1 million tps and higher.
Delegated Proof-of-Stake (DPoS)
Delegated Proof-of-Stake (DPoS) is a type of PoS algorithm created by developer Dan Larimer in 2014. DPoS was conceived as an alternative to PoW and PoS. Its purpose is to deprive validators of the possibility of centralization. Among the well-known blockchains on DPoS: EOS, Steemit and Tezos.
DPoS is a more democratic version of Proof-of-Stake. The main difference between the two algorithms is that in DPoS, coin holders (witnesses) transfer their right to approve operations and receive a reward, that is, they delegate their vote to a pre-selected validator (delegate).
Any user of the network can become a delegate. But at any time, witnesses can withdraw their vote — this way allows you to avoid excessive centralization and seizure of the network by unscrupulous participants.
Delegates are united in a special pool that has the right to make changes to a number of network parameters: the time of extraction of new blocks, their size, and so on. But delegates cannot cancel transactions or perform false operations. Therefore, the witnesses still have power over the network.
The main advantages of the DPoS algorithm are high speed and greater scaling. There are significantly fewer nodes running on the network than in PoW or PoS, which allows you to quickly create new blocks.
Among the disadvantages: with low activity of network participants, the threat of centralization remains, and it is also possible to conduct DDoS attacks and unfair behavior of delegates, which can cause network failures.
Leased Proof-of-Stake (LPoS)
Leased Proof-of-Stake is another version of the PoS algorithm developed specifically for the Waves blockchain.
LPoS is designed to solve the problem of "property qualification" in the classic PoS, in which users with insufficient balance can not participate in staking and earn new coins. This turns into centralization.
As part of the LPoS algorithm, any network participant can transfer their coins to validators, receiving a share of the profit in exchange. At the same time, the coins remain in the user's wallet, but they cannot be used, transferred or exchanged. The rental can be canceled at any time. It is profitable for validators to rent coins, as this increases their stake, and, consequently, the chance of a reward.
This approach allows you to earn coins even with a small stake, but makes the network subject to centralization: validators can rent so many coins that they can control the network.
Proof-of-Importance (PoI)
Proof-of-Importance is another variation of the PoS algorithm developed for the NEM blockchain in 2015.
Unlike classic staking, in PoI, it is important not only the number of coins blocked in the steak, but also the user's activity (the number of transactions), and the time of his stay in the network. The more active the user is and the higher his reputation in the community, the greater his income from staking. This encourages participants not to store coins in wallets, but to actively use them.
In NEM, the mechanism for encouraging a staker (paying coins) is called harvesting. This is an algorithm for accounting for user activity and its balance. The accrued coins are first transferred to the user's passive wallet, and after the accumulation of "merits" are transferred to his active account. One of the conditions for starting the harvesting is a minimum steak of 10,000 XEM (≈ $2,400).
Proof-of-Space (PoSpace)
Proof-of-Space (also called Proof-of-Capacity, PoC) is an algorithm that uses hard disk space to confirm a block, and not the computing power of a computer. This is an unusual concept that promises high speed and democracy, but it has not received large-scale distribution among crypto projects. For example, such little-known projects as Burstcoin and SpaceMint work on this algorithm.
The miner reserves a certain space on the hard disk for confirming blocks. First, sets of possible solutions to mathematical problems are generated in the hard disk, then mining itself takes place. The miner does not need to look for a solution to the mining problem — it already exists in the memory of one of the hard drives. The larger the disk memory, the more solutions can be stored there and the more chances that this particular miner will find a solution.
The advantages of PoC are low energy consumption and the ability to mine from any device, even from a smartphone.
Proof-of-Burn (PoB)
Proof-of-Burn (proof of burning, PoB) is an algorithm that is an alternative to the classic PoW and PoS.
The miner sends coins to a special address, to which it is impossible to find private keys. This means that you can't spend coins from this wallet either - they are burned. As a reward for this, the miner creates a new block and receives a reward for it in the form of new coins of the network. The more coins you burn, the higher the chances of getting a block reward.
Advantages of the algorithm: low power consumption and cost-effectiveness, because you do not need to spend money on expensive mining equipment. In addition, if there is a continuing or growing demand, the algorithm can contribute to an increase in the value of the remaining coins - because their number is constantly decreasing.
The main drawback of PoB is that it is suitable only for mature projects in which the main issue of coins has already been completed, and they have something to burn. Therefore, the algorithm is not popular, but it is still sometimes used, for example, in the blockchain Counterpart (XCP).
Proof-of-Elapsed-Time (PoET)
Proof-of-Elapsed-Time (proof of elapsed time, PoET) is a consensus algorithm from Intel. It is considered one of the most balanced and perfect consensus algorithms and is used mainly by corporate blockchains, for example, Hyperledger.
The principle of operation of PoET resembles a lottery. In each node of the network, a random waiting time is generated for a specific block - it is different each time. After that, the node is "frozen" (goes into the waiting period). The block is extracted by the node that has the shortest block waiting time. A special SGX system makes sure that all this happens really randomly.
The main disadvantage of PoET is that it requires the mandatory use of an Intel Software Guard Extension processor that supports SGX.
In conclusion
As the crypto market matures and blockchain technologies develop, new, more advanced consensus algorithms will appear and the current ones will be improved. They will offer the most optimal solutions to eliminate vulnerabilities and shortcomings of existing blockchain networks.
It is likely that in the future, more and more blockchain projects such as UMI will begin to appear, where elements of different mechanisms for achieving consensus and receiving remuneration are successfully combined. This approach will allow you to take only the best of the mechanisms available on the market, minimizing vulnerabilities and increasing the efficiency of the network.