What is a consensus mechanism?
There’s some kind of magic in decentralised systems. Mostly though, the magic lies in the way these publicly-shared ledgers verify and authenticate information in real-time, without the reliance on a central administrator to do so.
Think about applying for a driver’s license – chances are you’d need to visit your local office and provide them with your personal information in the form of something tangible like an ID document and certifiable proof the document is real. And depending on where you live, this information is typically manually uploaded by an administrator. But in the digital and decentralised world, things work more efficiently – or at least, they should.
For public blockchains to operate as self-regulating, transparent systems on a global scale without any single authority, they require contributions from hundreds of thousands of network participants. These participants are essential to the network because they verify and authenticate all the activities that take place on the blockchain.
These systems need a reliable, fair and secure mechanism to ensure that all participants are in agreement and, therefore, transactions are genuine. This is called a consensus mechanism.
A consensus mechanism is a set of rules governing the contributions from various participants on that blockchain. There are a number of different consensus mechanism algorithms and they operate on different principles. For example, Bitcoin makes use of Proof-of-Work (PoW), while the highly-anticipated Ethereum upgrade (Ethereum 2.0) is shifting from PoW to Proof-of-Stake (PoS).
But first things first, let’s take a look at the more popular consensus mechanisms and understand how they work.
Proof-of-work
PoW is the grandfather of all consensus mechanisms. It’s a mechanism that validates and records transactions on the blockchain by making computer nodes compete to generate cryptographic hashes that satisfy a network-determined level of complexity. Essentially, they use brute computing power to solve the problems. In order to maintain security, the complexity level is set high enough to deter anyone from attacking the network, as it would require such a significant amount of computing power that it would be too expensive to operate the required hardware.
Once the complex mathematical problem has been solved, the block will have been verified and transactions can then be added to it. In return for the use of computational resources, miners receive a reward for their work in the form of crypto. This is how bitcoin is created – as a reward given to miners for solving the mathematical equations.
Scalability is arguably one of the biggest hurdles that cryptocurrencies such as bitcoin and ether face. In order for the network to effectively handle more users and increased functionality, its processing power needs to improve significantly. And that’s the problem with PoW – in its current form, it’s inefficient. Mining with a PoW system requires expensive hardware that consumes a large amount of power. This is why Bitcoin draws criticism for not being environmentally friendly enough.
Additionally, because of this, mining has become more exclusionary. Only a few years ago, it was possible for individuals to profitably mine bitcoin with a standard computer. But as we’ve seen in recent years, mining of the largest cryptocurrencies has become dependent on a cluster of large mining pools, exacerbated by the race to have the fastest and most sophisticated mining hardware. This poses a risk in terms of unintentionally centralising the network. If all the power is left in the hands of a select few, theoretically, it’d be easier for them to act maliciously, undermining the entire ecosystem.
Think of it like mining for gold. It started as a miner with a pickaxe and panhandle, working as hard as he could and getting rewarded in shiny gold. Then people with more money cottoned on and built big tools, pneumatic drills and so on, and soon there was no gold left for the little guy.
It’s because of these very issues that Ethereum is engaging in the mammoth feat of shifting their entire blockchain from a PoW to a PoS mechanism.
What is Proof-of-Stake (PoS)?
PoS was designed as a more efficient alternative to PoW, allowing miners to rely on far less computational power to perform their duties.
In a PoS consensus mechanism, the node that records each transaction is chosen by an algorithm. The algorithm assesses how much cryptocurrency the node’s owner holds and the larger the amount, the more likely they’ll be chosen to process and record the transaction. In other words, the node with more “stake” in the crypto is more likely to be chosen. In this way, it’s possible to dramatically decrease the complexity of the cryptographic work, leading to massive throughput gains for the whole network. As each node must stake its own currency to participate, it would remain far too expensive for anyone to attack the network.
The possible downsides with PoS come in the form of accidental centralisation, whereby users with a large amount of coins could have an outsized influence on the consensus process. Additionally, due to the fact users strive to keep coins in their accounts for as long as possible in order to maximise profits, there’s a high risk of a decrease in cryptocurrency turnover.
But some sought to make PoS even more “democratic”, in the form of what’s known as Delegated Proof-of-Stake (DPoS).
What is Delegated Proof-of-Stake (DPoS)?
DPoS is similar to PoS when it comes to staking, but employs what some determine is a more fair and democratic system.
Token holders within a DPoS network are able to cast votes proportional to their stake to appoint delegates to serve on a panel of witnesses. Those witnesses are entrusted with securing the network. Delegates don’t need to have a large stake, but they have to compete to gain the most votes from users.
DPoS also looks to solve the scalability conundrum by ensuring there are fully-dedicated nodes who are voted in to power the blockchain. They’re incentivised to perform their duties honestly as they can be voted in or out at any time. With their reputation and source of income at risk, it’s believed bad actors wouldn’t benefit if they tried to maliciously manage the system.
Here’s the catch though, DPoS only typically works (and is employed) in semi-centralised networks. This is where the trade-offs between scalability and decentralisation are weighed up.
Platforms like Steem, EOS and BitShares use a DPoS mechanism.
Wait, there’s more… What’s PoET (Proof-of-Elapsed-Time)?
Not to be confused with any Shakespearian figures, PoET is a consensus algorithm underpinned by a goal of preventing high resource utilisation and high energy consumption. It does this by following a fair lottery system.
The algorithm uses a randomly-generated elapsed time to choose which participant will mine and thus earn the block reward. By running a trusted code within a secure environment, the algorithm sets out to enhance transparency by making lottery results verifiable by external participants.
Each participating node is required to wait for a randomly-chosen time period and the first one to complete the designated waiting time wins the new block. Essentially, each node in that blockchain network generates a random wait time and “goes to sleep” for that duration. The first one to wake up (or the one with the shortest wait time), commits a new block to the blockchain and broadcasts the necessary details for the whole peer network. The process repeats itself for the next block, and so on.
This mechanism relies on two fundamental factors:
- The participating nodes genuinely select a time that is random and not a shorter duration chosen purposefully in an attempt to win;
- It’s clearly established that the winner has indeed completed the waiting time.
PoET’s workflow is similar to PoW, but doesn’t consume such a large amount of power. Instead of being resource-intensive, it enables a miner’s processor to sleep and switch to other tasks for the specified time. The code being run is trusted and held within a secure environment, ensuring it’s not possible to be altered by an external participant. It also ensures the results are verifiable by objective participants, enhancing transparency.
This mechanism is, again, only viable for permissioned blockchain networks. Intel Corporation, the chip manufacturing giant, created the PoET concept, initially as a readymade tool to solve the computing problem of “random leader election”. It’s also used by Hyperledger Sawtooth.
What’s the consensus on consensus mechanisms?
For a technology with a primary goal of making sure everyone’s on the same page, you may be wondering why there are so many consensus mechanisms out there. Well, therein lies the beauty of crypto. The community is made up of individuals passionate about creating and maintaining a world that thrives off diversity in choice, efficiency and incentive.
Scalability, security and decentralisation are the three vital qualities any blockchain needs to have in order to reach global adoption. Most projects are facing what’s known as the “Blockchain Trilemma”, and usually end up having to sacrifice scaling or decentralisation to make up for the other two points on the triangle. Some out there argue that Ethereum 2.0 and a few other projects could be on track to solve this trilemma.
While some may be labelled legacy mechanisms (PoW, we’re looking at you), they’re also opportunities to see how far we’ve come and where we’re able to go. Ethereum’s bold move from PoW to PoS will be a case study in real-time of the efficacy in shifting algorithms.
It’s clear there’s no one-size-fits-all solution to managing blockchains and it really depends on the use case of the cryptocurrency as to whether or not it can be considered ‘the right one’. As the industry matures though, we can only expect there will be more developed.
Which mechanism do you think is most effective? Let us know on Twitter.