NFT with Meta-Data in Daml Finance
- bernhardOP
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? - Matteo_Limberto
Hi @bernhard,
The easiest that comes to mind is to
- define a contract holding your reference data, having it signed by
issuerandowner - have said contract implement the
HoldingandTransferableinterfaces (including theTransferchoice) - have said contract implement the base
Instrumentinterface
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
- define a contract holding your reference data, having it signed by
- bernhard
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.
- huw
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
Holdingbase interface. The reason being is when we exercise theCreditchoice on an account in order to generate theHolding, we cannot specify any additional metadata to include on the createdHoldingwithin the choice arguments. If we then assume a separate metadata contract, we need some way to link it back to theHolding. 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 sameInstrumentKeyI 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 - huw
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 useInstrumentKeys for NFTs? - Matteo_Limberto 1
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
Instrumentis then the contract where the corresponding meta-data would be stored.I take your point that meta-data cannot be stored in the
Holdingcontract because of the reason you describe above (which also @bernhard raised to us once).Thanks,
Matteo - huw 1
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.