EIP-1011 Hybrid Casper FFG

No call decision · Consensus & staking · EIP status Stagnant · created 2018-04-20

A hybrid PoW/PoS transition proposal that leaves proof-of-work (PoW) mining in place while layering a Casper FFG contract on top, in which validators who have deposited ether vote every 50 blocks to permanently finalize checkpoints.

Why it is needed

Proof-of-work (PoW) consumes large amounts of energy and has problems such as concentration of mining hardware or mining-pool dominance. More fundamentally, PoW has no 'finality.' A block becomes harder to reverse the deeper it is buried, but in theory a longer chain could always appear and overturn it. The Casper the Friendly Finality Gadget (Casper FFG) paper, published in October 2017, introduced the concept of economically irreversible 'finality' by having validators deposit ether that is subject to slashing conditions. This EIP leaves the block-production mechanism as PoW and layers a Casper FFG contract on top of it, a conservative, staged transition meant to test the mechanism on the network before moving fully to proof of stake.

What changes

Today

After EIP-1011

Who is affected

In depth

Checkpoints and finality

Casper FFG votes only on 'checkpoints,' not on every block. A checkpoint is the last block of each epoch, where an epoch spans EPOCH_LENGTH (50 blocks). When validators finalize a given checkpoint, all of that checkpoint's ancestor blocks are implicitly finalized along with it. Under PoW, a block only becomes harder to revert the deeper it is buried, with no point of absolute irreversibility, whereas a checkpoint finalized by FFG becomes a point that clients will never revert. Dynasty is a value that counts the number of finalized checkpoints from the root up to a given block's parent, and is used to define when a validator starts and stops voting.

Deploying and initializing the Casper contract

At the hard-fork block (HYBRID_CASPER_FORK_BLKNUM), before transaction processing, bytecode is planted at MSG_HASHER_ADDR, PURITY_CHECKER_ADDR, and CASPER_ADDR respectively, and the CASPER_ADDR balance is set to CASPER_BALANCE (1.25e24 wei, 1.25 million ETH). NULL_SENDER then sends a CALL to CASPER_ADDR with CASPER_INIT_DATA and a gas limit of 3141592 to initialize the contract. This CALL consumes no gas and does not increment NULL_SENDER's nonce. Rather than running a constructor via a normal CREATE, this approach explicitly invokes a one-time-callable init method on pre-placed bytecode, because the contract needs to be planted at a specific address outside normal block processing, and this avoids requiring every client to special-case CREATE.

Vote transactions and zero-gas processing

A vote transaction is valid only if TO is CASPER_ADDR, DATA starts with VOTE_BYTES, the signature takes the form (CHAIN_ID, 0, 0) (r=s=0, v=CHAIN_ID), and value, nonce, and gasprice are all 0. Valid votes are batched together at the very end of the block, and their gas usage is tallied separately from ordinary transactions' gas_used as vote_gas_used, which likewise cannot exceed block_gas_limit. When a vote is applied, the sender is set to NULL_SENDER and the nonce is not incremented. Because ordinary transactions cannot affect a vote's validation result while a vote's result can affect ordinary transaction execution, an asymmetric relationship, the two can be processed in parallel, so validators can send votes even during congested periods without being charged gas for voting. A vote that fails cannot be included in a block in the first place.

Fork choice rule and finalization processing

When --casper-fork-choice is enabled, fork choice does not compare total_difficulty alone but instead compares the value of highest_justified_epoch (looked up from the block's Casper contract, counted only once at least NON_REVERT_MIN_DEPOSIT has been deposited) x 10^40 + total_difficulty. The 10^40 multiplier ensures the justified epoch always takes priority over mining difficulty, with total_difficulty only breaking ties between blocks that share the same justified epoch. A client never reverts a block it has already finalized, and whenever a new block becomes head, it looks up the Casper contract's highest_finalized_epoch, and if that has increased, records that epoch's checkpoint_hashes as the new finalized block. For a client with no justified checkpoint, highest_justified_epoch returns 0, effectively falling back to pure PoW fork choice.

Gradual block reward reduction and issuance

After HYBRID_CASPER_FORK_BLKNUM, the PoW block reward decreases by NEW_BLOCK_REWARD (0.6 ETH) every REWARD_STEPDOWN_BLOCK_COUNT (about 3 months, 5.5e5 blocks), stepping down from 5x (3.0 ETH) through 4x, 3x, and 2x to a final 1x (0.6 ETH) over roughly a year. This reflects security shifting from PoW difficulty to FFG finality, with the reward split between miners and validators. A miner receives an additional issuance reward equal to 1/8 of what validators receive, in exchange for including successful vote transactions in a block on time, and under optimal conditions miners' share of the total ETH issued by the Casper contract is about 1/5. The Casper contract's CASPER_BALANCE is 1.25 million ETH, which, assuming total deposits of about 10 million ETH, corresponds to roughly two years of operating funds; like the difficulty bomb, this is a mechanism meant to push the network to upgrade the contract and move to full PoS before the funds run out.

Rationale for key contract parameters

EPOCH_LENGTH is set to 50 blocks as a balance point between time to finality and message overhead, and WARM_UP_PERIOD is set to about one month (180,000 blocks) for validators to complete their initial deposits, preventing a degenerate situation where there are too few validators before voting begins. WITHDRAWAL_DELAY is 15000 epochs (about 4 months), which guarantees time to detect and slash a logged-out validator who voted for conflicting checkpoints, and also defines the period during which a new client must sync under weak subjectivity. DYNASTY_LOGOUT_DELAY (700 dynasties) prevents the strategy of logging out immediately during an attack. BASE_INTEREST_FACTOR (7e-3) is designed to give validators a reward of about 5% annually assuming total deposits of about 10 million ETH, while BASE_PENALTY_FACTOR (2e-7) is designed so that if 50% of deposits go offline, within about 3 weeks half of them lose half their deposit, restoring the online side to a 2/3 majority. MIN_DEPOSIT_SIZE (1500 ETH) caps vote message overhead by bounding the votes clustered within 37 blocks after the first quarter of an epoch to about 24 per block, assuming roughly 900 validators given total deposits of about 10 million ETH.

Slashing conditions and monitoring

A validator signs a vote message consisting of validator_index, target_hash, target_epoch, source_epoch, and signature. If two votes point to the same target_epoch (same_target_epoch), or if one vote's target/source range completely surrounds another vote's range (surrounds), this is treated as a violation of the slashing conditions and can be checked with casper.slashable(). A client with --monitor-votes enabled can watch for such violations and submit the evidence as a slash transaction; whoever submits first burns that validator's deposit and simultaneously receives a 4% whistleblower reward. This setting defaults to off, because a block producer can almost always get its own slash transaction into a block ahead of other submitters (front-running), so not every node needs to monitor for it.

NULL_SENDER account abstraction and state / fork inclusion

When depositing into the Casper contract, a validator can specify its own signature contract, so through the limited account abstraction approach borrowed from EIP-86 it can use its own signature scheme for votes, such as quantum resistant signatures, multisig, or threshold signatures. This EIP is a backwards incompatible change that alters state, the fork choice rule, block rewards, transaction validity, and gas calculation, so it must be applied all at once at HYBRID_CASPER_FORK_BLKNUM via a scheduled hard fork. The current status of this EIP is Stagnant, and many parameters, including the actual bytecode for CASPER_CODE, MSG_HASHER_CODE, and PURITY_CHECKER_CODE, and HYBRID_CASPER_FORK_BLKNUM, remain TBD, so they may change or this EIP may not be adopted. The provided call records contain no decision on whether to include this EIP in a fork.

Original EIP · ← EIPs