Learn how Proof of Work and Proof of Stake work and their pros and cons.
In our prior blog post, we provided an overview of what blockchain technology is and how it works. We briefly reviewed consensus mechanisms and why they’re important to the security of public blockchains.
In this post, we’ll dig deeper into the need for blockchain consensus and how the two most popular consensus mechanisms – Proof of Work and Proof of Stake – compare to one another.
The need for blockchain consensus
Because blockchain networks are open, anyone can run a node and contribute to the system. And because there is no one central party to make decisions, agreement must be reached among the nodes in order to validate transactions, create blocks, and update the distributed ledger.
Consensus mechanisms must be resilient to failures and malicious activity by one or more actors to maintain the security of the network. This challenge is represented well by an anecdote called the Byzantine Generals Problem.
The Byzantine Generals Problem
In the Byzantine Generals Problem, the Byzantine Army has decided to capture an enemy city. The army has multiple divisions with generals who lead them, and these divisions have the city surrounded. The generals can communicate only via messenger, and they all need to agree on a battle plan before they can move forward.
If they all agree to attack, they must do so all at once, or else they will be defeated.
If all generals were loyal and trustworthy, then there would be no issue with making a decision. But the concern is that there may be traitors among the generals who will send false messages and sabotage the attack.
How can the Byzantine army overcome the small number of potential bad actors to carry out their intended plan?
The Byzantine Generals Problem represents the consensus issue that faces open, permissionless blockchain networks.
The two most popular consensus mechanisms used today are Proof of Work and Proof of Stake. Let’s take a look at how each of them works and their pros and cons, starting with Proof of Work.
Proof of Work
Proof of Work (PoW) is the consensus mechanism employed by Bitcoin (and Litecoin, Zcash, Monero, and many other cryptocurrencies). We will refer specifically to the Bitcoin network in this section, but similar principles apply to other PoW cryptocurrency networks.
How Proof of Work Mining Works
The process of validating transactions and creating new blocks in PoW is called “mining.” Miners are nodes in the Bitcoin network who validate transactions, group them into blocks, and add them to the blockchain.
To do so, miners must expend computing power to solve a mathematical puzzle. The first miner to complete this task is automatically granted the ability to add the block of transactions to the blockchain, which is then verified by all nodes in the network.
These mathematical puzzles have some specific properties that help maintain the network:
- These puzzles are computationally- and time-intensive to solve, but it’s very easy to confirm that the answer is correct. The difficulty of solving these puzzles is represented by the network’s hashrate, which is a measure of the computing power of the entire Bitcoin network. The higher the network’s hashrate, the more difficult the puzzle is to solve, and the more computing power you need to mine blocks.
- The only way to solve these puzzles is through brute force. If you want to solve the puzzle more quickly, the only solution is to add more computational power. You can’t work smarter, only harder.
- The difficulty of these puzzles changes so that one block is added to the Bitcoin network on average every 10 minutes. If blocks are created too quickly (i.e. low difficulty/hashrate), the network adjusts to make the puzzles harder. If blocks are created too slowly (high difficulty/hashrate), the puzzles get easier. This is to maintain the pre-determined consistent pace of creating new coins.
The miner receives a block reward and associated transaction fees for performing this work. Block rewards are paid in Bitcoin generated as a result of a transaction. This Bitcoin is awarded to successful miners as a means for motivating participation and encouraging good behavior.
Miners can use a variety of computer hardware to mine Bitcoin:
- CPU (Central Processing Unit): CPUs are found in normal computers like the one you’re using to read this article. Because of the limited processing power of CPUs, it’s pretty much a waste of your time to try to mine Bitcoin with your computer, but you may be able to mine other lower-hashrate cryptocurrencies with it.
- GPU (Graphics Processing Unit): GPUs are more powerful graphics processing cards that are frequently used for gaming and other processing-intensive activities.
- FPGA (Field-Programmable Gate Array): FPGAs are powerful chips that can be programmed to perform a specific task. These are much more powerful than CPUs and GPUs.
- ASICs (Application-Specific Integrated Circuit): An ASIC is a type of chip that is specifically built to do one thing and do it very well. Most ASICs manufactured today are built for Bitcoin mining because they are extremely fast and energy-efficient.
Pros of Proof of Work
The main advantage of PoW is its security. It’s extremely difficult for a bad actor to take over the network.
To do so, the villain needs to control 51% of the mining power of the network. This is a massive amount of computing power that will be extremely expensive to obtain. So it’s not in the best interest of miners to go against the network because if their ploy doesn’t work, they can incur huge financial losses.
After 11 years of existence, the Bitcoin network has never been hacked. That’s pretty amazing.
Cons of Proof of Work
High Energy Consumption
The primary drawback of PoW mining is that it uses a lot of energy and can be detrimental to the environment.
Raw computational power is the only way to mine a PoW coin, and this power needs electricity to run. And mining Bitcoin uses A LOT of energy.
It is estimated that Bitcoin consumes 0.32% of the world’s energy each year, more than the entire consumption of countries like Austria and Colombia.
And with the growth in popularity of Bitcoin, these energy consumption numbers will only increase.
While Bitcoin has been extremely secure and it is nearly impossible for a single bad actor to overtake Bitcoin’s network, a 51% attack can be achieved if many miners combine their computational power.
Currently, miners work together as “mining pools”, where they aggregate their computational resources so they can increase the likelihood of mining blocks and obtaining the rewards. If multiple mining pools combine their resources, it is possible that they can coordinate a 51% attack on the Bitcoin network.
Per Blockchain.com, 57.6% of Bitcoin’s hashrate is concentrated in the top 4 mining pools.
Additionally, an estimated 81% of mining power is centralized in China, which makes Bitcoin susceptible to the geopolitical landscape of that country.
Now let’s learn more about the Proof of Stake consensus mechanism.
Proof of Stake
The Proof of Stake (PoS) consensus mechanism is designed to improve upon the drawbacks of Proof of Work. The validation process serves the same goals but works very differently.
Ethereum is in the process of switching from Proof of Work to Proof of Stake. Other cryptocurrencies that use PoS include Dash, Stellar, Neo, and many others.
How Proof of Stake Validation Works
Validators in PoS environments are analogous to miners in PoW systems – these nodes help maintain the security of the network by validating transactions and creating new blocks. But instead of a miner purchasing expensive computing equipment to mine new blocks, validators stake the PoS network’s cryptocurrency for the ability to validate transactions and “forge” the next block.
Here’s how the process works.
The validator puts some of their cryptocurrency at stake (essentially, putting it in escrow) to win the right to forge the next block. Depending on the cryptocurrency network’s policies, winning validators are selected based on one or a combination of the following methods:
- Randomized Block Selection: Validators are selected by looking for nodes with a combination of the lowest hash value and the highest stake.
- Coin Age Selection: This method selects validators based on “coin age”, which is calculated by multiplying the number of days the coins have been staked by the number of coins staked. Once a node has forged a new block, their coin age reverts back to zero and they must wait a certain period of time to be able to forge another block. This helps prevent nodes with large stakes from continually winning the right to forge blocks.
If a validator tries to approve a fraudulent transaction, s/he will lose their stake and the right to create blocks in the future. If the validator approves legitimate transactions, they are granted the right to create the next block and will receive compensation in the form of transaction fees.
Because validators are putting their cryptocurrency up for stake, theoretically they are incentivized to validate legitimate transactions and not act out of line.
Pros of Proof of Stake
The biggest advantage of PoS networks is energy efficiency and environment friendliness.
Massive computational power is not necessary to create blocks; validators can use normal desktop and laptop computers to participate.
A positive side effect of this energy efficiency is that it theoretically incentivizes more people to run nodes, and thus makes the network more decentralized.
Cons of Proof of Stake
The first con of Proof of Stake is that validators with a large amount of coins can have outsized influence on the network. As validators win the right to create new blocks and earn more rewards, their chances to continue to forge new blocks increases and thus the network becomes more centralized.
While the Coin Age selection method tries to prevent this, the size of stake will always be a factor in selecting validators. So this problem can’t be entirely avoided.
Even though you don’t need massive hardware requirements to participate in PoS networks, you do need to be connected to the internet at all times to maximize your chances of forging the next block. Not everyone can be continuously connected, so this can lead to network centralization around those who can.
Proof of Work and Proof of Stake are the most popular cryptocurrency consensus mechanisms used today. Each has its benefits and drawbacks, and it’s important to understand how they work to provide security of these networks.
In our next post, we’ll review additional consensus mechanisms, such as Delegated PoS, Proof of Elapsed Time, and others, that are used by other cryptocurrency networks, and their pros and cons.
We would love to hear your thoughts about these consensus mechanisms. Did we miss anything?