- The Proof of Work consensus protocol has been the dominant method to verify transactions since Bitcoin was introduced
- Proof of Work is difficult to scale because it requires vast amounts of electricity, one of many problems Proof Stake aims to solve
- Ethereum is switching to a Proof of Stake system to upgrade their entire system and jumpstart Ethereum 2.0
If you haven’t heard, Ethereum is creating a Proof of Stake blockchain. Traditionally a Proof of Work blockchain, Ethereum is implementing the Casper consensus protocol to upgrade their network.
But what are these two consensus protocols? What are their pros and cons? And why is Ethereum switching over? Let’s get into it.
Proof of Work
When Satoshi Nakamoto introduced Bitcoin, they proposed the Proof of Work (PoW) algorithm to validate transactions. Since then, PoW has become the dominant consensus protocol for many cryptocurrencies.
PoW requires miners to compete against each other to solve highly complex computational puzzles. The more computational power you have, the more likely you are to solve that puzzle. PoW incentivizes miners to use better hardware to run calculations at higher speeds. This measurement is called a hash rate.
Miners must find a valid nonce – a “number only used once.” Miners run this nonce, coupled with the block’s data, through a hash function. The output must meet certain conditions stipulated by the PoW protocol.
Miners play a guessing game until it meets those conditions. Every failure requires miners to change the nonce, thus starting the process again. When the input matches the output, they unlock the solution to that block, called a block hash.
The first person to uncover the block hash broadcasts the solution to the network where other nodes verify its authenticity. If they reach a consensus, that miner gets the block reward.
Each validated block has a block hash that represents the miner’s work. Hence, Proof of Work.
Pros and Cons of the Protocol
The benefit of PoW is primarily security and transparency. It’s difficult to unlock a block hash, but it’s fairly easy for others to validate its authenticity.
PoW also helps deter double-spending, where two people spend the same funds. Double-spending can undermine the entire system if there’s no way to counteract against Bob copying ten units five times, now holding 50 units. Similarly, without the PoW protocol, Bob could send those 10 units to Larry and Sally simultaneously.
Thankfully, nodes on the network can audit the history of the blockchain going back to its genesis block, making it easy to detect and prevent fraudulent activity.
However, there are a few downsides to this consensus protocol. For one, solving these puzzle pieces requires monumental amounts of computational power, and therefore, electricity; enough to power entire countries. People have built mining farms with higher hash rates to increase their likelihood of getting block rewards.
To increase chances even further, miners form mining pools. They combine their hashing power and distribute the reward amongst participants, making the blockchain more centralized. If these pools join forces, they could hold a majority in the network and start approving fraudulent transactions.
Proof of Stake
The Proof of Stake (PoS) consensus protocol was first introduced in 2011 as a solution to the Proof of Work algorithm’s shortfalls.
PoS abandons the competitiveness in PoW. PoS doesn’t allow everyone to mine new blocks. Instead, it elects one node to validate the new block. We should note some changes in terminology here. PoS has validators instead of miners. These validators mint or forge new blocks instead of mining blocks.
This election process also prevents mining pools since the protocol isn’t based on computing power. Setting up a node in a PoS blockchain is less expensive compared to its PoW counterpart. It’s easier for people to set up nodes, thereby encouraging decentralization and security.
Electing a validator involves a number of factors including staking age, randomization, and the node’s wealth. Most importantly, nodes need to deposit a certain amount of coins into the network. Hence, Proof of Stake.
The higher the stake, the higher likelihood of getting elected as a validator. A node’s stake incentivizes validators to do their job because they will lose a part of their stake and their right to participate in the future if they approve fraudulent transactions.
Mitigating Risk with this Mechanism
One worry is that this system could favor the wealthiest nodes. The randomization factor counters such risk. PoS searches for nodes with a combination of a low hash value and a high stake.
Another countermeasure is the coin age method, which is calculated by multiplying the number of coins staked by the number of days they’ve been staked. Once a node has forged a block, their coin age drops to zero.
The next validator can often be predicted since stakes are public. Once chosen, nodes check if the transactions within the block are valid, signs off, and then adds it to the blockchain. Their reward is the transaction fees associated with the block.
Another worry is the Nothing at Stake problem. When forks emerge on the blockchain, PoW miners must commit their expensive hardware and hash rates to one fork. However, nodes in a PoS are incentivized to forge both forks because it’s not computationally costly. Nodes could get their reward regardless of the fork’s outcome, committing a double-spend. This problem remains hypothetical, but a problem nonetheless.
Ethereum’s Casper Protocol
Ethereum started as a PoW system, but the team always planned to move to a PoS model.
These days, the Ethereum network experiences significant slow downs and volatile fees, making it unreliable to send and receive transactions. And since all nodes verify and execute transactions, one application can congest the whole network.
The change to PoS aims to remedy both Ethereum’s scalability issues and PoW’s problems. But to achieve this, Ethereum also had to address the Nothing at Stake problem.
The Casper protocol slashes validators’ stakes if they produce anything invalid, making it in their best interest to behave honestly. Casper will also punish validators who go offline, unintentionally, or not.
The Casper name actually refers to two projects. Casper the Friendly Finality Gadget (FFG) is a PoS layer atop Ethereum’s current PoW system. Casper the Friendly GHOST: Correction-by-Construction (CBC) is a long-term project using formal logic to research, model, and create a robust PoS consensus protocol.
This protocol overhaul, dubbed Serenity, will jumpstart Ethereum 2.0 with the PoS blockchain, Beacon Chain. However, Casper missed its January 2020 release date. It will take years for Casper to fully launch. But, if the Ethereum team proceeds with caution, then it’ll be worth the wait.