---
eip: 7736
label: EIP-7736
title: Leaf-level state expiry in verkle trees
status: Stagnant
type: Standards Track
category: Core
created: 2024-07-05
requires: 6800
official: https://eips.ethereum.org/EIPS/eip-7736
source: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-7736.md
canonical: https://eips.huatuo.xyz/eip-7736/
lang: en
tldr: "A simple state-expiry design for Verkle trees: leaf groups not written to for roughly 6–12 months are deleted, and anyone can bring them back with a special resurrection transaction."
tags: [state-expiry, verkle, statelessness, core]
---

# EIP-7736: Leaf-level state expiry in verkle trees

> Simple state expiry scheme in which only "extension-and-suffix trees" are expired.

**TL;DR:** A simple state-expiry design for Verkle trees: leaf groups not written to for roughly 6–12 months are deleted, and anyone can bring them back with a special resurrection transaction.

## What problem does it solve?

Ethereum's state only grows. Every account and storage slot ever written must be kept by every full node forever, even if nobody has touched it in years. "State expiry" proposals have tried to fix this for a long time, but earlier designs needed big structural changes such as address space extension or one tree per time period, and they kept stalling on complexity.

EIP-7736 offers a deliberately modest version on top of the Verkle tree from [EIP-6800](/eip-6800/): expire only the bottom of the tree (the leaf values), keep the tree's shape, and make resurrection cheap and simple.

## How it works

In a Verkle tree, values are grouped under a 31-byte *stem*: one extension node with up to 256 values (an "extension-and-suffix tree"). This EIP:

- **Adds a `last_epoch` field** to each extension node's commitment. An epoch is `EPOCH_LENGTH` = 15,778,800 seconds (about six months).
- **Updates it on writes only.** Every write under a stem sets `last_epoch = current_epoch`. Reads do not, because updating the counter on a read would effectively turn reads into writes.
- **Blocks access to expired data.** A read or write is allowed only if `current_epoch < last_epoch + NUM_ACTIVE_EPOCHS` (2). Otherwise it reverts.
- **Expires at epoch boundaries.** When a block starts a new epoch, nodes from the epoch that just fell out of range can be deleted. Clients keep only a small *keepsake*: the stem and the node's commitment, so new siblings can still be inserted and old data can be checked later. When and how to delete is left to clients.
- **Resurrection transaction.** A new transaction type carries `stem`, `last_epoch` and the original `values`. The node recomputes the commitment, checks it against the keepsake, and if it matches, restores the data with `last_epoch` set to the current epoch. Gas is charged using the witness and edit costs from [EIP-4762](/eip-4762/).

## Sample code

The access rule and epoch tick (pseudocode, Python syntax, following the spec):

```python
EPOCH_LENGTH = 15_778_800      # ~6 months, in seconds
NUM_ACTIVE_EPOCHS = 2

def check_epoch_end(block):
    global current_epoch
    if block.timestamp >= FORK_TIME + current_epoch * EPOCH_LENGTH:
        current_epoch += 1
        schedule_expiry(current_epoch - NUM_ACTIVE_EPOCHS)   # client-defined

def access(stem, is_write):
    node = tree.extension(stem)
    if not current_epoch < node.last_epoch + NUM_ACTIVE_EPOCHS:
        raise Revert("expired: resurrect first")
    if is_write:
        node.last_epoch = current_epoch

def resurrect(stem, last_epoch, values):
    keepsake = tree.get_keepsake(stem)
    assert keepsake.C == extension_and_suffix_tree(stem, values, last_epoch)
    tree.resurrect_subtree(stem, values, current_epoch)
```

## Things to know

- Status is **Stagnant**, and it depends on Verkle trees ([EIP-6800](/eip-6800/)), which are also Stagnant. Research has since shifted toward a binary tree ([EIP-7864](/eip-7864/)).
- Because only writes refresh the epoch, data that is read often but never written (for example, contract code or a config value) can still expire and would need resurrecting.
- Fork time, the resurrection transaction type number, test cases and a reference implementation are all still TBD in the spec, and its security section says "needs discussion".
- It is backward compatible with EIP-6800 because the new commitment field defaults to 0, which equals the initial epoch.
- Resurrection restores a whole stem group at once, which is simpler but costs more than restoring a single value.


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-7736
