Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feedback for ENS Subdomain of DNS Name #295

Open
JunyaoC opened this issue Sep 21, 2024 · 0 comments
Open

Feedback for ENS Subdomain of DNS Name #295

JunyaoC opened this issue Sep 21, 2024 · 0 comments

Comments

@JunyaoC
Copy link

JunyaoC commented Sep 21, 2024

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:

  1. import angpao.money (DNS name)
  2. 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.

  1. Own a domain. Before purchasing, make sure to check if your preferred TLD is supported.. Not all domains are created equal.
  2. 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.
  3. Go to the ENS App, type in your domain name. It should show up as not imported. Proceed with Offchain, then add the DNS record as instructed, should be a TXT record that looks like ENS1 dnsname.ens.eth <eth-address>.
  4. 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.
  5. 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.
  6. Deploy the resolver. I deployed mine to Fly.io for simplicity.
  7. 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 be https://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!
  8. Obtain the newOffchainResolverAddress. I got this by going to Etherscan searching the recent transaction of my wallet. The newOffchainResolverAddress can be found in the logs. Attaching (my example for reference)[https://arc.net/l/quote/aeovmvsu].
  9. 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>
  1. 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant