1

I'm working on a dynamic NFT project where the images will periodically be updated and I would like to do this with DNSLINK but I'm not sure how to link my tokenURI to the IPFS CID returned by DNSLINK. Can't seem to find any example implementations.

I've created a TXT record that correctly resolves and returns an IPFS link. I've verified this with "dig +short TXT _dnslink.MYDOMAIN.COM"

From what I understand, an IPFS node/client will automatically resolve MYDOMAIN.COM and look for a TXT record that has _dnslink... and then it will use the returned IPFS CID. So when I set a tokenURI in my contract, should it look at MYDOMAIN.COM or _dnslink.MYDOMAIN.COM? And how do I incorporate the tokenID and file extension (.json) into the tokenURI?

1 Answer 1

0

Figured it out, maybe this will help other newbies like myself.

After you set the dnslink TXT record to point at an IPFS CID, just go to ipfs.io/ipns/MYDOMAIN.COM and it'll redirect you to the IPFS CID in the TXT record.

This happens because when an invalid CID is entered in IPNS (ipfs.io/ipns/INVALID_CID), it will try to look up the _dnslink.INVALID_CID to check if it is DNS that is using DNSLINK, if so it'll return the CID set in the DNSLINK.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.