EIPs Explained

EIP-2982 · Final · Informational · 2020-09-15

EIP-2982: Serenity Phase 0

The informational EIP that documents Phase 0 of eth2: launching the proof-of-stake beacon chain alongside proof-of-work Ethereum, with validators onboarded through a deposit contract on mainnet.

What problem does it solve?

By 2020 Ethereum blocks were consistently full, and its proof-of-work consensus was energy-intensive and offered no economic finality. The long-term plan ("Serenity", or eth2) was to move to proof of stake and add sharding, but switching consensus on a live network in one step would be dangerous.

Phase 0 was the first, non-breaking step: build a new proof-of-stake chain, the beacon chain, in parallel, let it run and stabilize, and only later make it secure Ethereum itself. EIP-2982 records that plan and its key parameters on the EIPs side; the detailed rules live in the separate consensus-specs repository at release v1.0.0.

How it works

  • Deposit contract. Users join by sending ETH to a deposit contract on mainnet at 0x00000000219ab540356cBB839Cbe05303d7705Fa. The beacon chain agrees on that contract's state and processes new deposits. In Phase 0 this one-way deposit flow was the only link between the two chains; nothing in proof-of-work Ethereum changed.
  • Validators. A deposit names a BLS public key, withdrawal credentials and an amount. Validators propose and attest to beacon blocks, are rewarded for doing so well and penalized when offline. The standard validator size is 32 ETH.
  • Consensus. Casper FFG provides finality; LMD-GHOST is the fork-choice rule. BLS signature aggregation keeps the message load manageable with many validators.
  • Issuance. Rewards scale with the square root of total ETH staked (BASE_REWARD_FACTOR = 64), so the per-validator yield falls as more ETH is staked.
  • Penalties. An inactivity leak drains offline validators during long periods without finality, and slashing punishes provably malicious messages, scaled up when many validators are slashed together. Phase 0 launched with these deliberately softer than their intended final values.
  • Queues. Activations and exits are rate-limited per epoch so the validator set cannot change too quickly.

Phase 0 had no transfers, smart contracts or withdrawals; later phases were to add them.

Sample code

A beacon chain deposit is an ordinary call to the deposit contract (ethers v6). The data comes from a deposit tool such as staking-deposit-cli:

import { Contract, Wallet, JsonRpcProvider, parseEther } from "ethers";

const depositContract = new Contract(
  "0x00000000219ab540356cBB839Cbe05303d7705Fa",
  ["function deposit(bytes pubkey, bytes withdrawal_credentials, bytes signature, bytes32 deposit_data_root) payable"],
  new Wallet(process.env.PRIVATE_KEY!, new JsonRpcProvider(process.env.RPC_URL)),
);

// one entry from deposit_data-*.json (hex strings without 0x)
declare const d: { pubkey: string; withdrawal_credentials: string; signature: string; deposit_data_root: string };

const tx = await depositContract.deposit(
  "0x" + d.pubkey,
  "0x" + d.withdrawal_credentials,
  "0x" + d.signature,
  "0x" + d.deposit_data_root,
  { value: parseEther("32") },
);
await tx.wait();

Things to know

  • The roadmap described here changed. Execution sharding ("Phase 1/2") was dropped in favor of a rollup-centric design, and proof-of-work Ethereum joined the beacon chain through The Merge (EIP-3675) rather than as a shard.
  • Withdrawals described as future work arrived with EIP-4895; EIP-7251 later raised the maximum effective balance above 32 ETH.
  • Validator keys are usually derived with the paths in ERC-2334.
  • Sending ETH to the deposit contract is irreversible. Only use data generated by a trusted deposit tool, and double-check the withdrawal credentials.

#proof-of-stake #beacon-chain #consensus #staking #informational

Details

Authors
Danny Ryan (@djrtwo), Vitalik Buterin (@vbuterin)
Status
Final
Type
Informational
Created
2020-09-15
Required by

Machine-readable: Markdown · JSON