In Brief:
- A decentralized network like cryptocurrencies requires a consensus algorithm for decision-making purposes.
- Satoshi Nakamoto found the ideal consensus algorithm for cryptocurrencies with the proof-of-work (PoW) algorithm.
- PoW isn’t the most scalable of solutions and is incredibly wasteful.
- PoS is a system wherein the validators lock up a stake within the network and are randomly selected to add blocks to the Ethereum chain.
- Not only is PoS entirely virtual, but it’s also more scalable and necessary for the implementation of other scalability techniques like sharding.
With Ethereum 2.0 right around the corner, everyone is reading up on proof-of-stake (PoS) and its changes to the ecosystem. As things stand, the transition to PoS is already underway, with Ethereum successfully launching the beacon chain in December 2020. The beacon chain already has 108,544 active validators who have staked around 3.47M ETH tokens. So, as we stand at the cusp of an event that’s been nearly 5 years in the making, let’s take a look behind the scenes.
What Exactly Is a Consensus Algorithm?
One of the major issues with a decentralized network, spread over a wide area network (WAN), is decision-making. After all, unlike a company, there aren’t any CEOs or board of directors taking care of business-critical decisions. This is where consensus algorithms come in.
“Consensus” is a process of decision-making in which the participants develop and decide on proposals that the entire group organically accepts. As such, it’s supposed to be a more inclusive process than simple voting. In blockchain networks, a consensus is reached through a consensus algorithm, which is a set of rules to be followed when agreeing on new blocks’ contents.
However, here is the catch, since blockchain networks deal with millions and billions of dollars worth of money, we require a consensus algorithm that’s secure and robust enough to work even if a vast amount of its nodes turn dishonest and work against the system.
Satoshi Nakamoto solved this quandary when they created Bitcoin by coming up with the proof-of-work (PoW) algorithm.
What Is PoW and Why Is It Inefficient?
Proof-of-Work or PoW allows nodes with specialized equipment, called “miners” to use their computational resources to solve cryptographically hard puzzles. To better understand this, here is a quick overview of how the process works:
- The miner picks up transactions that are waiting in the mempool and organizes them in a block.
- The network pre-determines a value called “difficulty.”
- The miner hashes the block’s contents, prefixes the hash with a random value called “nonce,” and hashes the entire block again.
- Following that, the miner checks if this hash is less than the difficulty or not. If not, they keep changing the nonce value until they get a hash that’s less than the difficulty.
- Upon successfully adding the block, the miner gets a block reward for their efforts.
While the PoW algorithm is proven and secure, it does have loads of limitations:
- It is extremely wasteful since it uses real-world energy resources. The entire Bitcoin network consumes more energy than the entire country of Switzerland.
- PoW has been made cryptographically hard by design to ensure high levels of security. However, this makes it incredibly hard to scale up.
- Four Bitcoin mining pools – Poolin, F2Pool, AntPool, and Huobi.pool – currently own 50% of the Bitcoin hashing power. These pools could potentially team up and take control of the Bitcoin network.
Proof-of-Stake – A Cleaner and Faster Alternative
Image: Hackernoon
Modern blockchain networks use Proof-of-Stake or some version of it for their consensus mechanisms. In this system, validators (users selected to mine or validate block transactions) are chosen via various random selection combinations and wealth or coin age. In this system, the mining procedure is completely virtual, and the individual node’s hashrate is directly proportional to their stake instead of individual computational power.
How Does Proof-of-Stake Work?
Usually, PoS algorithms fall under two schools of thought:
- Largest Stake-Based: In this system, the node with the largest stake will have more opportunities to validate blocks. While this is pretty straightforward, the problem with this approach is that it leads to the centralization of hashing power.
- Coin Age-Based: Coin age is the product of the number of coins multiplied by the number of days the coins have been held. In this system, users whose stake has been dormant for a larger amount of days have a higher chance of becoming a validator. Once a coin has been used to sign a block, its coin age becomes zero.
Proof-of-Work vs Proof-of-Stake: What Are the Advantages of PoS?
#1 Energy Conservation
We have already brought this topic up multiple times, but it is quite a major issue with Bitcoin and PoW. Checkout this chart below.
Image:Digicomist
As you can see, only 38 more countries consume more power than Bitcoin, which is a staggering stat.
The bizarre part about this whole equation is that PoW is wasteful by design. Since you need to spend so much energy, it keeps the bad actors out of the system. However, PoS is entirely virtual, so you don’t need to spend any real-life resources. This energy efficiency can also incentivize more people to run nodes, thus making the network more decentralized.
#2 Economic Incentive
Now, you may argue that by taking away the whole energy wastage aspect, PoS is a lot less secure than PoW, right? Well…not really.
Since the validators are forced to lock up a significant portion of their tokens within the system, they have an incentive to work in the system’s interest, not to harm the overall valuation of their stake. After all, why would you attack a network and harm the coin’s value when you have so much skin in the game?
Also, certain PoS implementations like Ethereum’s Casper have an integrated slashing mechanism that cuts off a portion of a validator’s stake if they act against the system’s interest.
#3 Mitigating Economies of Scale
In economics, there are two kinds of productions – short-run and long-run. In short-run productions, one of the input resources is fixed, while in long-run production, like mining, the resources are variable.
In long-run production, there are three outcomes or returns to scale. Let’s assume that we 2X the input resources. These are three outcomes we will see:
- The output more than doubles with increasing return to scale.
- The output doubles, which is a fixed return to scale.
- The output does not double, showing decreasing returns to scale.
The graph below shows us the standard economies of scale wrt long-run production systems.
Image: Wikipedia
So, what’s going on here?
- When production increases from Q to Q2, the production’s overall cost goes down from C to C1.
- Following that, the curve flattens for a bit.
- After that, the cost increases as you increase the output beyond Q2.
The critical lesson to learn from this is that, until a particular limit, large corporations can decrease their products’ average cost by increasing the number of their outputs. This means that a large, influential mining pool can, dollar-for-dollar, generate more hashrate than other smaller pools even if they spend the same amount of money.
This problem gets naturally mitigated in PoS since you are not buying a resource with your money. Money is the resource itself.
No matter what you do, at the end of the day 1 dollar = 1 dollar. Simply put, economies of scale don’t work here.
#4 Other Scaling Techniques Need PoS
Sharding is one of the most exciting scalability techniques out there. The reason why it’s so interesting is that it will be implemented in layer-1 itself instead of layer-2. The idea is to break down a block’s state into multiple different shards and solve them in parallel. This will be pretty difficult in sharding because the overall hashing power will get fragmented as well, which will make it easier for malicious miners to take control. This is why PoS is required for the smooth implementation of sharding since the hash power here will be directly proportional to the stake, not computational power.
Conclusion – When Will Ethereum Switch to Proof-of-Stake?
The lack of scalability is a significant problem for both Bitcoin and Ethereum.
While Bitcoin manages a measly 7 transactions per second, Ethereum can only do 15-20 transactions per second at best. One should note that developers can only build sophisticated DeFi apps on top of Ethereum if the underlying protocol itself is scalable enough to sustain it. This is why the transition to a PoS system is necessary for the overall evolution of the crypto ecosystem.
As things stand, Ethereum’s proof-of-stake may actually be on the way faster than you think. The reason behind this rush is to contain the negative sentiment that may come from the implementation of the EIP-1559 proposal in July “London” hard-fork. We will be covering EIP-1559 soon, next, so be on the lookout for that.
In the meantime, if you liked what you read here then do share it with your folks!