NFT News, Updates, Sources, To Buy & Sell, Advice, Disscussions, Tips, Forum, Market, Crypto, & more!


How can I make an IPFS directory behave like a “regular” directory?

TL;DR: How can I get the behavior of being able to index an IPFS directory like any other directory. E.g.: ipfs:///? It must be possible because NFT creators are able to do exactly this.

I looked into IPFS a bit before and I am also somewhat familiar with Merkle Hash DAGs and the underlying concepts of a distributed file system. I have also worked through some material provided by IPFS. What puzzles me is how creators like the Bored Ape Yacht Club (famous NFT creators) are able to have a directory at CIDQmeSjSinHpPnmXmspMjwiXyN6zS4E9zccariGR3jxcaWtq which is then indexed with the NFT tokenID. E.g. under ipfs://QmeSjSinHpPnmXmspMjwiXyN6zS4E9zccariGR3jxcaWtq/0, you find a JSON object regarding the token with ID 0, ipfs://QmeSjSinHpPnmXmspMjwiXyN6zS4E9zccariGR3jxcaWtq/1 of token with ID 1, ...

Based on my understanding, adding a new entry to the directory should change the directory CID as the MHD for that directory changes. I think however they do it doesn't have this behavior, as they would after every NFT drop need to refresh all tokenURIs on-chain to point to the new directory CID (because it has changed due to the drop leading to new JSON files in this directory).

I also did a small experiment where I ran my own IPFS node and added a file to the my IPFS directory using ipfs files write /file1.txt --create and compared the CID of the root directory ("/") before and after. As expected, the CID has changed.

So, how can I get the behavior of the above example where I can:

  1. Index an entry X within a directory using a URI ipfs:///X?
  2. Add elements to the directory without the directory's CID changing?

I don't think they are using IPNS because the tokenURI entry stored on-chain has prefix ipfs:// instead of ipns://.

Thanks for explaning!

What do you think?

Suggestion for creating ERC721 token with extra metadata

Struggling with architecture for crypto project