EIPs Explained

EIP-7799 · Draft · Core · 2024-10-29

EIP-7799: System logs

Emits protocol-level logs for ETH movements that have no transaction, such as fees, priority rewards and withdrawals, so eth_getLogs can show every change to an ETH balance.

What problem does it solve?

EIP-7708 makes plain ETH transfers emit logs, so a wallet can track ETH the same way it tracks ERC-20 tokens: with eth_getLogs. But some ETH balance changes are not caused by any transfer inside a transaction:

  • the fee a sender pays for gas,
  • priority fees credited to the block's fee recipient,
  • validator withdrawals from the beacon chain (EIP-4895),
  • genesis allocations.

Today a wallet has to fetch every block header and every withdrawal list to be sure it hasn't missed anything. EIP-7799 makes these events show up as logs too.

How it works

All new logs are emitted from SYSTEM_ADDRESS (0xff…fe, as used in EIP-4788), which no user contract can impersonate. Each looks like a LOG2 with the account in topics[1] and the wei amount in data:

Event When
Fee(address,uint256) Per transaction, appended after its own logs: total fee paid (base + priority + blob)
PriorityRewards(address,uint256) When batched priority fees are credited (EIP-8115)
Withdrawal(address,uint256) For every beacon-chain withdrawal
Genesis(address,uint256) Genesis allocations, for new networks adopting this from the start

Fee lives in the transaction's receipt. The others go into a new per-block system logs list, an SSZ ProgressiveList of the EIP-6466 Log type. Its root becomes a new header field, system_logs_root, also added to the Engine API and consensus ExecutionPayload and checked like receiptsRoot.

Over JSON-RPC, system logs get logIndex values after the transaction logs, and transactionHash / transactionIndex set to null.

Sample code

Fetching all system-log withdrawals to an address (ethers v6):

import { JsonRpcProvider, id, zeroPadValue, toBigInt } from "ethers";

const provider = new JsonRpcProvider(process.env.RPC_URL);
const SYSTEM_ADDRESS = "0xfffffffffffffffffffffffffffffffffffffffe";

const logs = await provider.getLogs({
  address: SYSTEM_ADDRESS,
  topics: [id("Withdrawal(address,uint256)"), zeroPadValue(myAddress, 32)],
  fromBlock: start,
  toBlock: "latest",
});

for (const log of logs) {
  // transactionHash is null for system logs
  console.log(log.blockNumber, toBigInt(log.data), log.transactionHash);
}

Things to know

  • Status: Draft. The spec says the log definitions themselves may still change, for example to align with ERC-20 Transfer or deposit-log formats.
  • It depends on several other drafts (EIP-6466 SSZ receipts, EIP-7916 progressive lists, EIP-8115 batched priority fees) and only makes sense alongside EIP-7708.
  • Adding a header field breaks tools that assume a fixed header layout.
  • Withdrawal data would temporarily be duplicated in both the withdrawals list and system logs; retiring the list is mentioned as a possible future step.

#logs #json-rpc #withdrawals #wallets #core

Details

Authors
Etan Kissling (@etan-status), Gajinder Singh (@g11tech)
Status
Draft
Type
Standards Track / Core
Created
2024-10-29
Requires
Required by

Machine-readable: Markdown · JSON