Consensus Algorithms, Explained: What You Need To Know About Proof-of-Work, Proof-of-Stake, and Delegated Proof-of-Stake

It can be a challenge trying to wrap your head around the concept of consensus mechanisms. However, they are a key element of blockchains and cryptocurrencies, and the winning consensus mechanisms could become the foundation on which the Web 3.0 will run.

In this article, we explain consensus algorithms and take a look at some of their most popular models.

The Basics of Consensus

Consensus: A generally accepted opinion or decision among a group of people.

Algorithm: A set of rules for accomplishing a task in a certain number of steps.

Combining the two, you get: a set of rules and number of steps for accomplishing a generally accepted decision among a group of people.

Consensus algorithms are a vital part of blockchain technology. They are the recipe for the rules of a network that describe the sequence of events. The algorithm basically lays out: if this happens, then that happens, then that happens, and so on. For blockchains, these consensus algorithms are put in place to ensure a group of people agree that all transactions are validated and authentic.

Transactions can be financial transactions, such as with Bitcoin, but also blockchain-based transactions such as trading data, swapping ownership rights, access to dapps and much, much more.

Consensus algorithms ensure a network of random people can achieve consensus about transactions in the network. People have to cooperate and grow accustomed to these new decentralized networks that have no central authority, unlike the governments, institutions, and businesses we are used to.

Consensus mechanisms secure a blockchain’s transactions by preventing the double-spending problem. The double-spending problem has been an obstacle in previous attempts at creating a digital currency. At its very basic, double-spending is much like sending a photo to someone digitally. You do not send the original picture, but a copy and now two people have the same picture.

Imagine if someone could do this with cryptocurrencies. Anyone who could accomplish this would make themselves wildly rich destroying the entire network. They could make the same transaction multiple times, or send a transaction while keeping the sent amount too. Thus, a fail safe is needed to prevent fraud, and this is where the consensus mechanism comes in.

In our traditional economy, financial intermediaries, simply put, exist to ensure that fiat currencies are removed from one account and placed into another. This ensures that the total money supply remains the same, so no spending your dollars twice or counterfeiting can occur.

Since digital currencies are decentralized, each currency’s network needs to find its own way to verify all transactions on its blockchain and prevent fraud. Consensus mechanisms ensure that all transactions on the blockchain are authentic, and that the digital currencies move from wallet A to wallet B. All transactions are stored on the public ledger for everyone to see, creating full transparency.

People need to be incentivized to verify transactions by solving blocks, or else no one would do it. In most cases, the consensus mechanism in place rewards network members for solving a block with newly generated tokens on top of the transaction fees for each transaction in a block. Thus, people are motivated to help strengthen the network out of sheer self-interest.

Every cryptocurrency has its own consensus algorithm written in its code. This algorithm can be either one that already exists – like that of Bitcoin, Dash, or Ethereum – or, as we’re seeing more and more these days, a completely new consensus algorithm like the ones IOTA, Hashgraph, and Matrix employ.

Let’s take a look at the most prevalent consensus algorithms. Keep in mind that these existing consensus mechanisms all have their advantages and disadvantages, and the field is continuously looking for new and better algorithms.

Proof-of-Work (PoW)

The first consensus algorithm for cryptocurrencies is Proof-of-Work (PoW) and was introduced by Satoshi Nakamoto in the legendary Bitcoin whitepaper. PoW is based on the assumption that work must be put into something to give it value, and in Bitcoin’s case this work is doing computations with mining equipment that consumes electricity.

In PoW, cryptocurrency transactions are encrypted and stored in a data block. Once the block is filled up, miners can solve the block. These blocks are mathematical equations which are hard to solve, but easy to verify by the rest of the network once they’re solved. Verification by others is essential for trust, as all other network members must be able to check whether a miner did their work properly.

The miners who verify the transactions within the network compete to solve blocks, which are then added to the chain of blocks. For solving a Bitcoin block, miners currently receive a reward of 12.5 BTC.

You can see solving blocks as opening a 3-digit numbered lock (although blocks are insurmountably more complex calculations). You’d have to try 10x10x10 combinations to open it if you don’t know the combination. But once you’ve found the combination, your friends can easily check whether it’s the right number.

An often criticized downside of PoW and Bitcoin is the energy consumption needed to secure its network. The energy consumption grows with the network, which means that PoW can leave an enormous environmental footprint if Bitcoin becomes as big as we expect it to become.

With this comes the problem of miner centralization, which means that huge mining facilities located in places with cheap electricity are outcompeting all small miners. Moreover, to make the PoW mechanism secure, a low transaction throughput needed to be put into place, making PoW-based blockchains inherently slower than blockchains with other consensus algorithms.

Nonetheless, Proof-of-Work has proven to work for nearly 10 years now, something that no other consensus mechanism can claim. Bitcoin has remained secure because of it, even in times where global forces have been trying to corrupt its network. Other blockchains that employ the PoW consensus algorithm include Litecoin, Dogecoin, and Ethereum, although the latter plans to switch to a hybrid Proof-of-Stake mechanism.

Click here for a full technical explanation of PoW.

Proof-of-Stake (PoS)

A far more energy-efficient consensus algorithm is Proof-of-Stake (PoS). Instead of randomized block solving based on computational power, this algorithm bases the randomization on the number of tokens a network member is staking.

PoS requires blockchain network members to “stake” their cryptocurrencies in a native wallet related to the network. Instead of miners, people staking their coins are known as “minters.” Minters stake their coins to increase their chances to solve a block and thus to receive newly generated coins.

The bigger the amount someone stakes, the bigger the odds are that that minter will get to verify a block of transactions. Some PoS algorithms also have other measures in place for selecting minters, such as how long coins are being staked in a wallet, or an algorithm might require a staker to lock up their stakes for a specified amount of time.

Staking and other potential requirements are in place to ensure the mutual long-term interest of the individual and the network. For example, if you have staked a sizeable stack of coins in a network, you’re automatically inclined to see that network succeed, as you have a vested financial interest for it to do so. You wouldn’t corrupt the network, as that would destroy your own value. This is also why the chances of you solving a block increases with the amounts of coins you stake.

One key issue with PoS is the classic “the rich get richer and the poor stay poor” problem. If you could afford a big bag of coins of a certain blockchain, the chances are higher that you will get rewarded if you stake and your holdings will increase through said staking – yet again increasing your chances for getting rewarded, and so on down the line. If you have minor holdings, the chances that you will get to mint are closer to 0; it’s less likely that your holdings will ever increase, so your chances do not either.

Decred and Peercoin both employ a PoS consensus mechanism. Ethereum will switch from PoW to PoS, however, their consensus algorithm will be a unique algorithm called the Casper Protocol, which uses elements of PoS but will be a unique consensus algorithm.

Click here for a full technical explanation of PoS.

Delegated Proof-of-Stake (DPoS)

Delegated Proof-of-Stake is similar to PoS in name, but in practice this consensus mechanism is significantly different. This system represents a representative democracy, in which people vote on who represents them.

In the DPoS system, people vote with their coin holdings for delegates who will be able to verify transactions and receive newly minted coins. As a reward for voting, voters then receive a share of the coins received by the delegate. This share is based on the amount of coins they voted with relative to the coins held by other network members who voted for the same delegate.

DPoS is highly flexible because it includes multiple voting rounds based on delegate reputation. This means that if delegates underperform or are suspected of malpractices, network members can pull their vote and cast them for another delegate with a better reputation.

Moreover, most DPoS algorithms include a shuffle equation, which randomly shuffles the sequence of chosen delegates. Through this, the delegate that solves the next block can’t be predicted, leaving little room for transaction manipulation by the delegates.

The DPoS mechanism reaches consensus quickly because there are far less people to reach consensus with (only the delegates). This makes blockchains that employ DPoS much faster than PoW or PoS blockchains, but also less secure. This is because only a small group of people gets to decide on the validity of transactions for the entire network, making this mechanism more centralized. Delegates could form cartels or start working together secretly, which would threaten the trust in the entire network.

Additionally, people with more coins have far more voting power and thus more influence over the network.

(Source: HackerNoon)

These two disadvantages, however, are a necessary sacrifice to make a blockchain far more scalable.

Click here for a full technical explanation of DPoS.

Ark is one of the blockchains that has employed a DPoS consensus algorithm. There are 51 active Ark delegates, meaning the 51 delegates with the most votes get to verify transactions for newly minted coins.

To vote, you’ll have to download the Ark client and store your Ark coins in there. In the wallet is an option to vote, and you can only vote for 1 delegate with your coins. You scroll through the list of delegates, and once you’ve found a delegate that you like (productive, contributor to the community, reputation) you cast your vote.

Your vote is worth as much as the coins you hold, so 1 vote with 800 coins has a voting weight of 800. If the total amount of coins a delegate has received in votes is, for example, 80.000, you will then be entitled to 800/80000 = 1% of the profit sharing of a delegate. So if the active delegate receives 50 coins for solving a block and shares 50% of his earnings with his voters, you’d receive 0.25 Ark coins for your vote.

Alternative Consensus Algorithms



As you can see, these models are not perfect given their downsides. Because of this, and likely because of the intelligent competition, many decentralized projects have been coming up with adjusted or entirely new consensus algorithms. There are far too many to discuss here, but we’ll highlight a few to show the breadth and depth of the field.

Proof-of-Capacity

This is a consensus model in which people receive newly minted cryptocurrencies when they contribute GPU to a blockchain. The more GPU you contribute, the bigger the chances are that you get to solve a block. Burstcoin is thus far the only cryptocurrency that uses this consensus algorithm.

Proof-of-Authority

In this consensus algorithm, transactions are validated by approved network members, the admins of the network. Because of this, it’s super-centralized but efficient, and could work for private blockchains in which all members know each other to a certain degree.

DAG

DAG stands for Directed Acyclic Graphs and is a new consensus algorithm that is sometimes dubbed the blockchain killer. This because, technically, this consensus algorithm doesn’t run on a blockchain. It has (theoretically) unlimited scalability, and transactions cost fractions of a penny. But it is still in its experimental phase. Promising projects that are using DAG are IOTA, Hashgraph, and Nano (previously Raiblocks).

Byzantine Fault Tolerance

All decentralized systems face the Byzantine General Problem. It’s a complex problem which is excellently explained here.

This is an oversimplification, but the Byzantine General Problem describes the problem that arises when a decentralized network wants accommodate transactions and wants to trust all these transactions, while expecting that there are bad actors in the network.

(Source)

Consensus mechanisms are decentralized systems, and they have to find a way around this problem. If a consensus algorithm succeeds in protecting itself from the Byzantine General Problem, it has achieved Byzantine Fault Tolerance. That’s why you see this tolerance pop up in most white papers you’ll read.

There are a couple of consensus algorithms developed mainly around Byzantine Fault Tolerance such as those of Stellar, Ripple (both use the Federated Byzantine Agreement consensus algorithm), and Hyperledger (Practical Byzantine Fault Tolerance algorithm).

Concluding Remarks

Learning about consensus algorithms is probably not going to make for a leisurely read, but they are an essential component of blockchains and cryptocurrencies. They help the network trust the transactions within it by preventing the double-spending problem.

Consensus mechanisms are thus algorithms that create consensus for a decentralized, anonymous group. They are much needed, since there are no central parties making up checks and balances in a decentralized system, and as such the system has to do it itself.

The first successful consensus algorithm was that of Bitcoin – Proof-of-Work – followed by Proof-of-Stake and Delegated Proof-of-Stake. All these algorithms have systematic rewards in place for the network members who validate transactions and secure the network, whether they’re called miners, minters, or delegates.

All consensus algorithms have their upsides and downsides, and they’re far from perfect. This is why we keep seeing new algorithms appear, such as Byzantine Fault Tolerance-oriented mechanisms and entirely new consensus algorithms that don’t even require a blockchain.

Don’t underestimate the importance of a properly designed consensus algorithm. If it’s not perfect, it could destroy its network; if it is perfect, it could become the backbone of our future decentralized world. No single blockchain will survive without a solid consensus algorithm and we’ll be following the progress in this field closely.

Related: What is Cryptography?