EIPs Explained

ERC-4972 · Draft · ERC · 2022-04-04

ERC-4972: Name-Owned Account

Gives every name in an ENS-style name service its own deterministic smart contract account, controlled by whoever owns the name, so assets and data can live with the name and move when the name is transferred.

What problem does it solve?

A name like alice.eth resolves to an address, but the name itself holds nothing. If Alice sells or transfers the name, any assets or reputation are still tied to whatever address she pointed it at, not to the name.

ERC-4972 proposes a Name-Owned Account (NOA): a smart contract account that belongs to the name node itself. Whoever owns the name controls the account. Transfer the name and the account, with everything in it, goes along. It also hands every name holder a ready-made smart contract account, which the authors hope helps contract-account adoption.

How it works

The ownership chain is: name owner → name node (ERC-137) → owned account.

Two small interfaces:

  • The name service registry exposes ownedAccount(bytes32 node) → address, the NOA for a given name node.
  • The NOA exposes name() → bytes32 (its name node) and nameService() → address (the registry where the name lives), so anyone can trace an account back to its name and check who currently owns it.

Creation: a factory (possibly the name service itself) deploys NOAs with CREATE2 (EIP-1014), using identical init code and the name node as the salt. That makes the mapping from name to account one-to-one and deterministic, so the address is known before the account is even deployed.

What the NOA can actually do (execute calls, hold tokens, validate signatures) is left to the implementation.

Sample code

Interfaces from the spec, plus how a factory could derive the address:

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

interface INameServiceRegistry {
    function ownedAccount(bytes32 node) external view returns (address);
}

interface INameOwnedAccount {
    function name() external view returns (bytes32);
    function nameService() external view returns (address);
}

abstract contract NOAFactory is INameServiceRegistry {
    bytes32 public immutable initCodeHash; // hash of the shared NOA init code

    constructor(bytes32 h) { initCodeHash = h; }

    function ownedAccount(bytes32 node) public view returns (address) {
        return address(uint160(uint256(keccak256(
            abi.encodePacked(bytes1(0xff), address(this), node, initCodeHash)
        ))));
    }
}

Computing an ENS-style name node off-chain (ethers v6):

import { namehash } from "ethers";
const node = namehash("alice.eth"); // bytes32 passed to ownedAccount(node)

Things to know

  • Status is Draft: the interface may change and there is no canonical deployment defined by the spec.
  • The NOA's own permission model (how it checks the current name owner before executing) is not specified; implementations must get this right, since a stale or wrong owner check would hand control to the wrong party.
  • Anyone buying a name with an NOA effectively buys its contents too; buyers and marketplaces should inspect the account.
  • A similar idea for NFTs is ERC-6551 (token-bound accounts); for general smart accounts see ERC-4337.

#ens #naming #account #identity #create2

Details

Authors
Shu Dong (@dongshu2013), Qi Zhou (@qizhou), Zihao Chen (@zihaoccc)
Status
Draft
Type
Standards Track / ERC
Created
2022-04-04
Requires

Machine-readable: Markdown · JSON