Introduction
Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.
I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.
I also build and publish a variety of tools, libraries, and open-source projects.
EIP-8032 proposes changing the gas cost of SSTORE, the EVM instruction that writes to contract storage, according to the amount of storage the contract already uses.
The proposal adds storage_count, the number of nonzero storage slots, to the contract's account data and uses it to price SSTORE. The goal is to slow Ethereum state growth by making additional writes more expensive for contracts that already occupy a large amount of storage.
This article explains the proposal below.
Overview
EIP-8032 is a core proposal that ties SSTORE gas costs to each contract's storage footprint. Current write costs reflect that footprint only weakly. Even for a contract with substantial storage, writing more data can be cheap relative to the long-term burden it imposes on the network.
The proposal has three main parts.
- Add an optional
storage_countfield to the account RLP to track the number of nonzero storage slots. - Count nonzero slots in existing contracts incrementally, block by block after the fork.
- Use the block-start
storage_countto calculate the additionalSSTOREgas charge.

The diagrams retain their Japanese labels. In the diagram, storage_count(A) is the number of nonzero storage slots in contract A. The term S_pre(A) is the value of that count at the start of the block. Here A denotes the target contract account and pre denotes the state before the block executes. The surcharge uses that fixed value, so write ordering within the block does not change the estimate for the surcharge.
Motivation
Ethereum's state size directly affects node synchronization time, hardware requirements, and the work required to compute the state root. Data written to on-chain storage must be retained by network participants over the long term. The current gas model does not adequately reflect a contract's existing storage footprint in the price of additional SSTORE operations.
This mismatch can make low-cost data storage and spam-like usage economically viable. Larger contract storage also increases the work clients do to update state and read from or write to their databases. EIP-8032 directly links the size of that storage to the price of further writes.
The surcharge starts above ACTIVATION_THRESHOLD. This focuses the incentive on contracts that contribute most to state growth while keeping the existing pricing for small and medium-sized contracts.
Specification
EIP-8032 covers account data, migration of existing state, per-block updates, and the SSTORE gas formula. Because the gas calculation uses storage_count, it is a consensus value.
Constants and parameters
| Name | Value | Purpose |
|---|---|---|
FORK_TIMESTAMP |
TBD |
Fork timestamp at which the proposal activates |
LIN_FACTOR |
TBD |
Linear coefficient for the additional gas charge |
ACTIVATION_THRESHOLD |
TBD |
Threshold at which the additional charge starts applying |
TRANSITION_REGISTRY_ADDRESS |
TBD |
System contract that stores migration progress |
TRANSITION_SLOTS_PER_BLOCK |
TBD |
Maximum number of storage slots scanned per block |
TRANSITION_MAX_ACCOUNTS |
TBD |
Maximum number of accounts whose scans can finish per block |
The proposal anticipates setting ACTIVATION_THRESHOLD at a level corresponding to about 8 GB of data. The exact value remains undecided.
storage_count
An Ethereum account is state associated with an address. Accounts include both externally owned accounts and contract accounts. This proposal primarily concerns contract accounts with storage.
The account RLP gains an optional storage_count field that records the number of nonzero storage slots in the account.
A missing storage_count is interpreted as 0, and the field may be omitted when storage_count == 0. This avoids unnecessary overhead for accounts without storage and keeps the overhead for small contracts limited.
Migrating existing state
When the proposal activates at FORK_TIMESTAMP, clients start counting the slots used by existing contracts. Scanning all existing storage in one block would be too costly, so clients scan a portion at the end of each block.
The system contract at TRANSITION_REGISTRY_ADDRESS stores the progress. Its cursor records how far the scan has reached in the account and storage slot order.
| Storage slot | Value | Purpose |
|---|---|---|
0x00 |
cursor_account_hash |
Hash of the account currently being scanned |
0x01 |
cursor_slot_hash |
Hash of the current storage slot |
0x02 |
cursor_accum |
Number of nonzero slots found so far in the current account |

Clients visit account hashes and slot hashes in lexicographic order. If a scan reaches TRANSITION_SLOTS_PER_BLOCK or TRANSITION_MAX_ACCOUNTS, the client saves the cursor and ends that block's migration work. An account's storage_count is finalized only once all of its storage has been scanned.
The migration draws on EIP-7612, which describes a transition to a Verkle Tree that tracks progress and migrates existing state incrementally.
EIP-7612: Verkle state transition via an overlay tree https://eips.ethereum.org/EIPS/eip-7612
Handling chain reorganizations
No special handling is needed during a reorganization. The storage_count fields and the three cursor values are part of post-block state as ordinary state writes. A client returns to the appropriate ancestor state on the new canonical chain and deterministically recalculates migration progress by re-executing the blocks.
Account update rules
After executing all transactions in a block, clients update storage_count for affected accounts. This reconciles the pre-block count with the actual number of nonzero slots after the block.
Clients can calculate the new value (new) without scanning all storage again. They inspect only slots written during the block and add or subtract the change in nonzero slots.
def calculate_storage_delta(prestate_value, poststate_value):
if prestate_value == 0 and poststate_value != 0:
return 1
elif prestate_value != 0 and poststate_value == 0:
return -1
else:
return 0A change from 0 to nonzero adds +1, while a change from nonzero to 0 adds -1. Changing one nonzero value to another or writing 0 to a slot that already holds 0 leaves the count unchanged.
In a block during migration, the client first executes transactions, then advances the migration, and then applies the deltas. For an account scanned in that block, the gas change takes effect in following blocks.
| Account position | Delta handling |
|---|---|
| Already scanned | Apply all storage deltas |
| Scan has yet to start | Skip the storage deltas |
| Currently being scanned | Apply deltas only for slots already counted |
This avoids double-counting historical slots that have yet to be scanned and new changes within the block.
Calculating SSTORE gas
For contract account A, let S_pre(A) be its storage_count(A) at the start of the block. This value represents the contract's slot count at that point and remains fixed for the entire block, even if the number of slots changes while transactions execute.

For example, if storage_count(A) = 120 at the start of a block, every SSTORE for contract A in that block uses S_pre(A) = 120. Even if the count rises to storage_count(A) = 123 during the block, the updated value is excluded from that block's gas calculation. The value 123 becomes the new S_pre(A) in a subsequent block.
If the account has no storage_count(A) at block start, use S_pre(A) = 0.
constant_sstore_gas(addr, slot) + LIN_FACTOR * ceil_log16(S_pre(addr)) // ACTIVATION_THRESHOLDThe term constant_sstore_gas(addr, slot) represents the existing SSTORE cost. The formula adds a charge based on S_pre(addr). Holding S_pre(A) fixed reduces the sensitivity of eth_estimateGas, the RPC that estimates a transaction's gas before execution, to transaction ordering within a block.
Impact on state size
RLP encodes storage_count as a minimal-length big-endian byte string without leading zeros. The field uses only the bytes its value requires, keeping per-account overhead below that of a fixed 32-byte field.
storage_count |
Payload length |
|---|---|
0 |
The field may be omitted |
1 ... 255 |
1 byte |
256 ... 65,535 |
2 bytes |
65,536 ... 16,777,215 |
3 bytes |
16,777,216 ... 4,294,967,295 |
4 bytes |
The RLP string prefix adds one byte. Crossing an account list size boundary can add at most one more byte. The proposal cites a contract with about 80 million slots around block 23,000,000 as its largest example. Even at that scale, the storage_count payload needs four bytes and adds at most six bytes to the account.
Under the conservative assumption that all 23 million contract accounts add six bytes each, the upper bound is about 138 MB. Most contracts need one to three payload bytes, so the actual increase would be smaller.
Rationale
EIP-8032 raises the cost of steadily expanding a contract's storage. Once a contract passes the threshold, splitting storage across new contracts can reduce the additional charge. Splitting still incurs deployment costs and calls to existing instances, so an architecture that grows state indefinitely cannot rely on cheap writes alone.
The ACTIVATION_THRESHOLD is meant to distinguish contracts that need substantial state for a useful service from growth driven by spam. It can be raised as Ethereum's total state grows.
The parameter TRANSITION_SLOTS_PER_BLOCK caps storage reads per block. The parameter TRANSITION_MAX_ACCOUNTS caps the number of accounts whose storage_count is written per block. The first limit controls read load, while the second helps avoid write amplification and large database compactions.
Comparison with depth-based pricing
One alternative is to charge based on storage tree depth. The proposal uses XEN as an example of a very large contract, with related storage keys that share a prefix of about nine nibbles in the Merkle Patricia Trie (MPT).
The trie uses keccak256(slot_key) as the storage key, so inputs with similar depths can be sought off-chain. Pricing by depth alone would therefore leave room to build a large state at the same apparent cost. EIP-8032 uses the account's actual nonzero slot count.
Why migrate existing state?
Counting only writes after the fork would leave large existing contracts starting at storage_count = 0. It would take time for their historical footprint to affect gas, and contracts that leave old slots untouched could continue paying low prices despite their state size.
The proposal therefore counts existing storage incrementally as part of consensus. Storing the cursor under the state root makes progress consistent across clients and lets ordinary reorganization processing handle rollbacks.
Relationship to Verkle and unified binary trees
In today's two-layer MPT, writing contract storage touches both the account path and the storage path. A contract's storage footprint is therefore related to the tree-update and database costs borne by clients.
In a future unified tree, the cost of a single SSTORE would depend on the branching, height, and distribution of state keys across the entire tree. Its relationship to the slot count of a specific contract would change. Once a unified tree is introduced, pricing by an account's slot count would no longer track actual processing costs in the same way.
Relationship to EIP-2926
EIP-2926 proposes splitting contract code into chunks and Merkleizing it. That proposal also needs a migration that scans existing accounts and adds a field. If EIP-8032 and EIP-2926 activate in the same fork, combining their migration work could reduce duplication and client implementation complexity.
EIP-2926: Chunk-Based Code Merkleization https://eips.ethereum.org/EIPS/eip-2926
Compatibility
Contract interfaces and normal wallet operations remain the same. Clients treat a missing storage_count as 0, so contracts the migration has yet to reach incur no additional gas.
The change reprices gas and therefore requires a network upgrade. Node operators and RPC implementations need to ensure that eth_estimateGas, the call that estimates a transaction's gas before execution, reflects the new SSTORE formula.
Test Cases
The proposal still marks test cases TODO. They should cover at least the following behavior.
- Treat missing
storage_countas0. - Add
+1tostorage_counton writes from0to a nonzero value. - Add
-1on writes from a nonzero value to0. - Use the block-start
S_pre(A)forSSTOREoperations throughout the block. - Reproduce migration cursor updates and delta application when replaying blocks after a reorganization.
Reference Implementation
The reference implementation is also marked TODO. The specification calls for four pieces: account RLP encoding of storage_count, state management for migration cursors, post-block delta updates, and the SSTORE gas calculation.
Clients should update storage_count from the difference between pre-block and post-block state instead of rereading every slot on every block. Gas still uses the block-start value S_pre(A).
Security Considerations
The proposal's security considerations remain open for discussion. The specification points to several areas to check.
Migration is part of consensus, so clients must scan account and slot hashes in the same order. Differences in scan order or cursor persistence can produce different storage_count values and state roots.
If eth_estimateGas continues to use the old formula, it may underestimate gas for contracts with large storage. Freezing S_pre(A) for the block is important for stable estimates.
The values of TRANSITION_SLOTS_PER_BLOCK and TRANSITION_MAX_ACCOUNTS directly affect migration load. High values make end-of-block work heavier, while low values prolong the migration. Both need to reflect the state size and the minimum hardware requirements for clients.
Conclusion
EIP-8032 proposes reflecting state growth in the price of SSTORE. It adds storage_count to account data, counts existing state incrementally, and uses the block-start value to determine the surcharge. The parameter values, test cases, and reference implementation are still open. The proposal addresses how Ethereum prices storage and manages state growth over time.
Find more of my writing and resources here.




