Introduction

Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.

I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.

I also build and publish a variety of tools, libraries, and open-source projects.

This article covers ERC-4972, a proposal to extend the Ethereum Name Service (ENS) by associating a smart contract account with the owner of a name.

This explanation translates, summarizes and expands on the original proposal.

I have also written about other EIPs.

Overview

Ethereum Name Service (ENS) is a decentralized name resolution service on Ethereum. It allows users to associate human-readable names such as alice.eth with Ethereum addresses, making transfers and contract calls easier. ENS can be thought of as a blockchain counterpart to the Domain Name System (DNS).

  • Linking human-readable identities to smart contracts
    • The proposal adds a way to associate each ENS name (a human-readable identity) with a single smart contract account.
    • The owner of the ENS name can manage and control the smart contract.

The extension aims to make ENS more flexible and functional. Whereas ENS primarily acts as an address alias, the proposal directly associates a name with a smart contract, allowing more complex logic and functionality to be associated with it.

For example, a smart contract associated with an ENS name could accept funds only under certain conditions or automatically forward funds to another address. Individuals and organizations could use their ENS names to implement and manage complex transactions and contracts.

If implemented, the proposal would expand the uses of ENS. Rather than treating a name solely as an address alias, users could use it to develop their own digital identities and services.

Motivation

The proposal aims to encourage adoption of general-purpose smart contract accounts by giving each name Rich Context and providing an additional account available to its owner. The concept is called a Name-Owned Account (NOA) and enables a name node to hold assets and information.

Giving names rich context

In existing name services such as ENS, a human-readable name is mapped to an Ethereum address. This extension allows a name itself to carry richer information. Through the associated smart contract account (NOA), a name becomes an entity that can hold assets and information rather than merely an identifier.

The NOA concept

An NOA is a smart contract account assigned to the name owner. Through this account, a name node corresponding to a human-readable name can directly hold assets and information on Ethereum. Name services could therefore provide asset custody and information storage in addition to name registration.

Enabling new use cases

With an NOA, transferring a name node transfers not only ownership of the name but also control over the assets and information held by its NOA. For example, if a node holds specific digital assets, privileges or access rights, transferring the node to another person transfers those assets or rights along with it.

Encouraging adoption of general-purpose smart contract accounts

Smart contract accounts are expected to be useful in various digital applications because of their flexibility and functionality. NOAs offer users a simpler and more intuitive way to start using these accounts, potentially broadening adoption of the concept.

This extension could turn name services from simple name resolution tools into asset management and information storage platforms. That would broaden the concept of digital identity on blockchains and encourage development of new applications and services.

Specification

Name-Owned Account

The Name-Owned Account (NOA) concept connects a name-based identity with its associated smart contract account. The referenced ERC-137 defines a standard for associating human-readable names with blockchain addresses.

See the following article for more on ERC-137.

[ERC137] How ENS associates names with addresses

Main components of an NOA

Human Readable Name

A human-readable name is a unique blockchain identifier defined by ERC-137. It is typically a domain name such as alice.eth that resolves to an Ethereum address through ENS.

Owned Account (NOA)

An NOA is a smart contract account whose address is derived from the name. It is associated with a specific name node and can hold assets and information. As a smart contract, it can implement custom logic and rules that extend how the name node is used and how its assets are managed.

Name Owner(s)

The name owners are an individual or multiple entities entitled to manage the name node and its NOA. They can deploy and operate the NOA and control how it is used.

Ownership diagram

The diagram illustrates the ownership relationships between the NOA, name node and name owner.

text
  ┌───────────────┐        ┌───────────┐         ┌───────────────┐
  │ Owned Account ◄──own───┤ Name Node ◄───own───┤   Name Owner  │
  └───────────────┘        └───────────┘         └───────────────┘

The name owner owns the name node, which in turn owns the NOA (owned account). This establishes a chain of ownership backed by the name service. The name owner can control the NOA and use it to hold assets or carry out specific actions.

NOAs extend Ethereum name services beyond name resolution by enabling asset and information management through smart contract accounts associated with names. This opens new possibilities for digital identity and asset ownership management, including more secure and efficient ways of transferring assets and managing information.

Interfaces

INameServiceRegistry

The core interface required of a name service is as follows.

ts
interface INameServiceRegistry {
    /// @notice get account address owned by the name node
    /// @params node represents a name node
    /// @return the address of an account
    function ownedAccount(
        bytes32 node
    ) external view returns(address);
}

ownedAccount

javascript
function ownedAccount(
    bytes32 node
) external view returns(address);

Overview

Returns the address of the account owned by a name node.

Details

This function returns the address of the Name-Owned Account (NOA) associated with a particular name node. It allows callers to determine which smart contract account address the name owns. The function is read-only and does not change blockchain state.

Parameters

  • node
    • A bytes32 value representing the name node. It is the hashed representation of a particular name such as alice.eth and is used to retrieve the corresponding account address.

Return value

  • address
    • The address of the smart contract account owned by the name node.
    • This is the address of the contract controlled by the name node's owner, which can hold assets and information.

INameOwnedAccount

The core interface required of a name-owned account is as follows.

ts
interface INameOwnedAccount {
    /// @notice get the name node is mapped to this account address
    /// @return return a name node
    function name() external view returns(bytes32);

    /// @notice get the name service contract address where
    /// the name is registered
    /// @return return the name service the name registered at
    function nameService() external view returns(address);
}

name

javascript
function name() external view returns(bytes32);

Overview

Returns the name node mapped to the account.

Details

This function returns the specific name node associated with the smart contract account: the unique identifier corresponding to a human-readable domain name. Name services such as the Ethereum Name Service (ENS) use name nodes to identify domains uniquely.

Return value

  • bytes32
    • The unique identifier of the name node mapped to the account.

nameService

javascript
function nameService() external view returns(address);

Overview

Returns the contract address of the name service in which the name is registered.

Details

This function returns the address of the name service contract where a particular name (domain name) is registered. Callers can use this address to access the contract that provides name registration and resolution functions. In ENS, for example, it would return the ENS registry contract address.

Return value

  • address
    • The address of the name service contract where the name is registered.

Additional notes

The proposal describes a one-to-one mapping between name nodes and Name-Owned Accounts (NOAs). Each NOA address is designed to be derived from its name node, and each NOA includes information about that node to reflect ownership of the node. This allows the NOA to identify its associated name node unambiguously.

Including name node information in the NOA

Embedding name node information in each NOA is an important way of representing ownership of the node. The NOA serves as a unique access point for that node and maintains a direct association with it.

Using the name() function

The name() function retrieves the name node information held by an NOA. This makes it possible to trace the relationship in reverse, from the NOA back to its name node, and determine which node the account belongs to. It is particularly useful for verifying that relationship.

Using the nameService() function

The nameService() function returns the name service contract address where the name is registered. Callers can use the address to verify registration status and perform related actions, such as checking whether a particular name node is managed by a valid name service.

Tracing the actual owner

Together, these two methods allow the NOA to be traced to its actual owner, the name node's owner. Because the node's owner can use the NOA to manage assets and information associated with the name, this relationship helps make digital identity and asset management more transparent and efficient.

The mechanism strengthens the association between blockchain names and accounts and makes it more direct and efficient to manage digital assets and verify ownership through name services.

Compatibility

The name registry interface is compatible with ERC-137.

Implementation

The proposal describes how to create a Name-Owned Account (NOA), providing a way to generate a smart contract account associated with a specific name on a blockchain. The process primarily uses a factory contract and follows a set of technical steps.

NOA creation process

  1. Factory contract

    • A factory contract creates the NOA.
    • The factory may be the name service itself. It uses the CREATE2 opcode rather than CREATE to create the NOA.
    • CREATE2 makes the resulting NOA address deterministic and predictable, so it can be computed in advance.
  2. Using CREATE2

    • Ethereum provides two opcodes for deploying smart contracts: CREATE and CREATE2.
    • The main advantage of CREATE2 is that the address is deterministically computed from the deployer (the factory contract), a supplied salt and the contract's initialization bytecode.
    • This makes the NOA address predictable and reproducible.
  3. Deterministic addresses

    • NOAs must be created using the same initialization code (initcode) and factory contract.
    • This ensures that their addresses are derived deterministically.
    • Predictable addresses are important for implementing a one-to-one mapping between name nodes and their owned accounts.
  4. Using the name node as the salt

    • When creating an NOA with CREATE2, the name node information is used as the salt.
    • The salt is important for establishing the intended unique correspondence (bijection) between name nodes and NOAs.
    • With a shared factory contract and initialization code, different name nodes can produce different NOA addresses through their respective salts.

The NOA creation process provides a deterministic and reproducible way to generate a smart contract account associated with a name node. A factory contract using the CREATE2 opcode makes the account address predictable and establishes the intended one-to-one relationship with the name node. This opens new possibilities for managing digital identity and assets.

Reference

Shu Dong (@dongshu2013), Qi Zhou (@qizhou), Zihao Chen (@zihaoccc), "ERC-4972: Name-Owned Account [DRAFT]," Ethereum Improvement Proposals, no. 4972, April 2022. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-4972.

Conclusion

This article covered ERC-4972, which proposes extending the Ethereum Name Service (ENS) by associating a smart contract account with the owner of a name.

If you have questions, feel free to contact me via Twitter DM.

Twitter @cardene777

You can also find my writing on other platforms.

https://chaldene.net/