ERC 721 - Modify the metadata of an NFT already minted

Hi there,

Is it possible to create a NFT that represent a game object (i.e. a character of level 1, strength: 14, agility: 20) and modify it after it is minted?

1 Like

You need to change the metadata URI, it's the only way to change metadata. Do you plan to use a centralized server or IPFS URIs?

1 Like

Thank you frangio!! The design is the following one:

  1. A Docker to host the web application (React.js)
  2. Serverless functions to do internal computing logic (i.e. Lambda) and interact with the database
  3. A Non-SQL database (i.e. dynamodb).
  4. Truffle + OpenZeppelin + Solidity + web3 + metamask to:
  • create smart contracts for the NFTs
  • login and get the current account balance
  • update the NFTs

The game will be hosted on the web application and the database (centralized server + serverless ddbb/logic). However, the NFTs required to play will be allocated in the blockchain. we will only interact with them to list, buy and updgrade them. does it makes sense?

Sorry this doesn't answer the question.

My question is, each NFT will have a tokenURI where the metadata is hosted. What will that URI look like?

I dont know how to answer your question; becasue what I want to know is if a NFT can support metadata that will change automatically with minor changes in the game or should I link these changes in a ddbb.

For example: a user buy a NFT (a character of level 1) to start the game. He uses internal balance to improve his NFT (i.e. update to level 2). As those changes are very often; I do not know if it is a good idea to: A) link the NFT address with a centralized database to update the changes (ie. address: 0x027878213, level: 2) or B) change the NFT metadata in the blockchain (as it is very often, I do not know if this option is a good idea).

Thank you in advance.

@Abubillo what @frangio is pointing to is " interface ERC721Metadata
described and detailed at the EIP-721 spec ERC721 NFT spec

The metadata interface's method function tokenURI(uint256 _tokenId) external view returns (string); returns a url which provides a json meta-data for the token identified by _tokenId in the method.

That url can be a regular http url pointing to your server - so you can change meta-data of the token as user buys/changes it. The other way is to make that url an IPFS url this makes the meta-data unchangeable - which, as I understand does not work for your case'

its on the game users to trust a system which can change meta data of an asset.

Hope this answers your question.

2 Likes

shaksoni, thank you very much for your answer!!

So, in the case I create a NFT for the game I should define the uri endpoint for the item in the creation process (i.e., http://xxx.api/nft_id=234897) where the information related to it will be stored. However, this token Uri will have to trust in the server where the data should be appropriated modified. For example: I buy a character and the NFT is created pointing to the centralized server of the game. Later, the user upgrades the NFT so, the information is not changing in the NFT, it will be modified in the game ddbb server instead. in the future, if the user wants to sell the NFT, the buyer should check the private endpoint of the game to see the information related to it. am i right?

Yes you are correct. If the tokenURI points to the endpoint of a centralised game server, you can always update this json object to "update" the stats of the NFT i.e. you do not have to modify anything on the NFT since changes are retroactive - when you update your database, it will be updated.

If on the other hand, it is stored on IPFS then you will need to update the tokenURI (if your NFT token contract has such functionality) to point to the new stats.

1 Like