How it works
Forward and reverse resolvers, and how names and addresses link.
ANS resolves names using two complementary resolver contracts. Understanding them explains what it means for a name and an address to be linked.
Requirements
ANS was designed to satisfy a few rules:
- A
Nameis represented as an NFT, so it can be easily traded. - A
Nameresolves to at most oneAddress. - An
Addresson any group (shard) resolves to at most oneName. - The holder of the
NameNFT can assign anyAddressto that name. - An
Addressdoes not need to hold theNameNFT to be resolved. - An
Addressmust give its own permission for which name resolves to it.
The two resolvers
ForwardNameResolver — a single contract on group 0. It records which Address a Name should resolve to. Only the holder of the Name NFT can set this.
ReverseNameResolver — a contract deployed on every group. It records which Name an Address should resolve to. An address can only set its own reverse entry.
What "linked" means
A Name and an Address are considered linked only when both exist:
- a
ForwardNameResolverentry (Name→Address), and - a matching
ReverseNameResolverentry (Address→Name).
This two‑sided design means linking never requires passing an NFT around: it takes just one transaction from the name holder and one from the target address.
Example
Say the ForwardNameResolver on group 0 holds:
"bob"→"address_1""alice"→"address_1""steve"→"address_1"
And the ReverseNameResolver on group 1 holds:
"address_2"→"alice""address_1"→"alice""address_3"→"alice"
With just two lookups — and no off‑chain processing — we can confirm that "alice" and "address_1" are linked, because the forward and reverse entries agree.