---
eip: 7700
label: ERC-7700
title: Cross-chain Storage Router Protocol
status: Draft
type: Standards Track
category: ERC
created: 2024-04-30
requires: 155
official: https://eips.ethereum.org/EIPS/eip-7700
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-7700.md
canonical: https://eips.huatuo.xyz/eip-7700/
lang: en
tldr: "\"CCIP-Store\": a contract reverts with a standard error telling the client to send the write to another L1 contract, an L2, or a signed off-chain database, the write-side companion to CCIP-Read."
tags: [crosschain, storage, offchain, ccip, ens]
---

# ERC-7700: Cross-chain Storage Router Protocol

> Provides a mechanism to replace L1 storage with L2 and databases through cross-chain routers

**TL;DR:** "CCIP-Store": a contract reverts with a standard error telling the client to send the write to another L1 contract, an L2, or a signed off-chain database, the write-side companion to CCIP-Read.

## What problem does it solve?

Storing data on Ethereum mainnet is expensive. [EIP-3668](/eip-3668/) (CCIP-Read) already lets a contract say "the answer lives elsewhere, go fetch it from this gateway", which is how many name records are served from L2s or databases. But each project still invents its own way to **write** that data, and to make database writes verifiable when they are read back on L1.

ERC-7700, nicknamed **CCIP-Store**, standardises the write side. An L1 contract signals *where* a storage operation should go by reverting with a well-known custom error. Wallets and libraries that understand these errors can complete the write without app-specific code.

## How it works

The spec defines three routers, each a custom error:

| Error | Meaning |
| --- | --- |
| `StorageRoutedToL1(address contractL1)` | Send the same calldata to another L1 contract |
| `StorageRoutedToL2(address contractL2, uint256 chainId)` | Send the same calldata to a contract on that L2 |
| `StorageRoutedToDatabase(string gatewayUrl)` | Sign the data and POST it to an off-chain gateway |

For L1 and L2 routing the client simply re-sends the **exact same calldata** to the indicated contract and chain.

Database routing needs extra security because a database has no built-in trust model:

1. The wallet signs a fixed message, and a **data signer** keypair is derived from that signature (with an optional password stretched by PBKDF2, then HKDF).
2. The data signer signs each record, so many records can be updated without new wallet prompts.
3. The owner/manager signs an **approval** of the data signer.
4. The client posts the data, signature, approval and signer to the gateway in a CCIP-Read-compatible encoding.

When the data is later read through CCIP-Read, the L1 contract checks that the approval came from the owner/manager and that the data signature came from the approved signer. Future routers (IPFS, Arweave, Solana and others) are expected to be added through separate ERCs.

## Sample code

Contract side: route writes to an L2.

```solidity
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.20;

contract RecordsL1 {
    error StorageRoutedToL2(address contractL2, uint256 chainId);

    address public immutable l2Records;
    uint256 public immutable l2ChainId;

    constructor(address _l2Records, uint256 _l2ChainId) {
        l2Records = _l2Records;
        l2ChainId = _l2ChainId;
    }

    function setValue(bytes32 node, bytes32 key, bytes32 value) external view {
        revert StorageRoutedToL2(l2Records, l2ChainId);
    }
}
```

Client side (ethers v6): catch the error and replay the call on L2.

```ts
import { Contract, Interface } from "ethers";

const iface = new Interface([
  "function setValue(bytes32,bytes32,bytes32)",
  "error StorageRoutedToL2(address contractL2, uint256 chainId)",
]);
const l1 = new Contract(l1Address, iface, l1Provider);

try {
  await l1.setValue.staticCall(node, key, value);
} catch (e: any) {
  const err = iface.parseError(e.data);
  if (err?.name === "StorageRoutedToL2") {
    const [target, chainId] = err.args;
    const l2 = new Contract(target, iface, signerOn(chainId)); // your own signer lookup
    await l2.setValue(node, key, value); // exact same calldata
  }
}
```

## Things to know

- **Status: Draft.** Error names, message formats and the database flow may still change.
- L1 and L2 routing assume the target contract exposes the same function with the same calldata; the router only says *where* to send it.
- The database router's safety depends on clients deriving the data signer exactly as specified and on read-side contracts verifying both signatures. A gateway alone is not trusted.
- Reading the data back is done with [EIP-3668](/eip-3668/); this ERC only covers writing.


---

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