<p>I surely hope there's a better answer than mine, but, as a workaround, I believe one option would be to use the NFT <code>TokenName</code> as a metadata. For example, you could have a minting policy that would verify the conditions you provided and, if they met, use the user's <code>PubKeyHash</code> as the token name.</p>
<p>In the script validator (which will accept or reject the NFT) you could ensure that the NFT symbol is the same as the one from your script policy (ensuring conditions are met) and the token name the same as the user's <code>PubKeyHash</code> (making sure it was minted by him).</p>

CC BY-SA 4.0
2021-08-30T11:07:35.067Z
Thanks for the answer. Apologies for the belated acceptance. Using the TokenName isn't something I'd considered, and could work depending on how large it can be (as I need to put a fair amount of metadata in there). I will check it out.
William
CC BY-SA 4.0
2021-08-31T15:13:58.660Z
@William I don't think metadata size will be a problem, since you could create "accounts" inside a validator script, which are identified by a "signature token". The accounts could then handle all the metadata you need inside it's Datum and the "signature" token name would only need to contain the user public key hash and (depending on the implementation) the script validator hash
Mateus
CC BY-SA 4.0
2021-08-31T15:15:10.423Z
An answer I received may be helpful https://cardano.stackexchange.com/questions/2427/change-minted-tokens-recepient
Mateus
CC BY-SA 4.0
2021-08-10T17:13:20.553Z
2021-08-10T17:13:20.553Z
Mateus
<p>I have a <a href="https://www.distributedby.design/post/nfts-on-cardano-what-else-can-they-do" rel="noreferrer">use case</a> where I want to issue NFTs to users along with metadata (in the general sense of the term). The point of these NFTs is literally to hold that metadata - the user's results from participating in a race - not to display pictures/art in any way.</p>
<p>I later want the user to be able to provide these NFTs into a smart contract in order to prove their credentials (e.g. they are entering a marathon, which involves a smart contract that requires them to both pay an Ada fee, plus prove ownership of an NFT showing they have completed a marathon previously).</p>
<p>Transaction metadata is the 'workaround' used to associate metadata with art-based NFTs - &quot;With this workaround of attaching metadata, third-party platforms like pool.pm can easily trace back to the last minting transaction, read the metadata, and query images and attributes accordingly. &quot; (<a href="https://developers.cardano.org/docs/native-tokens/minting-nfts" rel="noreferrer">https://developers.cardano.org/docs/native-tokens/minting-nfts</a>).</p>
<p>Transaction metadata is not currently usable within Plutus, however I believe in the future it will be possible to use it when creating transactions. Whether it will ever be possible to refer to it in a validator, I am not sure.</p>
<p>I have considered whether it would be possible to store the metadata in the datum of a UTXO holding the NFT in the user's wallet (a so called &quot;communication&quot; datum). However this feels fragile as I imagine you can't guarantee that it won't get lost, particularly if the UTXO also holds Ada that ends up getting spent.</p>
<p>Is there anything else I should be considering for this general requirement of &quot;NFTs with metadata to be used during validation&quot;?</p>

CC BY-SA 4.0
2021-08-10T14:15:01.453Z
If you don't have much data to store you can add it to the asset name. Like many do with the 1/1 NFTs where they put the ID into the name, e.g. MyProject123, MyProject124. You could add a unix timestamp for the time into the name of the token.
eddex
<plutus><nft><metadata>
Options for adding Metadata to NFTs, to be used in a Plutus validator
# Options for adding Metadata to NFTs, to be used in a Plutus validator

(Asked by: username_0 on 2021-08-10)

I have a [use case](https://www.distributedby.design/post/nfts-on-cardano-what-else-can-they-do) where I want to issue NFTs to users along with metadata (in the general sense of the term). The point of these NFTs is literally to hold that metadata - the user's results from participating in a race - not to display pictures/art in any way.

I later want the user to be able to provide these NFTs into a smart contract in order to prove their credentials (e.g. they are entering a marathon, which involves a smart contract that requires them to both pay an Ada fee, plus prove ownership of an NFT showing they have completed a marathon previously).

Transaction metadata is the 'workaround' used to associate metadata with art-based NFTs - "With this workaround of attaching metadata, third-party platforms like pool.pm can easily trace back to the last minting transaction, read the metadata, and query images and attributes accordingly. " (<https://developers.cardano.org/docs/native-tokens/minting-nfts>).

Transaction metadata is not currently usable within Plutus, however I believe in the future it will be possible to use it when creating transactions. Whether it will ever be possible to refer to it in a validator, I am not sure.

I have considered whether it would be possible to store the metadata in the datum of a UTXO holding the NFT in the user's wallet (a so called "communication" datum). However this feels fragile as I imagine you can't guarantee that it won't get lost, particularly if the UTXO also holds Ada that ends up getting spent.

Is there anything else I should be considering for this general requirement of "NFTs with metadata to be used during validation"?

**Tags:** plutus, nft, metadata
> **Comments:**
> **username_1**: If you don't have much data to store you can add it to the asset name. Like many do with the 1/1 NFTs where they put the ID into the name, e.g. MyProject123, MyProject124. You could add a unix timestamp for the time into the name of the token.  

---

## 1 answers

### Answer by username_2 on 2021-08-10. Score: 1 | Accepted answer

I surely hope there's a better answer than mine, but, as a workaround, I believe one option would be to use the NFT `TokenName` as a metadata. For example, you could have a minting policy that would verify the conditions you provided and, if they met, use the user's `PubKeyHash` as the token name.

In the script validator (which will accept or reject the NFT) you could ensure that the NFT symbol is the same as the one from your script policy (ensuring conditions are met) and the token name the same as the user's `PubKeyHash` (making sure it was minted by him).

> **Comments:**
> **username_0**: Thanks for the answer. Apologies for the belated acceptance. Using the TokenName isn't something I'd considered, and could work depending on how large it can be (as I need to put a fair amount of metadata in there). I will check it out.  
> **username_2**: @William I don't think metadata size will be a problem, since you could create "accounts" inside a validator script, which are identified by a "signature token". The accounts could then handle all the metadata you need inside it's Datum and the "signature" token name would only need to contain the user public key hash and (depending on the implementation) the script validator hash  
> **username_2**: An answer I received may be helpful https://cardano.stackexchange.com/questions/2427/change-minted-tokens-recepient  

---

