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.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

To fetch the record for a specific name, you can use one of the following methods:

Wagmi
// https://wagmi.sh/react/api/hooks/useEnsText
import { normalize } from 'viem/ens'
import { useEnsText } from 'wagmi'
 
export const MyProfile: FC<{ name: string }> = ({ name }) => {
  const { data } = useEnsText({
    name: normalize('nick.eth'),
    key: 'com.twitter',
  })
 
  return (
    <div>
      <span>Twitter: {data}</span>
    </div>
  )
}

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