docs
docs copied to clipboard
Feedback for ENS Subdomain of DNS Name
Feedback for ENS Subdomain of DNS Name
Hi! I was hacking on ETHGlobal Singapore and was introduced with the interesting concept of using DNS name as ENS. My objective is to import a DNS name, then use it for ENS Subdomain. For instance:
- import angpao.money (DNS name)
- use it for ENS Subdomain, e.g. alice.angpao.money, bob.angpao.money, etc.
I believe there isn't any comprehensive and complete guide on this topic, and considering just how exciting we can programmatically add ENS subdomains, I would like to contribute by providing a high-level outline as pointer for future reference.
How to import DNS name into ENS, then issue subdomain ENS.
- Own a domain. Before purchasing, make sure to check if your preferred TLD is supported.. Not all domains are created equal.
- Enable DNSSEC at your registrar. If you import your domain name into Cloudflare, first enable DNSSEC in Cloudflare, then update DS data with your registrar. Note: I tried Porkbun and Godaddy. Interesting enough only Porkbun worked.
- Go to the ENS App, type in your domain name. It should show up as
not imported
. Proceed withOffchain
, then add the DNS record as instructed, should be aTXT
record that looks likeENS1 dnsname.ens.eth <eth-address>
. - By this point, the DNS name should be already a working ENS name. However in order to issue subdomains, we need to deploy an Offchain Resolver, where we can find template here. Most of the template are mapping ENS name to static files, I modified the templateto do query instead.
- Copy down your signer's public key. If you are following the guide in step 4, you will generate some private key with Python. That's a private key, one way to get the public key easily is to import it into a wallet. Public keys should be 42 characters long.
- Deploy the resolver. I deployed mine to Fly.io for simplicity.
- Deploy the Offchain Resolver Contract using (ccip.tools)[https://ccip.tools/]. Assuming a successful deployment with an endpoint of
https://foo.bar
, the gateway url will behttps://foo.bar/{sender}/{data}.json
. PS: the{}
is actually part of the url! Provide Gateway URL and Signers (make sure you keep them as array), then just deploy. My first test Offchain Resolver Contract was deployed on ETH mainnet and was sponsored by ENS team, you guy rocks! - Obtain the
newOffchainResolverAddress
. I got this by going to Etherscan searching the recent transaction of my wallet. ThenewOffchainResolverAddress
can be found in the logs. Attaching (my example for reference)[https://arc.net/l/quote/aeovmvsu]. - Finally, the last step is to update DNS record.
- 9a: Create a TXT record for root domain, i.e. TXT @ ENS1
insert <newOffchainResolverAddress>
. - 9a: Create a Wildcard TXT record for subdomains, i.e. TXT * ENS1
insert <newOffchainResolverAddress>
- Test it works: if the resolver is functioning properly, just try searching for the subdomain at the ENS app. For my case, after adding the record, into my DB, I can resolve
test.angpao.money
perfectly.
{
"key": "test.angpao.money",
"value": {
"addresses": {
"60": "<your address here>"
},
"text":{ "email": "<your email here>" }
}
}
Feedback: I was expecting content like this could go into page like the subdomain page, since that is where Google pointed me. But given that how fast the ENS team is moving, I can see why documentation is lagging...
Huge thanks to @makoto @gskril
Reference: https://docs.ens.domains/dns/tlds https://support.ens.domains/en/articles/7882690-claim-your-dns-name-onchain-in-ens. https://blog.ens.domains/post/gasless-dnssec https://discuss.ens.domains/t/help-a-n00b-offchain-gasless-dnssec-names-in-ens/19137/2