---
eip: 7632
label: ERC-7632
title: Interfaces for Named Token
status: Draft
type: Standards Track
category: ERC
created: 2024-02-08
requires: 165
official: https://eips.ethereum.org/EIPS/eip-7632
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-7632.md
canonical: https://eips.huatuo.xyz/eip-7632/
lang: en
tldr: Gives tokens identified by uint256 ids a human-readable string name, with standard functions to convert between name and id and optional ByName versions of every method.
tags: [nft, naming, token, interface, erc721]
---

# ERC-7632: Interfaces for Named Token

> Enable tokens to have a string name and be able to convert between name and id.

**TL;DR:** Gives tokens identified by uint256 ids a human-readable string name, with standard functions to convert between name and id and optional ByName versions of every method.

## What problem does it solve?

[ERC-721](/eip-721/) and [ERC-1155](/eip-1155/) identify tokens by a `uint256 tokenId`. For many collections the token really has a **name**: a domain-like handle, a username, a ticket code. Marketplaces, explorers and wallets end up showing a long number, or each project invents its own lookup function.

ERC-7632 standardizes how a token exposes its name and how to go from name to id and back, so tools can display and operate on named tokens consistently.

## How it works

A compliant contract must support a `tokenName` for each token and a mapping between name and id, in one of two ways:

1. **Recommended:** implement `IERC_NamedTokenCore`:

   ```solidity
   interface IERC_NamedTokenCore {
     function idToName(uint256 _tokenId) external view returns (string memory);
     function nameToId(string memory _tokenName) external returns (uint256);
   }
   ```

   The mapping must be one-to-one: `nameToId(idToName(id)) == id` and `idToName(nameToId(name)) == name`. Emitting `newName(uint256 indexed tokenId, string tokenName)` when a name is introduced is recommended.

2. **Default rule:** if the core interface is not implemented, the contract may use `tokenId = uint256(keccak256(tokenName))`.

In addition, every method that takes a `tokenId` is recommended to have a **`...ByName`** twin that takes `string tokenName` instead, for example `ownerOfByName`, and behaves identically.

An optional `IERC_NamedTokenExtension` adds `isValidTokenName` and `normalizeTokenName`, so contracts can declare rules such as lower-casing, which matters for look-alike names.

## Sample code

A named NFT using the default hash mapping (Solidity, OpenZeppelin ERC-721):

```solidity
contract NamedNFT is ERC721 {
    mapping(uint256 => string) private _names;
    event newName(uint256 indexed tokenId, string tokenName);

    constructor() ERC721("Named", "NMD") {}

    function nameToId(string memory name) public pure returns (uint256) {
        return uint256(keccak256(bytes(name)));
    }

    function idToName(uint256 id) external view returns (string memory) {
        _requireOwned(id);
        return _names[id];
    }

    function mintByName(address to, string calldata name) external {
        uint256 id = nameToId(name);
        _names[id] = name;
        _safeMint(to, id);
        emit newName(id, name);
    }

    function ownerOfByName(string calldata name) external view returns (address) {
        return ownerOf(nameToId(name));
    }
}
```

## Things to know

- Status: **Draft**. The interface names (`IERC_...`) and some signatures look unfinished; for example, the spec declares `isValidTokenName` as returning `string` and `nameToId` as non-`view`.
- The spec assumes names and ids are both unique. Without normalization, two visually similar names can map to different tokens, which invites phishing; declare a normalization rule if you allow that.
- With the default keccak mapping, ids are not sequential and names cannot be recovered from an id unless you store them, as the sample does.


---

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