How to Create a Customizable NFT
Imagine you have a generic NFT (Non Fungible Token), like Pet Number (https://petnumber.xyz) I recommend the article: https://coinsbench.com/how-to-create-your-own-on-chain-nft-218067356f3e
The most important part of the PET NFT is the 32 bytes number that can represent almost anything. Let’s say you own one Pet Number, but the representation on OpenSea is only a number and you want to have a representation of a roman short sword, called Gladius, because that is the kind of asset your NFT is representing more often in a game.
How can you change the image after minted the NFT? In a regular NFT you can’t. I am going to show you how to create an NFT that allows the holders to change the images and even incentivize the creators of the images, this will be part of another article, keep reading along.
How the NFT handle the image?
The NFT have a method to show the metadata called tokenURI, that metadata is a JSON that contains the name, description, image and any other structured data the creator decide to provide there. More about this here: https://coinsbench.com/how-to-create-your-own-on-chain-nft-218067356f3e
Let’s take as example the Pet Number implementation of tokenURI:
function tokenURI(uint256 _tokenId) public view virtual override