Updating NFT metadata on lighthouse IPFS after token creation

I have an issue with my NFT collection that I already deployed. The problem is that my metadata files have the wrong image paths and now the images won’t display properly.

Currently my metadata looks like this:

"artwork": "token1.jpg"

But I need it to be:

"artwork": "https://gateway.lighthouse.storage/ipfs/bafkreidxvnm7qp8kj9wf3h2lm6n4r5s8t1u2v3w4x5y6z7a8b9c0d1e2f3g4h/token1.jpg"

The tokens are already minted but the artwork won’t load because the metadata has incomplete URLs. I looked around and found that IPFS files are supposed to be immutable. Is there any way to fix this problem or do I need to redeploy everything?

Oh wow, this is pretty interesting! I’ve been thinking about deploying my own collection soon and this kinda scares me :sweat_smile:

Wait - when you say the tokens are already minted, did you check if your smart contract has updatable functions? Some contracts let you change the base URI after minting, which could save you from updating each individual token.

Also curious - how many tokens? If it’s a small collection (under 100), updating individual tokenURIs might not be too expensive depending on gas prices. But thousands… oof.

One thing though - you mentioned lighthouse storage specifically. Have you tried their support? I know IPFS is immutable, but sometimes these storage providers have workarounds that aren’t obvious.

What contract did you deploy? Custom one or something like OpenZeppelin’s templates? That’ll affect what options you have.

that sux man, but yeah ipfs is immutable. ur gonna have to upload new metadata with the proper urls, and if possible update the tokenURI. otherwise, a full redeploy might be ur only option. just make sure to check those paths next time lol!

Indeed, you’ve encountered a fundamental characteristic of IPFS: its immutability. However, if your contract is designed to allow updates, particularly with ERC721URIStorage, you can upload new metadata files with the correct image URLs and subsequently update each token’s URI. Be mindful that this will incur gas fees for each transaction. Some smart contracts facilitate batch updates to save on costs, so it’s wise to review the functions available in your contract via Etherscan. If your contract does not support any form of URI updates post-minting, unfortunately, redeployment may be your only course of action. I recommend thoroughly testing metadata before deployment to avoid such issues in the future.