wealdtech / coredns-ens

Apache License 2.0
57 stars 15 forks source link

IPNS resolution? #3

Closed NoahZinsmeister closed 4 years ago

NoahZinsmeister commented 4 years ago

Does the roadmap for this project include supporting resolution of IPNS pointers via ENS? Specifically, not just traditional IPNS pointers but also DNSLink-style ones.

The usecase here would be if a user adds a _dnslink TXT record to their domain, enabling ipns/<domain>.<tld> resolution, then they should be able to add this pointer as a field to their <name>.ens name, and *.eth.link should be able to perform the recursive lookup.

mcdee commented 4 years ago

This should operate correctly with the current implementation, for example:

$ ethereal ens contenthash get --domain=wealdtech.eth
/ipns/www.wealdtech.eth

And http://wealdtech.eth.link should resolve as expected.

NoahZinsmeister commented 4 years ago

Hm, what if you wanted to resolve to /ipns/<domain>.com, for example? My impression is that uploading records of this variety to the contenthash field of an ENS domain isn't possible, but I would love to be wrong!

mcdee commented 4 years ago

I can't think of a reason why it shouldn't work, do you have a .com domain with DNS link information I could test it on?

NoahZinsmeister commented 4 years ago

Yes, https://noahzinsmeister.com, also available at https://ipfs.io/ipns/noahzinsmeister.com.

mcdee commented 4 years ago
$ ethereal ens contenthash set --domain=mcdee.eth --content=/ipns/noahzinsmeister.com
0x5239ce0b2ac9edf583ebfe65843bf66dc6bd2d383d5fcaf52f4ef4d20300a2f3
$ ethereal ens contenthash get --domain=mcdee.eth
/ipns/noahzinsmeister.com

https://mcdee.eth.link/ appears to resolve as expected.

NoahZinsmeister commented 4 years ago

😍 cool! Will try this out shortly, thank you for the prompt replies.

NoahZinsmeister commented 4 years ago

Works like a charm, thanks! I'm not 100% clear on how ethereal is doing the encoding of /ipns/noahzinsmeister.com, but that's out of scope and something I can look into separately. For now, I just copied your tx data to get it to work 😛.

parkan commented 4 years ago

@NoahZinsmeister it's a multicodec IPNS path:

0xe5 is IPNS (as per https://github.com/multiformats/multicodec/blob/master/table.csv#L70), see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1577.md and https://github.com/multiformats/multicodec/ for more info

you can use a multicodec lib like https://multiformats.github.io/js-multicodec/ to examine it yourself