Where are ENS names stored?
As explained in Design & Implementation: How Does ENS Work, the
.eth Registrar, and
Resolvers are all smart contracts on the Ethereum network.
Every account in Ethereum has a persistent memory area called storage, and this is where the entries and records in ENS are stored. The ENS contracts will expose various methods to read that storage, and that is how lookups are made possible.
Let’s go through an example with the name
ens.eth. You can follow along here on Etherscan: https://etherscan.io/address/0x00000000000c2e074ec69a0dfb2997ba6c7d2e1e#readContract
The node (or namehash) for ens.eth is
If you enter that node into the owner method and click on Query, it should return the Manager for that name:
Similarly, if you enter that node into the resolver method and click on Query, it should return the Resolver for that name:
Next, we can go to that resolver contract and look up records for the name: https://etherscan.io/address/0x4976fb03c32e5b8cfe2b6ccb31c09ba78ebaba41#readContract
If you enter the node into the first addr method and click on Query, it should return the ETH address that the name resolves to:
Finally, we can try looking up a text record from the resolver.
If you enter the node into the text method (use “url” for the key) and click on Query, it should return the URL text record that the name resolves to:
As you can see, methods like these can be exposed by smart contracts to allow users or other smart contracts to read / write data from its internal storage.
When a website/app/wallet needs to look up your ETH address or other records for your ENS name, it is following the same steps we just went through above.
The ENS Manager App performs these same steps to return records: