I would like to create an HTML5 NFT that can interact with the smart contract. Like if I press a button in the HTML5 NFT, I can save data to a contract Array or Hashmap thru a gas powered transaction.
My question; How does the HTML NFT identify/reference itself being decentralized?
From what I understand, you create the NFT minting contract. Once you mint an NFT, you are provided with an ID that points to the NFT on the blockchain. Since the ID is provided AFTER the HTML file is uploaded to a decentralized file storage, there's no internal reference ID that can be stored as an HTML variable. Is there a code snippet that can be used via web3js or ethers.js where the HTML NFT can reference itself to call functions on it's own contract in a decentralized way?
One centralized solution I see is to store the HTML docs on my own server. When I get the provided ID after minting, I can store that NFT ID in the HTML doc and resave the HTML doc. This defeats the purpose of being decentralized and if my server eventually goes down, those NFT's are rugged.
Another partly decentralized (but still centralized) solution would be to create a unique ID stored in each HTML file prior to storing the HTML file on a decentralized service like IPFS. When ready to interact, the HTML uses this unique ID to call a centralized database service to retrieve the actual NFT ID and continue from there. If the database server goes down, those NFT's are rugged.
Any thoughts on a possible decentralized solution? Thank you.