ETHEREUM

    Beginner’s guide to Ethereum 2.0

    27 July 2020. Written by JK

    In an attempt to improve scalability, security and decentralization, there are numerous changes coming to how Ethereum functions.

    What is Ethereum 2.0?

    Ethereum 2.0 is an ambitious multi-year network upgrade of Ethereum. Ethereum today has scalability issues with centralization concerns on how it is being secured. The upgrade to Ethereum 2.0 attempts to achieve better scalability, security and decentralization. Take a read through the design goals outlined on Ethereum 2.0’s official spec github or Vitalik’s write up on Serenity’s design rationale to learn more about the guiding principles of designing Ethereum 2.0. There are numerous upcoming changes to how Ethereum functions, but the following two are the most essential ones to understand.

    Proof of Stake

    Ethereum has miners who compete to solve a difficult math problem. The quickest solver is then able to add a new block to the longest observed chain. The amount of electricity and hardware that go into mining Ethereum is substantive, creating a high barrier to entry. It makes zero economic sense to mine Ethereum at home. Additionally, finality is probabilistic, meaning you will need to wait for other blocks to be built on top (also known as confirmations) before being certain that the block containing your transactions is part of the canonical chain.

    What if there is a more energy efficient way to add new blocks? What if we can lower the barrier for everyone to provide security to the network? What if finality could be achieved in a deterministic way? Proof of Stake addresses this by replacing miners with validators who can participate in the act of adding new blocks and finalizing blocks with only 32 ETH and minimal hardware. Validators take turns proposing blocks and voting on what blocks they believe to be correct. Newly issued ETH will be rewarded to honest validators while those who act maliciously will see their 32 ETH balance reduced.

    Sharding

    There is only one canonical Ethereum blockchain today. Unless blocks can include more transactions or blocks are created more frequently, the amount of transactions that Ethereum can process will be limited.

    What if there are 64 other identical blockchains working together? This is called sharding. With sharding, nodes will no longer need to process all the information and transactions of the entire network. They would only need to process those on the shard (blockchain) that they are on, enabling a path towards higher scalability. Can you imagine how quicker things would be if today’s Ethereum network was split into 64?

    Conducting this transition on an already live network housing billions of dollars worth of economic assets is no easy feat. This is why the upgrade will be rolled out in Phases. Each Phase includes at least one critical upgrade and serves as a stepping stone to the next.

    What are the Phases of Ethereum 2.0?

    There are three Phases planned for the roll out of Ethereum 2.0.

    Phase 0: Beacon Chain (expected in the second half of 2020)

    The Beacon Chain is a Proof of Stake blockchain that marks the beginning of Ethereum 2.0. Eventually this chain will be the main coordinator of all the shards that will be deployed in Phase 1. The Beacon Chain will run alongside the Proof of Work Ethereum blockchain (also referred to as Ethereum 1.x). ETH holders will be able to move their ETH over to the Beacon Chain using a one-way deposit contract from Ethereum 1.x and start running validators. No other actions aside from validating will be possible during this Phase.

    Phase 1: Sharding (expected in 2021)

    Sharding will be turned on. There will be 64 shards (blockchains) that will run in parallel, coordinated by the Beacon Chain. Ethereum 1.x will be merged with Ethereum 2.0 at some point during this Phase. This upcoming merge is also referred to as Phase 1.5.

    Phase 2: Execution

    Ethereum 2.0 will start functioning very similarly to Ethereum today with smart contracts enabled.

    The basics of Ethereum 2.0 Proof of Stake

    Basics of Ethereum 2.0

    In Ethereum 2.0 Proof of Stake, blocks can be created every slot, which lasts 12 seconds. The network will randomly select one validator to be the proposer for each slot. If the validator misses the opportunity to propose a block at their assigned slot, the network will simply have no block for that slot and will progress to the next slot.

    During each slot, validators will take turns submitting attestations, which are votes on what they believe to be the canonical chain. These votes are used to determine the current height of the chain. They are also used to finalize blocks every 32 slots, also called an epoch. Each validator will get to submit their attestations once every epoch. There are specific rules that must be met for finality, one of which is that finality requires at least 2 epochs (≈ 12.8 minutes), but they are out of scope for this article and will be discussed in-depth in a follow up article.

    Validators will also be monitoring each other for malicious behaviors. If they observe another validator propose two blocks in the same slot or submit attestation votes that contradicts itself, they can alert the network. The network will reward the whistleblower for being a good citizen and will slash the violator for attempting to harm the network.

    To participate as a validator in Phase 0, you will need exactly 32 ETH. You will need to deposit this amount to a deposit contract on Ethereum 1.x. When interacting with the deposit contract, you will also be prompted to provide two Beacon Chain public keys: a withdrawal key and a validator key. As the names indicate, the validator key is responsible for performing the duties of a validator while the withdrawal key is able to withdraw any funds out of the validator. Withdrawals are currently not planned to be instituted until at least Phase 1.

    The basics of Ethereum 2.0 rewards, penalties and slashing

    Basics of Ethereum 2.0

    Similar to Proof of Work, Proof of Stake rewards participants with inflationary rewards, issuing new ETH to validators for conducting the work to propose and finalize blocks. Rewards, penalties and slashing are processed every epoch.

    Properly submitting attestations and including other validator attestations when proposing blocks can yield a validator anywhere from 2% up to 22% in staking rewards, depending on how much of the entire network is staked (also referred to as the staking ratio).

    Submitting incorrect attestation votes or failing to submit attestations at all (i.e. being offline) could lead to penalties. Validators will lose 67K Gwei (≈ 0.000067 ETH) for each epoch they are offline for. The penalty amounts have been intentionally set low so that honest validators with low connectivity can still be netting positive staking rewards. There is another penalty mechanism called the inactivity leak which kicks in if the entire network is unable to reach finality for a sustained period. Since this is not expected to occur frequently, the inactivity leak will be discussed in a follow up deep dive article.

    A validator can be slashed for committing actions that severely threaten the security of the network. Proposing two blocks in the same slot or submitting contradicting attestation votes are all slashable offenses. Once a validator is slashed, that validator is automatically forced to exit from the active validator set after 8,192 epochs (≈ 36 days). That validator will also have their ETH balance decreased every single epoch until they are out of the active set. The slashed validator will see their ETH balance decrease anywhere from 3% to 10%, depending on the staking ratio and how many validators get slashed around a similar time frame.

    Written by JK

    JK

    Twitter