Skip to content
Discussions/App Development/NFT with Meta-Data in Daml FinanceForum ↗

NFT with Meta-Data in Daml Finance

App Development7 posts336 views2 likesLast activity Sep 2023
BE
bernhardOP
Jun 2023

Suppose I wanted to issue an NFT using Daml Finance that I wanted to attach some arbitrary reference data to which is
(a) always visible to the current owner of the NFT
(b) updatable by the asset issuer
How would I do that?

MA
Matteo_Limberto
Jun 2023

Hi @bernhard,

The easiest that comes to mind is to

  • define a contract holding your reference data, having it signed by issuer and owner
  • have said contract implement the Holding and Transferable interfaces (including the Transfer choice)
  • have said contract implement the base Instrument interface

The above effectively makes your contract with reference data a Daml Finance asset.

This is different than the approach we usually take of decoupling holdings from instruments, but I think it suits NFTs quite well.

Matteo

BE
bernhard
Jun 2023

Hi @Matteo_Limberto , thanks for that input, but in fact I do want to decouple reference data (instrument) and holding since they are issued by different entities in my use case.

HU
huw
Sep 2023

Hi guys, I am facing exactly the same issue. I’m thinking the metadata needs to sit on a different contract. In any case, it doesn’t seem to make sense for the metadata contract to implement the Holding base interface. The reason being is when we exercise the Credit choice on an account in order to generate the Holding, we cannot specify any additional metadata to include on the created Holding within the choice arguments. If we then assume a separate metadata contract, we need some way to link it back to the Holding. I was thinking maybe some sort of contract key on the metadata contract – maybe the tuple of (InstrumentKey, AccountKey). However there could be multiple NFTs from the same collection (which would imply same InstrumentKey I guess) within the same account, so it wouldn’t work. If there’s no contract key then it gets messy as we’ll need to maintain a contract ID refrence somewhere all the time. Did you come up with any solutions? cc @Frankie

HU
huw
Sep 2023

Actually now that I think about it, I guess different NFTs must have different InstrumentKeys even if they are from the same collection. Is there a recommended best practice on how to use InstrumentKeys for NFTs?

MA
Matteo_Limberto
Sep 2023

Hi @huw,

We currently do not provide best practices on how to work with NFTs, but I agree with your assessment that different NFTs would have different InstrumentKeys.

The Instrument is then the contract where the corresponding meta-data would be stored.

I take your point that meta-data cannot be stored in the Holding contract because of the reason you describe above (which also @bernhard raised to us once).

Thanks,
Matteo

HU
huw
Sep 2023

Yes, I think the approach that makes the most sense is a unique InstrumentKey for each NFT. If all holders of NFTs in a particular collection should be afforded certain rights, then another instrument/InstrumentKey should be created solely for this purpose. Each holder would own both their NFT holding (with a unique instrument key) plus another holding (with one instrument key per collection). They could claim lifecyclling effects such as airdrops using the second Holding.

← Back to Discussions