Author: Mohamed Hamza Ghaouri
For the past four years, Finterra has been operating and evolving in the blockchain field. With its in-house experts and engineers, Finterra was able to build its own blockchain platform operating on one of the most used consensus mechanisms in the blockchain field. The galactic blockchain is operating using the proof of work consensus mechanism that we will explain in details in this blog. In addition, we will bring to the discussion other existing consensus mechanisms that might be developed by Finterra to meet the needs of its clients.
In a blockchain network, consensus is needed to decide on the next block to add to the blockchain. In a public blockchain, anyone (any node) can create a block. Each of these blocks will be different from each other. Each block can contain different transactions’ history. The network must therefore choose a single block among these different candidate blocks. This is important to maintain the consistency of the blockchain. Otherwise, the nodes in the network will not have a common blockchain, which affects the goal of a common distributed ledger. In order to select the block, the network selects a node as the leader and the leader node publishes the block it created. This blog presents the different consensus mechanisms used to elect the leader.
Consensus also resolves the “double spending problem”, which is more difficult to resolve without a leader in charge. If users can spend their coins twice, it inflates the overall supply, debasing everyone’s coins and making change unpredictable and worthless. Double spending is a problem for online transactions because digital stocks are very easy to replicate, making it trivial to copy and paste a file or send an email to multiple people.
Proof of Work
Many cryptocurrency networks (Bitcoin, Ethereum, Bitcoin Cash, Litecoin, etc) use a consensus algorithm called Proof of Work (PoW). According to this algorithm, the nodes competing to become the leader must solve a cryptographic puzzle. Whoever solves this puzzle will be chosen as the leader. Other nodes can verify the genuineness of the leader by checking the solution he found for the puzzle.
Fig1. Proof of Work
These puzzles are mathematical equations. They are so difficult that only powerful computers can solve them. No equation is ever the same, which means that once solved, the network knows the transaction is genuine. The puzzle is set in such a way that it takes about 10 minutes to find a solution. Mining nodes have to spend a huge amount of computing power, electricity and related resources to find the solution. Once a node finds the solution, it can publish its block with the solution to the network. The solution to this puzzle can be verified easily, but finding the solution is very difficult. In other words, the winning node provides proof of the work done to its peers, hence the name Proof of Work.
The nodes competing in solving this puzzle are known as mining nodes or miners. These miners are responsible for creating new blocks in Bitcoin. Miners are rewarded with a fixed amount of Bitcoins as a reward for their work. However, the Proof of Work consensus mechanism has several problems:
- High energy use: Proof-of-work mining nodes consume high energy levels. This energy consumption is increasing as more miners join the hunt for bitcoins, while the puzzles get harder and harder.
- Mining centralization: Proof of work involves creating a currency without a single entity in charge. That said, in practice, the system is somewhat centralized, with just three mining pools controlling almost 50% of Bitcoin’s computing power.
Fig2. Mining Pools
The major problem with proof of work is that it is not a fair system, as those with the most powerful and expensive hardware devices will always have the best chance of winning the reward. The more powerful the hardware, or the more hardware devices you have, the more likely you are to solve the puzzle first. Since the miners are competing, each will use more computing power to solve the puzzle and beat the competition. With more computing power, the competition will be tougher as the time required to solve the puzzle will become shorter. The network will then automatically increase the difficulty of the puzzle to keep the time needed to solve the puzzle at around 10 minutes. This exponentially influenced the demand for power.
Fig3. Countries consuming less electricity than the amount consumed by global bitcoin mining
A 2017 study found that Bitcoin mining uses more energy than 159 African countries. While mining of Bitcoin and Bitcoin Cash uses a total of 0.13% of global energy consumption, which ranks combined mining as the 61st highest energy consumer in the world.
Proof of Stake
Proof of Stake was first created in 2012 by two developers called Scott Nadal and Sunny King to solve the problems associated with the most popular algorithm in use – Proof of Work. While they both share the same goal of reaching consensus in the blockchain, the process to reach the goal is quite different. The Proof of Stake concept consists of linking the mining power to the number of coins a person holds rather than the computational power. Here, the miner is limited to mining a percentage of transactions that are reflective of his ownership stake.
In blockchains that use proof of stake, the creator of the block is chosen based on their stake. In this network, a person can mine or validate blocks depending on the number of stakes they hold (in cryptocurrencies). This means that the more stakes he has, the greater his mining power (in fact forging/minting) power. In the PoS system, blocks are forged or minted, not mined. Nodes who validate the transactions and create new blocks in this system are referred to as forgers. To validate transactions and create blocks, forges must first put their coins into “stake.” If they validate a fake transaction, they lose their coins, as well as their rights to participate as a forger in the future.
Once forgers set up their stake, they can participate in the forging process, and because he has staked his own money, they are forced to validate only the correct transactions. The forger is chosen at randomly, depending on the stake. Selection by stake may lead to (undesirable) centralization, as the richest member would have a permanent advantage over the system. However, two different selection methods have been designed:
- Randomized block selection: It uses a formula that uses the lowest hash value in combination with the stake size to predict the next generator.
- Coin age-based selection: It combines randomization with the concept of coinage. Coinage is the product of the number of coins multiplied by the number of days the coin has been held. Coins that have not been spent for 30 days begin competing for the next block.
Proof of Stake is not vulnerable to a “51% attack”. In this consensus mechanism, the attacker would need to obtain 51% of the cryptocurrency to conduct a 51% attack. Although it is difficult and expensive to accumulate 51% of the total coin, a miner with 51% of the coin would not attack a network in which he owns the controlling share. If the value of the cryptocurrency drops, it means that the value of its holdings will drop as well.
Given its advantages, Ethereum, the world’s second most popular cryptocurrency, is in the process of attempting to move from proof of work to proof of stake.
Delegated Proof of Stake (DPoS) consensus
Delegated Proof of Stake (DPoS) consensus algorithm is considered by many to be a more efficient and democratic version of the PoS mechanism. It was developed by Daniel Larimer, in 2014.
A DPoS-based blockchain counts with a voting system in which stakeholders outsource their work to a third party. In other words, stakeholders can vote for a few delegates who will secure the network on their behalf. Delegates can also be called witnesses and are responsible for reaching consensus when generating and validating new blocks. Voting power is proportional to the number of coins each user holds.
Therefore, the DPoS algorithm creates a voting system that directly depends on the reputation of the delegates. If an elected node behaves badly or does not function efficiently, it will be quickly kicked out and replaced by another. Bitshares, Steem, Ark and Lisk are among the cryptocurrency that use the DPoS consensus algorithm.
Proof of Authority
Proof of Authority (PoA) is a reputation-based consensus algorithm specially designed for private blockchains. The term was proposed in 2017 by the co-founder of Ethereum and former CTO of Gavin Wood. Giving value to identities, under PoA, block validators are chosen based on the reputation of their identity. In other words, instead of staking coins (like PoS), they stake their reputation. As importance is given to the reputation of validators; the nodes themselves secure these types of blockchains. Under PoA, blocks are checked by pre-approved nodes (moderators).
The PoA consensus algorithm can be applied in a variety of scenarios and is considered a high value option for logistics applications. This consensus mechanism allows businesses to maintain their privacy while availing the benefits of blockchain technology. Microsoft Azure is another example of a PoA implementation. The Azure platform provides solutions for private networks, with a system that does not require native currency.
Proof of Use
This algorithm is built on reciprocity and therefore adopts a cooperative rather than competitive incentive structure. In this consensus mechanism, members validate the transactions of other members in exchange for others validating theirs. In this way, only members who actually use the network to validate their transactions will have the right to validate the transactions of others, hence the name: Proof of Use. In this model, users and miners share the common goal of verifying their transactions.
Finally, the cryptocurrency space has changed dramatically since the first blockchain transaction on the Bitcoin network. Along with the consensus algorithms discussed, other consensus mechanisms have been proposed (such as Proof of Participation, Proof-of-Activity), with alternative methods to achieve consensus within a blockchain system