Ethereum 2.0 - A Complete Guide
Casper the Friendly Ghost in blockchain? Here is everything you need to know about Ethereum 2.0 (Serenity).
What is Ethereum 2.0?
Ethereum 2.0 (also known as “Serenity”) refers to the next major upgrade of the core Ethereum blockchain, offering several improvements to Ethereum’s current protocol, or “Layer 1”. More specifically, Ethereum 2.0 has two major goals:
Migrate its consensus mechanism from Proof-of-Work to Proof-of-Stake, which will eliminate the need for expensive PoW mining.
Introduce Sharding, an attempt to improve the speed and throughput of ETH transactions.
Instead of trying to build these upgrades directly onto the mainnet, Ethereum 2.0 will build out a new, separate platform from the main chain that will eventually replace it in the future.
Why is Proof-of-Stake?
Ethereum, Bitcoin and many cryptocurrencies are running on a Proof-of-Work protocol.
In this consensus system, the miners solve cryptographic puzzles to “mine” a block so as to add it to the blockchain. When a miner solves a puzzle using their computing processing power, they present their block to the network for verification. The first miner to solve the puzzles gets a reward for their work.
However, there are some fundamental flaws in this kind of system:
The process of mining literally eats up an immense amount of energy and computational usage.
Companies and individuals who can afford more powerful ASICs (application-specific integrated circuits) with faster processing usually dominate the mining share than others. This practice makes the system isn’t as decentralized as it tends to be. The graph below shows the market share of the most popular bitcoin mining pools recently, reported by Blockchain.com:
Here is the hashrate distribution of the largest mining pools in Ethereum, according to Etherchain.org:
Theoretically, these big mining pools can successfully launch a 51% attack on the network if they team up with each other. Now, that's concerning right?
This is why Proof-of-Stake comes to the picture.
Proof-of-Stake will make the entire mining process virtual as well as replace miners with 'validators'. The primary advantages of PoS include energy efficiency, security and achieving another level of decentralization.
This is the way it will work:
To become a validator, you will have to lock up some of the blockchain-based currency as stake.
Instead of ‘mining’, validators will take turns proposing and voting on the next block by placing their bets on it. The value of each vote depends on the size of its deposit that the validator puts in. If the block gets appended, the validator will get a reward proportionate to their bets.
The process of creating and verifying new blocks is done through a consensus algorithm wherein all current validators can participate.
Advantages of Proof of Stake:
Reduces the overall energy and monetary cost. According to Digiconomist, bitcoin mining currently consumes 73.12 terawatt-hours (TWh) per year. That’s comparable to the total energy consumption of Austria, a country of 8.9 million people! Imagine how much money miners spend per year on using such significant amount of power - $7,430,140,088 U.S. Dollar it is. On the other hand, Proof of Stake makes the transaction process completely virtual and cuts off all these costs.
Reduces centralization risks as in the Proof of Stake mechanism, there will be no ASIC advantage. This means the whole process wouldn’t depend on who owns better equipments or ASICs, achieving a whole new level of decentralization.
Uses economic penalties to negate the 51% attacks, making various forms of 51% attacks vastly more expensive to carry out than Proof-of-Work.
Proof of Stake made simple with Casper
Casper FFG (also known as Vitalik’s Casper) is a hybrid PoW/PoS consensus mechanism. Between the two versions of Casper - Casper FFG and Casper CBC (Vlad Zamfir’s Casper), Casper FFG is going to be implemented first.
Casper FFG is designed to ease the transition into proof-of-stake by overlaying on top of the normal ethash proof-of-work protocol. Every 50th block mined in the PoW is going to be a PoS checkpoint where finality is assessed by a network of validators.
Casper has implemented a process by which Ethereum 2.0 can punish all malicious elements. Anyone who acts in a malicious manner will get immediately punished by having their stake slashed off. This is what makes it differs from most other PoS protocols.
Recently, there are two types of punishment:
Inactivity leaks: if your validator node goes offline for 18 days, and the beacon chain is not finalizing, then your balance will be reduced by up to 60.8% slash in 18 days.
Slashing: if a validator behaves provably maliciously, then they are slashed by having their balance reduced. Minimum penalty is 1 ETH, but it goes up linearly in the number of people slashed at the same time as you.
Ethereum 2.0 Roadmap and Phases
There are seven distinct phases for Ethereum 2.0, which will likely take several years to implement. It’s important to keep in mind that this upgrade will not take place at a single point in time but instead, it will be rolled out in phases. Most of these phases are still in research, without clear technical specifications.
However, before developers can build on Ethereum 2.0, there are three phases that will need to be completed initially:
Phase 0 — Beacon Chain
The Beacon Chain is a proof-of-stake chain that will run parallel to Ethereum’s proof-of-work chain. The chain will manage the Casper protocol for itself and all of the shard chains. Initially, the Beacon Chain will be engineered for simplicity and will support neither smart contracts nor accounts. In this phase, Casper the Friendly Finality Gadget (FFG) will be used for finality. Finality, in very loose terms, means that once a particular operation has been done, it will forever be etched in history and nothing can revert that operation.
Phase 1 — Shard Chains
Shard chains are the key to the future of scalability. Sharding is intended to help transactions scaled by dividing the network across multiple shards, allowing the network to process many transactions concurrently.
Sharding is a term that often seen in database systems. Supposedly, you have a huge bulky database for your website, which not only makes searching for data slower, but it also hinders your scalability. What if you do a horizontal partition on your data and turn them into smaller tables and store them on different database servers? Let’s take a look at this example:
By splitting a state (the ‘combined data root”) and history of Ethereum into partitions that we call “shards”, the system can process many transactions in parallel as there exists some forms of cross-shard communication capability, where transactions on one shard can trigger events on other shards. As a result, sharding will greatly increase the blockchain’s throughput.
However, if we are using PoW, the smaller shards can be easily taken over by malicious miners due to their low hashrates. This is the biggest reason why PoW mechanism can never implement sharding. In PoS, this risk is completely mitigated, since it doesn’t have the concept of mining.
Phase 2 — eWASM
The staged rollout of Ethereum 2.0 is intended to test each upgrade to the protocol in a safe environment without compromising security.
Why would I want to stake my ETH?
For staking your ETH and attesting to correct blocks, you will be rewarded with ETH through a network wide interest rate and receive a portion of network transaction fees. You can find more details at EthHub.
What are the requirements to stake?
A minimum of 32 ETH per validator
Computer with sufficient hardware specs
What happens if I lose my internet connection while staking?
The key to being a validator is to ensure that you are consistently available to vote for blocks which in turn secures the network. Therefore, there is a slight penalty if your validator client goes offline at any point, in order to encourage validator availability. There are two scenarios where this can happen:
If blocks are finalizing and you're offline, you can lose x% of your deposit over a year where x=current_interest
For example, if the current interest rate is 5%, you would lose 0.0137% of your deposit every day, but gain that for every day you're online.
If blocks aren't finalizing (>33% of validators are offline) and you're offline, you can lose 60% in 18 days.
If your deposit drops below 16 ETH at any point, you will be removed from the validator set enti