Cryptocurrency consensus algorithms
29.11.2021 | mnalilovich
The main problem with peer-to-peer networks, especially in finance, is the so-called Byzantine generals problem. To solve it, Satoshi Nakamoto invited users to reach a consensus based on complex mathematical calculations. This requires a lot of resources that consume an incredible amount of electricity. It is for this that the first cryptocurrency is now being criticized. However, developers of free funds are constantly on the way to solving this problem - how to reach a legitimate consensus without resorting to specialized equipment that uses a large amount of electricity.Currently, there are dozens of consensus algorithms in the world for distributed ledger networks, but the most popular and effective ones clearly deserve attention. Each of the algorithms has its pros and cons, but PoW is still the most popular
Proof of Work
Proof of Work consensus algorithm is used in many popular cryptocurrencies. This is the approach that Satoshi Nakamoto decided to use, and, as time has shown, he was not mistaken, despite all the shortcomings, PoW remains a reliable way to keep the system running. Popular Ethereum, Litecoin, Monero and a number of others use it as well.
As mentioned earlier, in Proof of Work, miners solve a math problem. This requires a large amount of energy resources to ensure the operation of computing power. Special ASIC miners have been developed for a number of coins, for example, for Bitcoin and Ethereum. And if the second cryptocurrency in terms of capitalization can still be mined on video cards with more than six gigabytes of RAM, and this indicator will only increase further, then it makes sense to mine bitcoin only on ASIC.
One of the features that presents a credible solution to the Byzantine generals problem is the floating complexity of it. This is how it is possible to maintain the network in an efficient state, excluding the possibility of rapid extraction of the entire volume of blocks.
After all transactions are included in the block and sent to the distributed ledger network, the block is checked by other network participants. This process is fast enough and doesn’t require a lot of resources.
One of the advantages of the Proof of Work algorithm is that with the growing popularity of cryptocurrency, when the number of miners will be sufficient, the system becomes resistant to any attacks, and their conduct is impractical, primarily for economic reasons. But, unfortunately, this approach has a few more disadvantages, especially in distributed ledger networks, where ASIC devices are common:
extremely high energy consumption of the crypto-mining network required for the stable operation of the entire system;
a shortage of modern mining devices, due to which, for example, almost 70% of the total hashrate is under the control of the five largest pools, thus, there may be a danger of collusion between the latter to gain full control over the network;
high demand for the latest generation video cards led to a sharp, more than twofold increase in prices in the retail market and even a shortage of older devices that are not very suitable for mining.
To eliminate these shortcomings, developers create other approaches for algorithmic consensus.
Proof of Stake
Proof of Stake — the second most popular consensus algorithm, in which all the work on confirming transactions and including them in a block takes place in some kind of a virtual space, without using a large amount of computing power. Although this will solve the environmental problem of greenhouse gas emissions in the production of electricity for mining, not everything is as smooth as we would like.Although there are several types of Proof of Stake, they all are based on a single principle of mining new coins. Unlike PoW, PoS transactions are confirmed and new blocks are created not by miners, but by validators. The latter stakes a certain number of cryptocurrency coins, after which new valid blocks are searched to be added to the blockchain. When such a block is found, the validator validates it by staking its own coins. Then, after adding the found block, the network participant is rewarded in the proportion in which the stake was made.Thus, the Proof of Stake algorithm is more convenient than the Proof of Work. It does not require a lot of resources, just a little CPU time. However, PoS has one significant drawback: the need to have a certain amount of mined cryptocurrency coins on the wallet that cannot be spent. For example, the new Ethereum protocol, codenamed 2.0, would need to freeze nearly $ 90,000 on the network at the current exchange rate. Although that’s pretty much all the cost of mining, but this makes the blockchain more susceptible to 51% attack - an attacker can buy a large number of coins, and then distribute them to different wallets, making them validators, then changing the ledger or accepting only the blocks he needs. Thus, cryptocurrencies running on the Proof of Stake consensus algorithm are subject to greater centralization. Algorithms with some rules and restrictions have been developed to solve some problems of Proof of Stake.
Nothing at Stake
This is more likely not a subtype of Proof of Stake, but a solution to one of the problems - maintaining any distributed registry chains. In general, the stake made remains with the validator, regardless of whether its block was accepted into the blockchain or not, and whether it’s legal or was created for malicious intent.
This problem was solved in Ethereum 2.0. As usually, the validator stakes a part of its frozen coins, and when the block is found, checked and added, he will receive them back along with a reward. Otherwise, when the block is found to be malicious, the validator will be fined, and in case of an attempt to addthe block in the blockchain without a stake, he will be completely blocked in the network.
Proof of Stake Time
In this case, it is not the number of coins on the account that counts, but the time they are in the wallet. Older addresses with coins being kept there for a long time are more trusted. In some cases, both methods can be combined - the minimum required number of coins and the minimum time spent on the account.
Delegated Proof of Stake
Essentially, Delegated Proof of Stake is not entirely PoS, but works the same way. Token hodlers don’t vote on the validity of the blocks themselves, but vote to elect delegates to do the validation on their behalf. There are generally between 21–100 elected delegates, depending on the network load. If delegates continually miss their blocks or publish invalid transactions, the stakers vote them out and replace them with a better delegate. This approach allows the network to scale up to several million transactions per second. By partially centralizing the creation of blocks, DPoS is able to run orders of magnitude faster than most other consensus algorithms.