---
eip: 634
label: ERC-634
title: Storage of text records in ENS
status: Stagnant
type: Standards Track
category: ERC
created: 2017-05-17
requires: 137, 165
official: https://eips.ethereum.org/EIPS/eip-634
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-634.md
canonical: https://eips.huatuo.xyz/eip-634/
lang: en
tldr: An ENS resolver profile, text(node, key), that lets a name store arbitrary key/value text such as an avatar, website, email or Twitter handle, turning ENS names into simple public profiles.
tags: [ens, naming, profile, resolver, metadata]
---

# ERC-634: Storage of text records in ENS

> Profiles for ENS resolvers to store arbitrary text key/value pairs.

**TL;DR:** An ENS resolver profile, text(node, key), that lets a name store arbitrary key/value text such as an avatar, website, email or Twitter handle, turning ENS names into simple public profiles.

## What problem does it solve?

[ENS](/eip-137/) maps human-readable names such as `alice.eth` to machine data like addresses and content hashes. People also wanted to attach human-readable information to a name: a website, an email address, an avatar, social handles. Adding a separate resolver function for each kind of data would never keep up with new needs.

EIP-634 borrows the idea of DNS `TXT` records. It adds one general function that returns a text value for any key, so new kinds of data need only a new key and never a new contract interface.

## How it works

A resolver that supports this profile implements:

```solidity
function text(bytes32 node, string calldata key) external view returns (string memory);
```

- `node` is the ENS namehash of the name.
- The value is any UTF-8 string. If the key is not set, the resolver must return `""`.
- Its [EIP-165](/eip-165/) interface ID is `0x59d1d43c`, so clients can check support first.

Keys come in three groups:

- **Global keys** use lowercase letters, digits and hyphens: `avatar`, `description`, `display`, `email`, `keywords`, `mail`, `notice`, `location`, `phone` (E.164 format) and `url`. If `display` is set, it must match the name when case is ignored, for example `RicMoo.eth` for `ricmoo.eth`. Otherwise clients should ignore it.
- **Service keys** use reverse-DNS notation for a namespace the service owns and contain at least one dot: `com.github`, `com.twitter`, `com.linkedin`, `io.keybase`, `org.telegram`. A service can also define a hierarchy such as `com.example.users`.
- **Legacy keys** (`vnd.github`, `vnd.twitter`, `vnd.peepeth`) come from earlier drafts. Clients may query them as a fallback.

## Sample code

Reading text records with ethers v6:

```ts
import { JsonRpcProvider } from "ethers";

const provider = new JsonRpcProvider(process.env.RPC_URL);
const resolver = await provider.getResolver("vitalik.eth");
if (resolver) {
  const url = await resolver.getText("url");
  const twitter = await resolver.getText("com.twitter");
  console.log({ url, twitter }); // empty or null when the key is unset
}
```

A minimal resolver storing records per name (no access control, for illustration only):

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

contract TextResolver {
    event TextChanged(bytes32 indexed node, string indexed indexedKey, string key);
    mapping(bytes32 => mapping(string => string)) private texts;

    function setText(bytes32 node, string calldata key, string calldata value) external {
        texts[node][key] = value; // real resolvers check the caller owns `node`
        emit TextChanged(node, key, key);
    }

    function text(bytes32 node, string calldata key) external view returns (string memory) {
        return texts[node][key];
    }

    function supportsInterface(bytes4 id) external pure returns (bool) {
        return id == 0x59d1d43c || id == 0x01ffc9a7;
    }
}
```

## Things to know

- **This EIP's status is Stagnant.** The text-record interface is nevertheless implemented by ENS resolvers and read by wallets and apps. ENS now maintains it as ENSIP-5.
- Text records are public on-chain data. Do not store anything you would not publish, such as a private email or phone number.
- Values are not verified. A `com.twitter` record proves only what the name owner claims, not that they control that account.
- The `avatar` value is usually a URL, but clients differ in which formats they resolve, so test with your target wallets.


---

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