2

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:

Objectives:

  1. Stay away from an account base model and if possible keep the NFT as a native token.

  2. Have the metadata accessible from the contracts (token metadata must be inside an eUTXO).

Possible solution:

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?.

0

Your approach won't work, because in order to read the onchain data in a datum file, you have to consume given UTXO.

CIP 25 - NFT Metadata Standard has been created before smart contracts and is intended for minting outside of the them.

I'm not sure if it is a good idea to mix these two approaches. If you are a NFT author, it's up to you to choose what you want to do.

If minting native tokens with a script locking, you basically lock yourself out of burning the given token (we might have a solution for it in the future, but it is not possible right now) and it is all you have - a dummy token with metadata.

On the other hand, if you want to enable cool decentralized features to your NFT, you might want to mint it using a smart contract that will enable you, to add different proprieties to it (such as burning and re-minting).

Over time, there will be probably an update to CIP25 to account for smart contract based tokens.

5
  • To consume the eUTXO to read the metadata onchain, is not an issue, the token will be placed in a new eUTXO after we access the data (and we can enforce this). Nov 18 '21 at 13:27
  • I am trying to figure out how to read this metadata >offchain<. Losing the ability to burn the state token is not important to me atm, most NFTs right now cant do this anyways after the policy expires. And we could allow to burn the native token used as handle. Nov 18 '21 at 13:31
  • My idea is to have access to the token metadata from the minting policy and other validator scripts, you will be required to spend the eUTXOs with the state tokens, of course, to get access to the datum, and will be required by the script to place them on the contract again while conserving the metadata. Nov 18 '21 at 13:42
  • Can you explain what you mean by "in order to read the onchain data in a datum file, you have to consume given UTXO"? Where does the datum file come from if you can only get it at spend time? Dec 15 '21 at 5:28
  • You can only access the datum data from the smart-contract when you spent the output, it must be provided as a witness by the spending transaction. What I want to do is to get the datum data off-chain by querying the blockchain so I can display and use the data offchain as well. It must be possible because blockfrost api does it somehow Dec 15 '21 at 13:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.