EIPs Explained

EIP-7804 · Draft · Core · 2024-10-31

EIP-7804: Withdrawal Credential Update Request

A new execution-layer request (type 0x03) that lets a validator change its withdrawal address, or switch between 0x01 and 0x02 credentials, without exiting and re-staking.

What problem does it solve?

Since Capella, a validator's withdrawal credentials point to an execution-layer address, and they can be set only once (from the original BLS credentials). After that, they are fixed forever. Stakers have long asked to change them, for example to rotate a possibly compromised key or to move withdrawals to a smart contract.

This matters more since Pectra. Execution-layer requests (EIP-7685) let the withdrawal-credential address trigger exits and partial withdrawals (EIP-7002) and consolidations (EIP-7251), with the request authorized by whichever address calls the system contract. A validator whose credentials are a plain EOA can never hand that control to a smart contract (for multisig, DAO or protocol management) without exiting and depositing again. EIP-7804 adds the missing "change my withdrawal address" request.

How it works

It follows the same pattern as the other Pectra request contracts:

  • Request contract. A predeployed system contract accepts a 68-byte call: the validator's 48-byte BLS pubkey plus the 20-byte new_address. The caller (msg.sender) is recorded as old_address. Requests are queued, and a fee that rises with demand (the same excess-based design as EIP-7002) limits spam. An empty call returns the current excess count.
  • Block processing. At the end of each block, the client calls the contract from the system address to dequeue up to MAX_..._PER_BLOCK (4) requests, and includes them in the block's request list as type 0x03.
  • Consensus layer. For each request, the beacon chain checks that the validator exists, has execution credentials, and that old_address matches its current withdrawal address. If so, it rewrites the credentials as prefix ‖ 11 zero bytes ‖ new_address, where the prefix is 0x01 (regular) or 0x02 (compounding).

Moving from 0x01 to 0x02 would reuse the existing switch-to-compounding logic, including the churn rules. The spec marks this as a TODO.

Because authorization is "the current withdrawal address called the contract", only whoever controls that address (its private key, or the contract at that address) can change it.

Sample code

Submitting a request from the current withdrawal address (ethers v6). The contract address and fee query are taken from the draft and may change:

import { Wallet, JsonRpcProvider, concat, getBytes } from "ethers";

const REQUEST_CONTRACT = "0x09Fc772D0857550724b07B850a4323f39112aAaA"; // per current draft
const provider = new JsonRpcProvider(process.env.RPC_URL);
const withdrawalKey = new Wallet(process.env.WITHDRAWAL_KEY!, provider); // must be the CURRENT credential address

const pubkey = "0x" + "ab".repeat(48);                         // validator BLS pubkey (48 bytes)
const newAddress = "0x1111111111111111111111111111111111111111"; // e.g. a Safe

const data = concat([pubkey, newAddress]);
if (getBytes(data).length !== 68) throw new Error("bad input");

const tx = await withdrawalKey.sendTransaction({
  to: REQUEST_CONTRACT,
  data,
  value: fee, // request fee; exact fee rules are not finalized in the draft
});
await tx.wait();

Things to know

  • Status is Draft, with large TODOs: contract bytecode, the full consensus spec, rationale, backward compatibility and tests are missing. FORK_TIMESTAMP is TBD and it is not scheduled for any upgrade.
  • The draft is not fully consistent: the request has no field for the new credential prefix (0x01/0x02), yet the consensus pseudocode reads one. Expect the format to change.
  • Anyone who controls your withdrawal address could redirect future withdrawals, so a leaked withdrawal key would become more dangerous than it is today, where at worst it can trigger exits and withdrawals to that same address.
  • BLS (0x00) credentials are out of scope. They still use the existing BLS-to-execution change.

#staking #validators #withdrawals #execution-requests #core

Details

Authors
Lucas Saldanha (@lucassaldanha), Mikhail Kalinin (@mkalinin)
Status
Draft
Type
Standards Track / Core
Created
2024-10-31

Machine-readable: Markdown · JSON