Non Fungible Tokens

+1 vote
Hi Multichain folks,

What's the best way to support non-fungible tokens (NFT) using multichain?

I'm thinking that a stream with unique keys would be good ledger of non-fungible tokens where every unique key represents some non fungible token and the data at each key would describe what the token represented.

The data could also code which address "owned" the token, however, I cannot think of anyway to "transfer" the NFT in a way similar to how fungible tokens are transferred directly on the blockchain.

The only way I can think of is that ownership transfer is done at the application level. So the application will use the stream to track and update ownership. While owners will write transfer instructions to a transfer stream that the application will read, verify and execute.

Is there a better way?
asked Mar 4, 2019 by StevenChan

1 Answer

+2 votes

If you're using non-fungible tokens your best bet is to issue each one as a separate asset, since this is what they effectively are. You can combine them together at the user interface level if you don't want to show them as separate assets.

Alternatively, if there is an issue of scaling to millions of NFTs, you could use inline metadata (in MultiChain 2.0) to track asset identities, and use a transaction filter to ensure these identities are preserved from input to output. In this case you will need to build transactions manually using APIs like listunspent + createrawtransaction in order to ensure the right metadata is written in outputs for the tx inputs.

answered Mar 5, 2019 by MultiChain
So what you're saying is that we have a single asset that we add inline metadata to to create NFTs?

But if a user has several of these assets, how do we find which of the tokens is which asset as from multichain perspective they will all be the same asset?

Also wouldn't we need to make sure that the wallet does not gather these assets together to consolidate utxos?
First, your transaction filter would enforce the rule that the metadata in the UTXO outputs of a transactino have to match the metadata in the UTXO inputs (with the exception of issuances).

In terms of determining which tokens are owned by a user, the listunspent API can help you since it will include this metadata in its output.

And so long as you leave the lockinlinemetadata runtime parameter on its default value, the wallet will not try consolidating these UTXOs. (And even if it did, the transactions would fail because they would not pass the tx filter.)