Blockchain – Updating ERC-721 TokenURI After Minting

blockchainerc-721nft

This is a conceptual question. Is it possible to somehow update an existing ERC-721 Token's uri, after the NFT was already minted?

For instance, I minted an NFT where the asset location was AWS S3. Later, I wanted to update it to IPFS. Would this be possible for an already-minted NFT? Or, given how the blockchain is immutable, what I'm asking is conceptually impossible?

Please provide an illustrative example. Thanks.

Best Answer

It depends on how you implement your NFT.

In the standard OpenZeppelin implementation, there is no possibility to directly modify the tokenUri. There's only a getter: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/566a774222707e424896c0c390a84dc3c13bdcb2/contracts/token/ERC721/ERC721.sol#L92

If you think about it, it makes a lot of sense to not allow anyone to modify the uri. If it could be changed, you could sell an NFT which points to uri A and afterwards change it to point to uri B - basically changing the whole NFT contents.

But nothing stops you from adding such extra functionality in the ERC721 contract. It would not be very correct towards users, but technically you can do it - before you deploy the contract. It doesn't make much difference whether the token is already minted or not - you can add functionality to modify whatever you wish.