EIP-8032 · Draft · Core · 2025-09-29
EIP-8032: Size-Based Storage Gas Pricing
Makes SSTORE more expensive for contracts that already own a huge number of storage slots, by tracking a per-account storage_count, to discourage state bloat.
What problem does it solve?
Ethereum's state keeps growing, and every node must store it forever. Today writing a new storage slot costs roughly the same whether a contract owns ten slots or tens of millions, even though updates to very large storage tries cost clients more work and slow state-root computation. That makes it cheap to use huge contracts for data anchoring or spam.
EIP-8032 links the price of writing storage to how much storage a contract already has, so contracts that grow disproportionately pay more, while small and medium contracts are unaffected.
How it works
New account field. The account RLP gets an optional storage_count: the number of non-zero storage slots the account owns. It is omitted when zero and costs at most a few bytes per account.
Keeping it up to date. After each block, clients adjust storage_count by the net change for every slot written in that block: +1 for zero → non-zero, −1 for non-zero → zero.
Back-filling existing contracts. At the fork, an in-protocol transition walks all accounts and their slots in hash order, a bounded number per block, and writes the counts. Its cursor lives in a system contract, so it is deterministic and reorg-safe.
Pricing. Each SSTORE uses the account's storage_count from the block's pre-state, constant for the whole block so ordering does not change gas:
cost = constant_sstore_gas(addr, slot)
+ LIN_FACTOR * ceil_log16(S_pre(addr)) // ACTIVATION_THRESHOLD
ACTIVATION_THRESHOLD is meant to correspond to about 8 GB of data, so only extreme contracts are affected. LIN_FACTOR and other parameters are still TBD.
Sample code
The per-slot delta rule from the spec:
def calculate_storage_delta(prestate_value, poststate_value):
if prestate_value == 0 and poststate_value != 0:
return 1 # slot created
if prestate_value != 0 and poststate_value == 0:
return -1 # slot cleared
return 0
# end of block
for account, slots in written_slots.items():
account.storage_count += sum(
calculate_storage_delta(pre[account][k], post[account][k]) for k in slots
)
Things to know
- Status is Draft: key constants (
LIN_FACTOR,ACTIVATION_THRESHOLD, transition rates, registry address) are TBD, and test cases and security analysis are not written yet. eth_estimateGasand similar tooling must use the new formula; a contract's cost can rise over time as it grows.- Pricing by slot count rather than trie depth is deliberate: storage keys are hashed, so an attacker could cheaply grind keys to fake a deep trie.
- The authors note the scheme fits today's two-layer MPT and may become misaligned under a unified Verkle/binary tree. They suggest sharing the account transition with EIP-2926.
- It belongs to a wider push to reprice state, alongside EIP-8037 and EIP-8038.