EIPs Explained

EIP-4488 · Stagnant · Core · 2021-11-23

EIP-4488: Transaction calldata gas cost reduction with total calldata limit

A 2021 proposal to cut calldata gas from 16 to 3 per byte for cheaper rollups, while capping total calldata per block so worst-case block size stays safe; superseded in practice by blob transactions.

What problem does it solve?

Rollups post their transaction data to Ethereum as calldata, and in late 2021 that data was the main part of their cost. Data sharding was the long-term fix but was far away. EIP-4488 proposed a quick, short-term way to make rollup data much cheaper.

Simply lowering the calldata price is dangerous. With a 30M gas limit and 16 gas per byte, a block can hold at most about 1.875 MB of calldata. Dropping the price to 3 gas per byte without anything else would allow roughly 10 MB blocks, which the spec warns could strain or break the p2p network.

How it works

Three parameters:

Parameter Value
NEW_CALLDATA_GAS_COST 3 gas per byte (zero and non-zero bytes alike)
BASE_MAX_CALLDATA_PER_BLOCK 1,048,576 bytes
CALLDATA_PER_TX_STIPEND 300 bytes per transaction
  • Calldata costs a flat 3 gas per byte, instead of 4 for zero bytes and 16 for non-zero bytes (EIP-2028).
  • A new block validity rule caps total calldata: the sum over all transactions must not exceed 1 MiB plus 300 bytes for each transaction in the block.

This makes block building two-dimensional (gas and calldata). The spec argues that is acceptable because, after EIP-1559, builders mostly include every transaction that pays enough, and the 300-byte stipend covers about 90 % of ordinary transactions, so a builder who hits the calldata cap can still fill the block with small transactions.

Sample code

The block validity check and the new calldata cost, as pseudocode:

NEW_CALLDATA_GAS_COST = 3
BASE_MAX_CALLDATA_PER_BLOCK = 1_048_576
CALLDATA_PER_TX_STIPEND = 300

def calldata_gas(tx) -> int:
    return len(tx.data) * NEW_CALLDATA_GAS_COST  # was 4 per zero byte, 16 per non-zero byte

def block_calldata_ok(block) -> bool:
    total = sum(len(tx.data) for tx in block.transactions)
    limit = BASE_MAX_CALLDATA_PER_BLOCK + len(block.transactions) * CALLDATA_PER_TX_STIPEND
    return total <= limit

Things to know

  • Status is Stagnant: it was never activated on mainnet.
  • Rollup data costs were instead addressed by EIP-4844 (blob transactions), which gives rollups a separate, cheaper data space with its own fee market.
  • The direction later reversed for calldata: EIP-7623 raised the cost for data-heavy transactions to push data into blobs.
  • The spec notes average data growth would raise history storage needs (worst case about 3 TB per year) and recommends history expiry such as EIP-4444 alongside it.

#gas #calldata #rollups #scaling #core

Details

Authors
Vitalik Buterin (@vbuterin), Ansgar Dietrichs (@adietrichs)
Status
Stagnant
Type
Standards Track / Core
Created
2021-11-23

Machine-readable: Markdown · JSON