Selecting — and then implementing the right consensus protocol (or consensus algorithm) — is a key decision to make early in your blockchain project. Consensus protocols allow the blockchain to confirm transactions without relying on a third party. And, of course, getting rid of intermediaries and decentralizing is at the heart of blockchain.
Put simply, the consensus algorithm seeks to ensure that the next block to be added is, as nearly every blog and tech publication puts it, “the one and only version of the truth.” At the same time, it’s also designed to keep bad actors from tampering with or undermining the blockchain network.
Consensus allows a decentralized network to arrive at an agreement about the state of the blockchain. Unless everyone participating on the blockchain is totally honest and pure of heart, consensus is essential.
“Consensus is the backbone of the blockchain and any other decentralized and distributed technology,” writes Collin Thompson, co-founder of Intrepid Ventures.
Here’s a look at several blockchain consensus protocols. We’ll start with the best known.
“The correct way of thinking about the proof-of-work concept is as a means for a group of self-interested people, none of whom is subordinate to any other, to establish a consensus against a considerable incentive to resist it. Bitcoin could operate perfectly well without proof-of-work, as long as everyone was perfectly honest and altruistic. If they are not, then reaching a consensus is difficult.” — Satoshi Nakamoto Institute
The first — and still most common — distributed blockchain protocol mechanism is called “proof-of-work.” It’s most closely associated with Bitcoin, which introduced it to the world, but many cryptocurrencies have subsequently adopted it. It’s designed for a public (or permissionless) blockchain.
When a transaction is initiated, “miners” get to work on solving a cryptographic puzzle.
Miners have what lay people would call “supercomputers.” The computing power, or “hashrate,” gives them an advantage in solving the puzzle, which allows them to add the next block to the chain. The puzzle they solve is difficult and requires substantial computational power (or, work). Just how hard it is varies: In Bitcoin, for example, it’s programed so that one block is produced every 10 minutes. The difficulty of the puzzle automatically adjusts to make that happen.
The first miner to solve the puzzle receives newly minted Bitcoins, plus a small transaction fee.
PoW was first; hence it’s currently the most popular. It’s also highly scalable, which makes it attractive. But it has major drawbacks. Among them:
- Energy consumption: The miners’ “supercomputers” test millions of computations per second, and this is happening around the world. Due to the amount of computational power required, PoW is costly and energy intensive. To quote the MIT Technology Review, “It's been estimated that Bitcoin guzzles about as much electricity annually as all of Nigeria.” That’s not sustainable and, as this CoinDesk piece points out, most PoW mining is done in areas of the world where electricity is cheap. One (controversial) aspect of this particular complaint is that these computations are useless. Mathematician Andrew Tar makes the case in a Cointelegraph piece. “Miners do a lot of work to generate blocks and consume a lot of power. However, their calculations are not applicable anywhere else. They guarantee the security of the network but cannot be applied to business, science or any other field.”
- Vulnerability: PoW is vulnerable to a “51% attack,” meaning — in theory — nefarious miners could capture 51 percent of a network’s computing power, gain what’s termed “dominance“ and manipulate the blockchain to their advantage.
Ethereum, like Bitcoin, uses PoW; however, it’s slated to move to a proof-of-stake algorithm in its 2018 Serenity release.
Proof-of-Stake (PoS) algorithms are designed to overcome the disadvantages of PoW — in particular, high energy consumption. PoS, in its various permutations, is the most common alternative to PoW. Like PoW, it’s also designed for a public blockchain.
Instead of miners with fancy — and costly — computer equipment racing to mine blocks, a “validator” invests cryptocurrency. (Which type of coin depends on the system, of course.)
A white paper from Persistent Systems offers a useful explanation:
“Instead of a user spending say $2,000 buying mining equipment to engage in PoW algorithm and winning a mining reward, with PoS she can buy $2,000 worth of cryptocurrency and use it as stake to buy proportionate block creation chances in the blockchain system by becoming a ‘validator.’”
There’s no guarantee the individual validator will be selected, no matter how much he or she invests. That’s because the PoS algorithm randomly selects validators for block creation. In that sense, it’s like a lottery: The more you invest, the better your chances. Validators are paid processing fees — no new coins are minted or mined in the process.
Peercoin, blackcoin, and NXT were among the first to use PoS.
Among PoS’s benefits are
- Speed: Provides faster processing of transactions
- Efficiency: Consumes less energy
- Less hardware: Doesn’t require a “supercomputer”
Among its drawbacks are
- Vulnerability: Someone with enough money to invest exclusively into the destruction of this system can do so by investing only money, as opposed to PoW where they need to invest money, time, expertise, hardware, electricity, etc.
- The rich get richer: Only the richest stakeholders are permitted to have control of consensus in the blockchain.
PoS has different variations. Perhaps the most common is delegated proof-of-stake.
Delegated Proof-of-Stake (DPoS)
With DPoS blockchain consensus protocols, coin holders use their coin balances to elect delegates, called witnesses. These witnesses have the opportunity to stake blocks of new transactions and add them to the blockchain. Voting power is determined by cyberwealth. Those who have more coins or tokens will have a greater impact on the network that those with fewer.
It’s natural to wonder if the name was changed to “witnesses” from “delegates” to avoid overt political overtones. But in fact, it’s probably the best available analogy. Consider this description from “CaptainAltcoin”:
"Delegated Proof-of-Stake and traditional Proof-of-Stake are very different, and the difference can be compared to the difference between direct democracy and representative democracy. In regular PoS, every wallet that contains coins is able to ‘stake.’ This means it can participate in the process of validating transactions and forming the distributed consensus and to earn coins in return. In a DPoS system every wallet that contains coins is able to vote for delegates."
In addition to the benefits of PoS, DPoS offers:
- Better distribution of rewards: People will elect only those delegates who give them the most rewards, so casual users — not just the “rich” — earn rewards. (This democratization makes DPoS more decentralized than either PoS or PoW.)
- Real-time voting security: Any malicious action by a witness can be immediately detected by the voters, who can oust the offending delegate.
So, what’s the downside?
- Cartels: Witnesses could organize into cartels.
- Easier to organize an attack: Because fewer people are in charge of keeping the network alive, it’s easier to organize a “51%” attack
- Potentially more centralized: Power is again concentrated in the hands of a few.
Does all this sound vaguely familiar? Again, the political analogies are obvious. This time, the challenge — be it blockchain or a nation — is voter apathy. “It’s also subject to voter apathy; without a large number of engaged users, the system will not function as intended,” observes an Invest in Blockchain piece.
Leased Proof of Stake (LPoS)
This is another, less common variation on PoS. It was developed by WAVES, a decentralized blockchain platform that allows for the creation of custom tokens. It attempts to address the “rich get richer” issues. It also aims to improve security, given that network security is better when there are more participants. To those ends, it seeks to incentivize those with fewer coins to lease out their balances to nodes.
The coins make the node stronger — or gives it more “weight,” — increasing its chances of being allowed to add a block to the blockchain. The rewards received are shared with those who leased their coin balance to the “winning” node. (This is a contrast to DPoS, where participants aren’t necessarily rewarded directly.)
Proof of elapsed time PoET
Hyperledger Sawtooth, originally developed by Intel, is a modular blockchain platform. What may be generating the most buzz is its blockchain consensus algorithm: proof of elapsed time (PoET). What’s so notable? For one thing, it’s applicable to permissioned and public platforms. More importantly, it lets users on a permissioned blockchain reach consensus, even when the parties don’t know each other. (Other permissioned blockchains require that users know and trust each other.)
PoET is similar to proof of work but without the high resource consumption. Simply put, it leverages trusted computing to enforce random waiting times for block construction. According to Intel, it’s the first lottery-based consensus for Blockchain. It’s designed to work in what are called “trusted execution environments,” such as Intel’s Software Guard Extension (SGX). In PoET’s random leader-election model based, the protocol selects the next leader in the block. Like most others we discussed, it requires far less energy than does PoW.
- Reliance on Intel: As a piece in CoinDesk puts it, “The one problem with this protocol is it requires you to put your trust in Intel – and isn’t putting trust in third parties what we were trying to get away from with public blockchains?”
- Hardware requirement: It relies on specialized hardware.
Practical Byzantine Fault Tolerance (PBFT)
PBFT is the most popular permissioned blockchain platform protocol and is currently used by Hyperledger Fabric.
To understand the Practical Byzantine Fault Tolerance algorithm, you need to understand the Byzantine generals’ problem. You probably do, but it’s worth a review, especially if you pass this post along to one of your less-tech-savvy colleagues.
Credit goes to Leslie Lamport, Robert Shostak, and Marshall Pease, who posed the problem in a 1982 academic paper. Different versions have circulated, but let’s keep it simple. Imagine a group of Byzantine generals and their armies have surrounded a castle and preparing to attack. To win, they must attack simultaneously. But they know that there is at least one traitor among them. So, how do they launch a successful attack with at least one, unknown, bad actor in their midst?
The analogy is clear: In any distributed computing environment — blockchain — there is a risk that rogue actors could wreak havoc. So, its reliance on community consensus makes Byzantine faults an especially thorny problem for blockchain.
PoW generally provides a solution: “Byzantine fault tolerance.” But the drawbacks may not be worth it. Distributed provides one such example.
“In industries like healthcare, it may make more sense to rely on node votes. Because participants in a blockchain in healthcare are more likely to be altruistic and operate under real identities than are users of a highly anonymous, unregulated system like Bitcoin, the benefits of avoiding PoW may outweigh the risks associated with node voting as the solution to Byzantine faults.”
That’s where the Practical Byzantine Fault Tolerance algorithm comes into play. It’s considered the first practical solution to achieving consensus that overcomes Byzantine failure, according to Persistent's whitepaper. The very short version: A consensus decision is determined based on the total decisions submitted by all the generals. It addresses the challenges without the expenditure of energy required by proof-of-work. But it works only on a permissioned blockchain, because there’s no anonymity.
Some of the others
We’ve discussed the major ones. Here are a few others that are gaining a foothold.
- Proof of Importance: Developed by NEM, this advances the idea that productive network activity, not just the number of coins accumulated, should be rewarded. Participants who frequently send and receive transactions are more likely to find blocks.
- Proof of Activity: Proof of Activity is a hybrid approach that combines proof of work and proof of stake. As in PoW, miners race to solve a cryptographic puzzle. Then the system switches to PoS. Criticisms are the same as for both proof of work and proof of stake.
- Proof of Capacity: Most of the alternatives to PoW are, in some respect, pay-to-play. In proof of capacity, you pay with your hard drive space. The more you have, the better your chance of mining the next block and earning the reward.
- Proof of Burn: This requires proof of having “burned” cryptocurrency, which is accomplished by sending the coins to a wallet from which they cannot be recovered. “By committing your coins to never-never land, you earn a lifetime privilege to mine on the system based on a random selection process,” Amy Castor writes in an article for Coindesk. Critics point out that, although it doesn’t consume energy the way PoW does, it still wastes resources needlessly. And as with POS, it’s focused on those already “rich” — those who are willing to burn more money.
The bottom line — sort of
So, what does this mean for your business? The most obvious thing is that there are many, many consensus algorithms out there. Despite that, there may not be a perfect fit. But there are some general considerations, driven by the applications you plan to deploy.
If you are envisioning a public blockchain, which requires robust consensus among a lot of unknown and untrusted participants, you may prefer a more complex model at the expense of speed. (Examples: Bitcoin’s PoW model.)
To begin, ask yourself some very basic questions:
- What’s the scale of your project?
- Is your blockchain public or permissioned? (Permissioned — or consortium — blockchain projects may require faster transactions.)
- What are your performance requirements?
- Token or no token?
This last point may become the biggest. IBM — the brains behind Fabric — observed last year a divide is emerging between cryptocurrency-based and non-cryptocurrency- based consensus systems, arguing that the model based on cryptocurrency is unsustainable for enterprise use and permissioned blockchains. PoW and PoS, for example, use coins; PBFT and PoET do not.
It sounds overwhelming, but it doesn’t have to be. We’re here to help. Drop us a note to let us know what we can do.