---
eip: 7406
label: ERC-7406
title: Multi-Namespace Onchain Registry
status: Draft
type: Standards Track
category: ERC
created: 2023-07-23
requires: 137
official: https://eips.ethereum.org/EIPS/eip-7406
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-7406.md
canonical: https://eips.huatuo.xyz/eip-7406/
lang: en
tldr: A draft ENS-style on-chain registry where every key lives inside a namespace, so one contract can hold many independent mappings, versions or record types with separate owners and resolvers.
tags: [registry, naming, ens, namespace]
---

# ERC-7406: Multi-Namespace Onchain Registry

> An universally accepted multi-namespace registry with mapping structures on the Ethereum

**TL;DR:** A draft ENS-style on-chain registry where every key lives inside a namespace, so one contract can hold many independent mappings, versions or record types with separate owners and resolvers.

## What problem does it solve?

The ENS registry ([ERC-137](/eip-137/)) maps a single `node` to an owner and a resolver. That works well for names, but projects often want the same pattern for other things: short URLs, sessions, versioned records, protocol configuration. With a single flat keyspace, each new use case usually means deploying another registry.

ERC-7406 adds one extra dimension, the **namespace**. The same key can exist in many namespaces with different owners and resolvers. A namespace can stand for a data type ("short-url", "session") or a version number, which lets a registry keep a traceable history of a record: write version 2 in a new namespace instead of overwriting version 1.

## How it works

Records are addressed by `(namespace, key)`, both `bytes32`. The registry exposes:

| Function | Purpose |
| --- | --- |
| `owner(namespace, key)` | Current owner of the key in that namespace |
| `resolver(namespace, key)` | Resolver contract for the key in that namespace |
| `setOwner(namespace, key, newOwner)` | Transfer the key; only the current owner may call; emits `Transfer` |
| `setResolver(namespace, key, newResolver)` | Point the key at a resolver; only the owner may call; emits `NewResolver` |
| `createNamespace(namespace)` | Create a new namespace (e.g. a new version or record type); emits `NewNamespace` |

Ownership is per namespace: the same key can have different owners and resolvers in different namespaces. The actual values (addresses, text, content hashes) live in resolver contracts, which can follow the existing ERC-137 resolver specification.

The spec does not say who may call `createNamespace`; that is left to the implementation (for example an admin or governance role).

## Sample code

A minimal interface and lookup, written for current Solidity:

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

interface IERC7406 {
    event Transfer(bytes32 indexed namespace, bytes32 indexed key, address owner);
    event NewResolver(bytes32 indexed namespace, bytes32 indexed key, address resolver);
    event NewNamespace(bytes32 namespace);

    function owner(bytes32 namespace, bytes32 key) external view returns (address);
    function resolver(bytes32 namespace, bytes32 key) external view returns (address);
    function setOwner(bytes32 namespace, bytes32 key, address newOwner) external;
    function setResolver(bytes32 namespace, bytes32 key, address newResolver) external;
    function createNamespace(bytes32 namespace) external;
}

contract ShortLinkReader {
    IERC7406 public immutable registry;
    bytes32 public constant NS = keccak256("short-url/v1");

    constructor(IERC7406 r) { registry = r; }

    function resolverFor(string calldata slug) external view returns (address) {
        return registry.resolver(NS, keccak256(bytes(slug)));
    }
}
```

## Things to know

- **Status: Draft.** The interface may change and there is no evidence of broad adoption.
- The reference implementation in the spec is written in very old Solidity syntax (`throw`, `constant` functions, constructor named after the contract) and contains typos, so it will not compile as-is. Treat it as a sketch, not deployable code.
- The spec's own security section is brief. Access control for `createNamespace`, and whether `setResolver` should be owner-only, are key design choices an implementer must make and audit.
- Unlike ENS, there is no hierarchical `subnode` logic in the interface; namespaces are flat.


---

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