[Ethereum] Updating ERC-721 Token’s Metadata after it was Minted

blockchainerc-721go-ethereumnftsolidity

Is it possible to somehow update an existing ERC-721 Token's MetaData after it was already minted?

Let's say we've created a Knight character for a game – by minting an NFT for it, and 3 months later we want to update that Knight's attributes to reflect the amount of experience or treasure it has amassed through game play.

The original URI for this Knight-Token looked something like this:

{  
    "name" : "KnightToken1",  
    "description" : "One-of-a-kind-Knight",
    "image" : "http://www.mydomain.com/myImages/knightImage.png”, 
    "attributes" : 
     {  
        “Age” : “30",
        "Treasure” : “2 Gold Crates”
     }

}

We now want to update the "Treasure" attribute to "100 Gold Crates" – how can it be done?

My understanding was that it can't be done – the Blockchain is supposedly immutable after all – but I've seen some posts essentially saying "with our API you CAN do this!" – except they don't tell you how.

So I'm wondering: is this a false claim – or is there really some clever way of updating an already-minted ERC-721's token metadata? And if so, how?

Best Answer

Is it possible to somehow update an existing ERC-721 Token's MetaData after it was already minted?

Yes. This is not disallowed by the standard and so you are free to do this.

The official implementation of ERC-721 is maintained by 0xcert. It is free/open source and you can use the Metadata Mock contract as a starting point. You will simply add a public function that calls the internal _setTokenUri function which is waiting for you.

It will be up to you decide whether to allow anybody to change any URI anytime or if certain restrictions will be implemented.

Related Topic