EIP-1418 Blockchain storage rent (Blockchain Storage Rent Payment)

No call decision · Scaling & data · EIP status Stagnant · created 2018-09-16

A proposal to deduct ether as rent every block from each account in proportion to the amount of storage it is using, preventing unused data from piling up on chain forever for free.

Why it is needed

Ethereum is a public utility but fails to properly reflect the cost of long-term storage. Right now, paying gas once via SSTORE leaves that data in every node's state forever, and the storage burden the entire network has to carry keeps growing over time. Storage cost is inherently 'bytes x time', but the current gas model does not price in the 'time' component. This proposal has each account pay rent every block in proportion to the amount of code and storage it uses, so that data no longer in use is naturally evicted, curbing the growth of state size.

What changes

Today

After EIP-1418

Who is affected

In depth

New state variables and constants for the rent mechanism

Each account gains sigma[a]_rent (rent balance, a signed value) and sigma[a]_storageWords (number of words stored). New constants RENT_WORD_COST (rent cost per word-block), RENT_ACCOUNT_COST (rent cost per account-block), and FORK_BLOCK (the block at which this takes effect) are defined. The gas cost of existing opcodes does not change.

The RENTBALANCE and SENDRENT opcodes

RENTBALANCE(address), similar to BALANCE, returns the account's logical sigma[a]_rent value for gas cost G_BALANCE. It can be implemented purely by computation, without needing to update and store a value every block. SENDRENT(address, amount) reduces msg.sender's balance at gas cost G_BASE and adds the same amount to the target account's sigma[account]_rent, converting and sending ether as rent. A PAYRENT(address, amount) built-in contract is also provided for easier human use, with a gas cost of 10,000 or less.

The PAYRENT subroutine

PAYRENT(account) computes the unpaid rent by multiplying the number of blocks elapsed since the last payment block (rentLastPaid) by the per-block cost (RENT_ACCOUNT_COST + RENT_WORD_COST x (code word count rounded up + storageWords)), then deducts it from sigma[account]_rent. If rent goes negative, the shortfall is taken from the account's actual value, and if value is also insufficient, rent is again recorded as negative. It then updates rentLastPaid and computes rentEvictBlock (the scheduled eviction block) by dividing the remaining rent by the per-block cost.

Changes to SSTORE, SLOAD, CALL, and CREATE

SSTORE and SLOAD run PAYRENT before execution, and the transaction fails if the target account has already passed its eviction block. However, this is exceptionally allowed if the past storage root and value are proven via a new transaction type. When SSTORE changes a value from zero to nonzero, it increases storageWords, and when it changes to zero, it decreases storageWords (never going below zero). The CALL family also fails if the target account has been evicted, unless a code proof is provided. CREATE sets rentLastPaid to the current block and initializes storageWords to zero, but any previously remaining rent balance can carry over.

Rent and value are separate accounts

Ether that has been converted into rent cannot be converted back into a regular balance. The explanation is that this is designed like a gift card, flowing in one direction only, to keep the accounting simple. The reason rent and value are kept as separate balances is to let anyone contribute to keeping a contract alive by sending ether to its rent account, while still letting the contract itself freely spend its value. Eviction responsibility lies with the consensus client (lazy evaluation), and no incentive mechanism is needed for an off-chain party to request eviction.

Pricing rationale

The author proposes setting both RENT_WORD_COST and RENT_ACCOUNT_COST at 4,000 Wei. The basis given is that in 2015 SSTORE cost 20,000 gas, gas prices ranged from 1 to 50 Gwei, and that storage was maintained for about 6 million blocks, which works out to roughly 4,000 Wei per word per block. The price is a fixed value (denominated in ether) and is not negotiated or dynamically adjusted by clients. It is noted that future EIPs could introduce dynamic pricing, for example via notaries proving they hold a storage dataset.

Calculating storage amounts for existing accounts remains unresolved

How to determine sigma[account]_storageWords at fork time for accounts that already exist remains in DRAFT status. It explicitly states that an upgrade requiring only archive nodes to know the full storage amount at the fork block is unacceptable, and instead only offers ideas such as computing it incrementally based on new transaction activity or using an unbiased estimator (e.g. adding one bit on first access to a legacy account's key, adding log(n) bits per trie level).

Current status and prerequisites

EIP-1418 has been in Stagnant status with no further progress since it was written in 2018. Because the part covering how to calculate existing accounts' storage amounts remains in DRAFT, the specification itself is incomplete, and the security consideration around contracts that can arbitrarily grow their storage space remains unresolved. This proposal requires EIP-1559, and is designed to build on the warm access and new transaction type concepts that EIP-1559 introduced. There is no record confirming that a core developer call decided on its inclusion in a fork.

Original EIP · ← EIPs