Choosing an ENS text-record key for a service integration

A service imports user aliases from ENS. A generic key like alias can collide with another product’s meaning. ERC-634 gives applications a namespace for service-specific text records.

Use an explicit reverse-domain key

For a service operating example.com, a key such as com.example.alias gives the field a service-specific name. Call text(node,key) on the resolver and preserve the exact spelling. In the fixture only that qualified key returns bob. The separate description record has a different purpose and should not fill an absent alias.

const records = new Map([["com.example.alias","bob"],["description","validator operator"]]);
for (const k of ["com.example.alias","alias","com.example.empty"])
  console.log(k, JSON.stringify(records.get(k) ?? ""));

Define what a returned string establishes

A person controlling the ENS records can write an external username without controlling the corresponding external account. Treat it as a profile claim until your service verifies the link. If you support an older key, document which value takes priority when both exist. A successful read returning an empty string is also distinct from a reverted call or an unreachable RPC endpoint.

eips.ethereum.org ERC-634 text records