I have been thinking recently about the way we are predominately creating NFTs on Cardano, right now the trend is to add the NFT attributes to the transaction metadata, however, I think this is not really that good if we want to do more interesting things with the tokens. As long as we keep adding the NFT attributes to the transaction metadata we will never have decentralized minting (creating new NFTs from smart contracts, e.g breeding mechanism etc), as we can not enforce any kind of restrictions on the transaction metadata from the scripts. The users always have all the freedom to add anything to the metadata. Also, we cant read the information stored there from the contracts, making it impossible to use for example to implement business logic on the chain.
I have the following idea, but I am not sure if it could work:
Stay away from an account base model and if possible keep the NFT as a native token.
Have the metadata accessible from the contracts (token metadata must be inside an eUTXO).
At minting time we create two tokens, for example:
“fffffffffffffffffffff.Monster00001” and “fffffffffffffffffffff.Monster00001_state” (they could be in the same policy or different policies).
Token “Monster00001” could still be freely traded as a native token, however token Monster00001_state will be trapped in an eUTXO which holds the token metadata or dynamic state (depending on the use case).
To retrieve the metadata for token fffffffffffffffffffff.Monster00001 we just need to find the eUTXO which contains fffffffffffffffffffff.Monster00001_state and read its datum (from off-chain code to for example display the NFT in a website), but here is where I am stuck.
I know that by using –tx-out-datum-embed-file we can embed the datum data on the transaction (as opposed to the datum hash). However, is this information persisted on the blockchain? (I am guessing it is as it is needed in some scripts validators), and if so, how can we retrieve this data?.