Consensus algorithms are a crucial element for any blockchain network. They enable the integrity and security of these distributed systems to be maintained. They are even more important in the field of cryptocurrency.
A consensus algorithm is a mechanism by which a blockchain network achieves a unanimous result. Public blockchains are decentralized, distributed and not based on a central authority, so the nodes must agree on the validity of transactions. This is where consensus algorithms come in. They ensure that the rules of the protocol are followed and that all transactions are carried out correctly.
Let’s see how the different types of consent algorithms work.
Consent algorithms: Proof-of-Work (PoW)
The best-known consent algorithm is certainly the Proof of Work (PoW) as it moves the Bitcoin network. This is the first consensus algorithm created. It is also used by Ethereum and many other cryptocurrencies and is the heart of the mining process. About 522 of the existing 3000 cryptocurrencies are based on PoW (and derivatives).
This algorithm is used to confirm transactions and produce new chain blocks. The PoW algorithm encourages the miners to compete with each other in the processing of trades, receiving a reward in return.
At the base of this system, we find complex mathematical problems and the need to simply demonstrate the solution.
PoW mining involves several hashing attempts, so more computing power results in more attempts per second. In other words, miners with a higher hash rate are more likely to find a valid solution for the next block (i.e. the block hash).
The PoW consensus algorithm allows miners to validate a new block and add it to the blockchain only if the distributed nodes in the network reach consensus and agree that the block hash provided by the miner is a valid proof of work.
The Proof of Work (PoW) is certainly a proven mechanism, but many now think that it is not the best and over the years several alternatives have emerged.
Consensus algorithms: Proof-of-Stake (PoS)
The PoS was developed in 2011 as an alternative to the PoW. Although PoS and PoW have common characteristics, they also have some fundamental differences and peculiarities.
The Proof of Stake uses much less energy and is therefore much more environmentally friendly and user-friendly than the Proof of Work.
The larger the stake, the more tokens a user has, the greater the probability that the system is not being violated. The more an individual is exposed to a cryptocurrency, the more likely it is that they will behave correctly because they want to ensure the good performance of the market.
In a nutshell, the Proof of Stake consensus algorithm replaces the PoW mining with a mechanism in which blocks are validated according to the stakes of the participants. Each PoS system can implement the algorithm in different ways but, in general, the blockchain is protected by a pseudo-random election process.
The first to use it was Peercoin. Currently, the Ethereum blockchain is based on a PoW algorithm, but the Casper protocol will eventually be released to pass the network from PoW to PoS trying to increase its scalability.
There are more than 400 cryptocurrencies that rely on PoS, among the most important are Binance Coin, Stellar, Dash, Neo, Cosmos and Ontology. Together they represent less than 5% of the total market cap (about $10 billion).
Consensus algorithms: Delegated Proof of Stake (D-PoS)
The D-PoS (Delegated Proof of Stake) system can be traced back to a kind of technological democracy. Daniel Larimer, CTO of EOS, realized that the mining of Bitcoin is too expensive and invented the D-PoS to solve the problem.
This system represents in fact an evolution of the PoS (Proof of Stake), also developed in order to reduce costs and inefficiency associated with electricity consumption typical of PoW systems.
What are the ingredients for D-POS? A cryptocurrency, a blockchain, a community, a set of computers and some rules.
In the PoS system, the entire network is involved in the confirmation of a transaction. In the D-PoS system, however, this burden does not fall on the entire network, but is borne by a limited number of delegates. These delegates are elected by the entire network with a system of representative democracy of the consensus (consensus that in turn have a weight that is functional to the number of tokens owned by the voters) and provide for the secure validation of every single transaction of the network.
This last point is the most discussed: those who own more tokens have a higher vote compared to those who own less. More tokens, more influence. If one of the delegates for some reason begins to behave incorrectly, the community can at any time move their vote and then dethrone it by electing a new delegate.
Delegated Proof-of-Stake and Proof-of-Stake are different; in a PoS system, each portfolio containing coins is able to participate in the process of transaction validation and consensus-building. With the D-PoS system, each portfolio containing coins is able to vote for representatives. These representatives validate transactions and form consensus, and are paid for their work.
The main doubts about this solution concern the actual decentralisation. Daniel Larimer, a few days ago communicated a solution to the governance of EOS and the question of the purchase of votes by Block Producers (BP), in fact admitting that so far the governance is not decentralized.
To date, these are the most important D-PoS-based cryptocurrencies: BitShares, Steem, EOS, Lisk, Tron, Cardano and Ark. Only 24 cryptocurrencies are based on D-PoS, which represents 2.64% of the market (about $7 billion).
Consensus algorithms: Proof of Activity (PoA)
The concept of Proof of Activity (PoA) was initially introduced in 2012 as an alternative to PoS and is in fact a middle ground between PoW and PoS.
Bitcoin and its PoW predict a continuous increase in the difficulty for miners to grow hashrate with a consequent increase in power consumption.
The PoA tries to take the best of PoS and PoW. The mining process is similar to PoW but when a new block is found the system switches to PoS because the block contains only a header and the reward address of the miner who found it but not the transactions.
Based on the header a random group of validators is generated. As the amount of cryptocurrency held increases, so does the chance of being chosen. When the validators confirm the new block it becomes confirmed and is added to the blockchain.
This mechanism is not very used, the most known cryptocurrencies that use it are Decred (DCR) and Espers (ESP).
Consensus algorithms: Proof of Burn (PoB)
Unlike the PoW, the Proof of Burn (PoB) is a mechanism for consensus without wasting energy.
True computing power is not important to avoid manipulation. In this case, the nodes destroy or burn their own tokens if they want to get the right to generate the next blocks and receive a reward.
A miner sends coins to a non-expendable address (also called an eater address), burning them and then making them disappear from circulation. Once the tokens have been burned, they can no longer be accessed and spent. Since to burn the coins you need to send a transaction, it will be recorded on the blockchain, thus giving proof to the whole network that these tokens have been burned and can no longer be used.
Iain Stewart, the mind behind the Proof of Burn, has provided an interesting analogy: burnt tokens can be considered real mining equipment. This means that the act of burning one’s own tokens can be compared to the purchase of mining equipment.
In PoB every time you decide to destroy a part of your tokens, you acquire a part of the virtual computing power that gives you the ability to validate the blocks. The more tokens you burn, the higher the probability of receiving the reward.
Among the most famous cryptocurrencies that successfully use this mechanism today are SlimCoin, Counterparty, Third Generation Coin and Factom (FCT).
Consensus algorithms: Proof of Elapsed Time (PoET)
The Proof of Elapsed Time (PoET) belongs to the circle of lesser-known consensus algorithms. It works in the following way:
- Each participant in the blockchain network has to wait for a random period of time;
- The first participant to end the wait becomes the leader of the new block.
In order for this to work, it is necessary to verify that the participants actually wait for a period of time in a random way and that this is generated in a range equal for all.
PoET comes from Intel and is based on a special set of CPU instructions called Intel Software Guard Extensions (SGX). SGX allows applications to run trusted code in a secure environment.
There are two key points managed by Intel SGX:
- A specialized hardware component can create a certificate that allows the code to be considered trusted;
- The trusted code runs in a private environment. The rest of the application cannot inspect or interfere with the private and reserved memory space.
The details of the protocol are rather complex, but it can be simplified into two main points.
Joining the network
- A new participant downloads the program to connect to the blockchain;
- At initialization, the program creates a new key pair;
- The participant sends an SGX certificate (which includes the public key of the trusted code that is executed on SGX) to the rest of the network as part of a request to participate.
- The participant gets a timer object signed by the program and waits for the time specified by the timer;
- The participant then obtains a certificate (always signed with the private key of the trusted code) that the timer has finished and forwards it to the rest of the network;
- The network measures how often a given participant becomes a leader in order to detect participants with a possible compromised SGX system.
Potentially, this system is a much more energy-efficient approach than PoW.