ENS Logo

Text Records

With every name come a set of records. These records are key value pairs that can be used to store information about the profile. Think of this as a user's digital backpack. Utalized for storage of preferences, public details, and more.

nick.eth➡️
displayNick.eth
descriptionLead developer of ENS
avataripfs://Qm...
com.twitternicksdjohnson

Text records allow us to attach and read any key value pair from an ENS name. 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:

Get records by name
import { useEnsText } from "wagmi";
import { normalize } from "viem/ens";

export const MyProfile: FC<{ name: string }> = ({ name }) => {
    const { data } = useEnsText({
        name: normalize("luc.eth"),
        key: "com.twitter",
    });

    return (
        <div>
            <span>Twitter: {data}</span>
        </div>
    );
};
const provider = new ethers.providers.JsonRpcProvider();

const resolver = await provider.getResolver("luc.eth");
const twitter = await resolver.getText("com.twitter");
import { normalize } from "viem/ens";
import { createPublicClient, http } from "viem";
import { mainnet } from "viem/chains";

const publicClient = createPublicClient({
    chain: mainnet,
    transport: http(),
});

const ensText = await publicClient.getEnsText({
    name: normalize("luc.eth"),
    key: "com.twitter",
});
from ens.auto import ns

# set text
ns.set_text('alice.eth', 'url', 'https://example.com')

# get text
url = ns.get_text('alice.eth', 'url')
assert url == 'https://example.com'
// TODO: Not Implemented
package main

import (
	"fmt"

	"github.com/ethereum/go-ethereum/ethclient"
	ens "github.com/wealdtech/go-ens/v3"
)

func main() {
	client, _ := ethclient.Dial("https://rpc.ankr.com/eth")

	domain, _ := ens.Normalize("luc.eth")
	resolver, _ := ens.NewResolver(client, domain)
	twitter, _ := resolver.Text("com.twitter")

	fmt.Println("Twitter: ", twitter)
}

Types of Records

Here are some of the most commonly used records:

NameUsageReferenceExample
displayPreferred capitalizationENSIP-5Luc.eth
avatarAvatar or logo (see Avatars)ENSIP-5ipfs://dQw4w9WgXcQ
descriptionDescription of the nameENSIP-5DevRel @ ENS Labs
keywordsList of comma-separated keywordsENSIP-5person, ens
emailEmail addressENSIP-5luc@ens.domains
mailPhysical mailing addressENSIP-5V3X HQ
noticeNotice regarding this nameENSIP-5This is a notice
locationGeneric location (e.g. "Toronto, Canada")ENSIP-5Breda, NL
phonePhone number as an E.164 stringENSIP-5+1 234 567 890
urlWebsite URLENSIP-5https://ens.domains
headerImage URL to be used as a header/bannerENSIP-18ipfs://dQw4w9WgXcQ

Other Records

Currently there are a few records that have been standardised. However you are welcome 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.

Header/Banner Record

One of the newer standardised records is the "header" record. This header record, similar to the avatar record, accepts any IPFS, Arweave, EIP155, or regular URL to an image resource. The image is then displayed as a banner on the profile page and tends to be in a 1:3 aspect ratio.

luc.eth
pedrouid.eth
coltron.eth

Setting Records

When records are loaded they are loaded from the resolver responsible for the name. As resolvers are user controlled, we cannot guarantee a write function is available. This makes it a more in-depth process to update a users records.

Interacting with a ResolverTo learn more about interacting with a resolver.Advanced
Contributors
Last Modified
7 days ago