Skip to content

@ens:text

Read a text record from an ENS name.

On-chain (@ens:text!): Mainnet only, and a missing record or a name with no resolver reads as an empty string instead of erroring.

Returns: string

@ens:text(name key)
NameTypeDescription
namestringENS name (e.g. vitalik.eth)
keystringText record key (e.g. "url", "com.twitter", "description")
# Read a URL text record
set $url @ens:text("vitalik.eth" "url")
print $url
# Read a Twitter handle
set $twitter @ens:text("vitalik.eth" "com.twitter")
print $twitter

Mainnet only, like every ENS face: an assertion is judged on the chain it runs on, and ENS cannot be reached from another chain. The face is the @addr! shape with the resolver's text(node, key) call in the chain hop: resolver(node) on the registry, a hop into whatever resolver that word holds at judgement, and a cond that turns an unset resolver into the empty string. A resolver that exists but has no record for the key also answers the empty string — where the plain face errors — so assert against "" to express absence.