EIP-1682 Storage Rent
No call decision · Scaling & data · EIP status Withdrawn · created 2018-11-10
A proposal to charge rent every block based on the size of storage an account uses, and to disable (clear) code and storage for accounts that fail to pay, thereby capping the overall size of Ethereum state.
Why it is needed
Ethereum state keeps growing without bound. Data once stored in a contract must remain on the protocol forever, so full nodes participating in consensus must store ever more data over time. Techniques like state pruning or compression can ease the burden, but they place no upper bound on future storage demand itself. This EIP attempts to put a clear cap on state size by charging rent for storage usage and archiving (deactivating) data whose rent goes unpaid. A similar rent scheme was proposed previously in EIP-103, but it was rejected for breaking user expectations.
What changes
Today
- Once stored, an account's storage persists forever with no ongoing maintenance cost
- There is no protocol-level cap on the overall size of state
- Code and storage remain in place even if an account is abandoned
After EIP-1682
- Rent is automatically charged every block, in proportion to storage size
- Once both rent balance and balance are exhausted, the account becomes inactive and its code and storage are deleted
- Rent rises as total state size approaches MAX_STORAGE_SIZE (2^32, about 160GB)
- An inactive account can be restored by using RESTORETO to re-upload its original storage
Who is affected
- Ordinary users: Even accounts holding tokens or contracts can become inactive if rent is not paid, so a rent balance must be kept topped up to maintain them.
- Wallet & app developers: For non-payable contracts that reject value transfers, this introduces logic to let PAYRENT top up the rent balance on their behalf, which requires UX to handle inactivation and restoration states.
- Client teams: The account structure gains three new fields, rentbalance, rentblock, and storagesize, and before the fork activates, clients must traverse the entire state once to convert it to the new format.
- Full nodes, validators: An upper bound is placed on state size, reducing long-term storage burden, but a computation to charge rent is added for every modified account in every block.
In depth
State size cap and the rent factor
The new protocol constant MAX_STORAGE_SIZE = 2**32 (about 160GB) is the cap on the total number of trie nodes. Each block computes the 'storage fee factor' as storagefee_factor(block) = 2**22 * (MAX_STORAGE_SIZE / (MAX_STORAGE_SIZE - total_storage_size(block))). As total_storage_size approaches MAX_STORAGE_SIZE, the denominator approaches zero and the factor rises sharply, so rent becomes more expensive the closer storage gets to the cap, naturally discouraging further growth.
Account structure changes
The account is extended to [nonce, balance, storageroot, codehash, rentbalance, rentblock, storagesize]. rentbalance is a balance dedicated to rent, rentblock is the block number at which rentbalance was last recalculated, and storagesize is the number of storage slots currently set (0 for inactive accounts). A new key called size is also placed at the top of the account trie to track the total number of nodes across all account and storage tries. Before processing the block at which this EIP activates, clients must traverse the entire state once to count nodes and convert every account to the new format.
Rent calculation and collection (rent · charge_rent)
The rent function sums storagefee_factor(b) * prestate[addr].storagesize for each block b from prestate's rentblock+1 through currentblock-1, and finally adds the current block's fee, storagefee_factor(currentblock) * poststate[addr].storagesize. charge_rent first deducts this fee from rentbalance, and if rentbalance is insufficient, deducts the remainder from balance. The ether collected this way is burned. rent is charged only against accounts touched by the transactions in a block, after those transactions have been processed.
Four new EVM opcodes
PAYRENT <amount> <addr> deducts ether from the executing account and adds it to the specified beneficiary address's rent balance (gas cost TBD). RENTBALANCE <addr> pushes that account's rentbalance onto the stack (same gas as EXTCODEHASH). SSIZE <addr> pushes storagesize onto the stack (same gas as EXTCODEHASH). RESTORETO <addr> <codeaddr> works like SELFDESTRUCT, but only moves storage, code, and balance to addr and deletes the executing account when addr is inactive, the storageroot matches, and codeaddr's code matches addr's codehash (gas cost TBD).
Why a separate rent balance exists
Some contracts are non-payable, rejecting value immediately or forwarding received funds elsewhere right away, so they cannot pay rent from their own balance. Letting other users top up the rent balance via PAYRENT keeps such accounts alive. A separate rent balance also avoids an accounting problem seen in crowdfunding-style contracts that track individual users' balances: if rent were deducted from the main balance, it would become hard to refund users precisely when a funding goal is not met.
Why restoration is needed
Ethereum has long guaranteed that contract storage can only be changed by the contract itself and is preserved forever. Users expect that tokens held in a contract stay there. The restoration mechanism via RESTORETO lets state be revived after an account goes inactive, provided data matching the original storageroot and codehash is uploaded again, preserving this guarantee to some extent. The cost of restoration is equivalent to the cost of recreating the data from scratch via a sequence of SSTORE calls.
Implementation limitation: no immediate deactivation
This proposal does not include a mechanism that automatically deactivates an account the instant it fails to pay rent. Tracking every account and its individual rent requirement would require a separate auxiliary data structure, so instead it operates in a deferred manner where storage is actually removed only once a user touches that account.
Status: Withdrawn
This EIP's status is Withdrawn. The Backwards Compatibility, Test Cases, and Implementation sections are all left as TBA, and the gas costs for PAYRENT and RESTORETO are also marked TBD, so the proposal was withdrawn before these details were finished.