Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

Text Records

Text records are key-value pairs that can be used to store any arbitrary data associated with a name. Think of this as a user's digital backpack utilized for the storage of preferences, public details, and more.

nick.ethnick.eth
KeyValue

The most popular records have been standardised. One example of a standardised record is the avatar record which is used to store a user's profile picture.

Getting Records

Read records through the Universal Resolver using an ENSv2-ready library: viem 2.35.0 or later or ethers 6.17.0 or later. The Wagmi example was tested with Wagmi 2.19.5 and viem 2.57.10. Use that pair with the provider setup.

Replace <MAINNET_RPC_URL> with your Ethereum Mainnet RPC endpoint in each example.

Wagmi
import { normalize } from 'viem/ens'
import { useEnsText } from 'wagmi'
 
export function Profile({ name }: { name: string }) {
  const { data, isPending, error } = useEnsText({
    name: normalize(name),
    key: 'com.twitter',
    chainId: 1,
  })
 
  if (isPending) return <span>Loading…</span>
  if (error) return <span>Lookup failed</span>
  return <span>Twitter: {data ?? 'No record set'}</span>
}

The examples read existing records. A missing name, resolver, or record needs an appropriate empty or error state in your application.

Types of Records

ENSIP-5 and ENSIP-18 specify two sets of records that are considered standardized. Below are some of the most commonly ones:

NameUsageReferenceExample
avatarAvatarENSIP-5eip155:1/erc1155:0x495f...
descriptionBio or description of the profileENSIP-5Lead developer of ENS
com.twitterTwitter/X handleENSIP-5nicksdjohnson
com.githubGitHub handleENSIP-5arachnid
urlWebsite URLENSIP-5https://ens.domains
headerImage URL to be used as a header/bannerENSIP-18ipfs://QmNtHN7WE...

Custom Records

While standardized records are expected to have the best ecosystem support, it's possible to store any key-value pair you desire. We generally recommend to stick to a pattern, or prefix things with your app or protocol (eg. com.discord, or org.reddit), as such to avoid collisions.

Setting Records

Text records are controlled by the resolver associated with a given name. Read more about interacting with a resolver.

Interacting with a ResolverTo learn more about interacting with a resolver.
Advanced