I’m working on an NFT project with 10,000 ERC-721 tokens. The plan is to store metadata on IPFS. I’ve already uploaded the images to IPFS with their unique CDIs.
Here’s the tricky part: I want to start with empty metadata and a placeholder image for each token. Then, as tokens are minted, I need to update their JSON files.
My main concern is how to do this without setting specific TokenURIs in the contract. I want to keep a common BaseURI for all tokens. Is there a way to change the JSON file for a token when it’s minted without messing with the BaseURI?
For example:
ipfs://Qx123456789/1.json // empty at first
// Token 1 gets minted
ipfs://Qx123456789/1.json // now updated, same base URI
I’ve heard IPNS might be involved, but I’m not sure how to implement it. Many popular collections seem to use this method, like the Bored Ape Yacht Club. Any ideas on how to make this work?
hey there LiamDragon22! that’s a pretty interesting NFT project you’ve got going on. i’ve been messing around with some similar ideas lately and i think i might have a suggestion for you.
have you looked into using IPNS (InterPlanetary Name System) for this? it could be exactly what you need. basically, IPNS lets you create a mutable pointer to your IPFS content. so you could have a single IPNS address that always points to your latest metadata, but the actual content can be updated.
this way, your baseURI stays the same, but the content it points to can be dynamically updated. it’s a bit more complex to set up, but it gives you the flexibility you’re looking for.
have you tried anything like this before? what kind of challenges are you running into with your current setup?
Your approach is intriguing, LiamDragon22. While IPNS is a viable solution, it might introduce complexities and bottlenecks. Have you considered implementing a metadata registry contract? This solution would allow maintaining a consistent BaseURI while enabling dynamic updates to individual token metadata. The registry would map token IDs to their corresponding metadata CIDs, and the main contract’s tokenURI function would query this registry to construct the full URI. This method offers advantages such as consistent BaseURI use, granular metadata updates, cost efficiency, and better metadata control, even though it introduces an additional contract interaction.
yo liamdragon, sick project idea! have u considered using a centralized API as a middleman? it could fetch the updated metadata from ipfs and serve it to ur contract. this way u keep the same baseuri but can update the json files on the fly. might be easier than messing with ipns. what u think?