I am building a blockchain game where users can update their character's appearance. This is done by calling a function called updateAppearance
in smart contract.
I want to show latest version of that token in my website. For example, if user changes hair of his/her character, I want to change metadata by changing tokenURI
.
My best guess is, calculate an string
or byte
according to current appearance of character and change tokenURI
to baseURI + string
. But problem with this approach is, I have to upload every single possibility to my server (or IPFS) and for me this is probably not the best way of doing this.
Another thing that comes to my mind is sending request to my server from blockchain (not possible without oracles) but I don't know anything about oracles and I think this approach is bit too complicated for this kind of project.
What would be better approach for this, how should I store metadata in my server?
Edit: I checked CryptoZombies project (awesome btw), they store Zombie's DNA with an integer. Maybe I can store character's appearance and point tokenURI to that DNA string I calculated. Then in my server (ExpressJS), I can dynamically generate image data using that DNA.