One of blockchain’s most interesting features is decentralization. No single entity or network member is responsible for validating changes. Instead, a majority have to agree before changes are committed to a new block.
This is called consensus. It’s what separates most blockchains from standard databases. And the way you achieve consensus can have repercussions on the speed, scalability and cost of adding new blocks.
What is consensus and why does it matter?
Consensus ensures everyone has a single version of the truth. Your blockchain data should match everyone else’s — otherwise, the whole system breaks down. Consensus, therefore, protects the integrity of the blockchain and minimizes the risk of fraud from a corrupt minority.
Blockchains reach consensus through a consensus protocol — a set of rules or instructions that tell the blockchain how to deal with new data. Through the use of rewards and incentives, a consensus protocol can approve new blocks without the need for third parties or centralized authorities.
I’ll focus on two of the most popular consensus mechanisms today: proof-of-work (PoW) and proof-of-stake (PoS). Combined, Crypto Research Report says they enable 42% of the top 100 cryptocurrencies. However, there aremany others. I’ll also avoid private or semi-private blockchains, which aren’t — strictly speaking — decentralized, but rely on a centralized authority to authenticate new transactions.
Proof-of-work: The first to solve the puzzle wins a prize.
Imagine you’re in a room with 10 friends.
Five of you, including you, are given a mathematical puzzle to solve. The first to solve it wins a prize.
You solve the puzzle first, and three of the other solvers check your solution. It’s correct. You win $50, and your solution is written on a whiteboard with previous solutions.
This is a simplified version of the proof-of-work (PoW) consensus protocol used by Bitcoin.
• The whiteboard is the Bitcoin blockchain.
• You and your friends are Bitcoin network members, called “nodes.”
• The five of you solving puzzles are special nodes called “miners.”
• Each puzzle is a new block of new Bitcoin transactions (cryptographically disguised).
• The miners compete to solve the puzzle, called “mining.”
• The first to solve the puzzle presents their solution to the Bitcoin network.
• If 51% or more agree, then you get a reward. Actual blockchain miners will get some bitcoin.
PoW is difficult, but not impossible, to cheat.
According to Crypto Research Report, cryptographic puzzles require a lot of computing power to solve, so it’s expensive and time-consuming to commit fraudulent blocks without being noticed.
However, there is the risk of a 51% attack where a conspiratory mining pool controls 51% of the network. You and the solution checkers might conspire to add a fake solution on the whiteboard, for example. In the same way, if 51% of Bitcoin miners control the approval of new blocks, they effectively control the blockchain. It becomes centralized, and the risk of fraud increases.
Proof-of-Stake: You’ve got to be in it to win it.
You’re back in the room again.
This time, the puzzles are much simpler, and there’s no race to solve them. Instead, the person with the most money gets to solve the puzzle and write it on the board.
If you’ve spent your money, the probability of being chosen to solve a puzzle is low. If you’ve saved your money, the probability of being chosen is high.
Let’s assume you have more money than everyone else. You solve your simple puzzle and it’s written on the whiteboard.
This time, you’re rewarded $1. This seems fair as you had far less work to do than last time. And as you’re now $1 richer, the probability of being chosen again to present a solution is higher.
This is a simplified example of the Proof-of-Stake consensus protocol.
• The whiteboard is the Ethereum blockchain (or will be once Casper is released).
• You and your friends are Ethereum nodes.
• Some of you, including you, are also validators.
• The validator with the most money at stake solves their puzzle.
• These puzzles simply verify your stake (show the contents of your wallet).
• When you solve your puzzle, you receive transaction fees for adding the new block.
Unlike Bitcoin’s consensus mechanism, there are no miners and no heavy computational problems to solve. Instead, a validator’s stake determines whether they can validate a new block. If they commit fraud, their stake would fall in value, which theoretically eliminates fraud.
I believe proof-of-stake (PoS) is better than proof-of-work (PoW) in a number of ways:
1. PoS is energy efficient. You don’t need as much computational power to create new blocks for the reasons above, so PoS is therefore better for the environment.
2. PoS is considered cheaper because it requires less computational power or electricity.
3. PoS seems more decentralized because there’s no advantage to collusion. However, PoS does favor larger stakeholders.
4. PoS should neutralize the 51% attack risk posed by PoW. If you want 51% control, you need to buy lots of cryptocurrency.
Nevertheless, PoS isn’t perfect.
A validator might only appear to have a stake in the network — called the “nothing-at-stake” problem. For example, you might validate on multiple blockchains, or simply borrow your stake from the bank.
Ethereum plans to use a modified PoS model in their upcoming Casper release that requires validators to make a deposit. Should the validator commit fraud, they would lose their deposit.
What’s the best consensus model for businesses?
At the moment, no-one knows for certain. To me, chances seem good that proof-of-work will die off like all inefficient technologies do, which would make proof-of-stake the most promising model for the future.
But a lot depends on your goals as a business and your appetite for risk. PoW is battle-tested and in use today, so do you adopt something you know works — warts and all — or risk a potentially better yet less established model like PoS?
As with most blockchain technology, there is still some way to go until the perfect consensus model is found, but I believe it’s really just a matter of time.