Non Fungible Resources (NFTs)

I’ve been thinking about the best way to implement an NFT (ERC 721) equivalent on Libra. A requirement would be that an account should be able to own multiple NFTs from the same module. The NFT has unique properties associated with it. For the sake of simplicity lets just say that each NFT that’s created could hold a random integer, and each NFT must have a unique ID in order to be distinguishable from the other NFTs (in case there are multiple with the same property values).

The resource within the account would need to store a mapping of IDs of the NFTs owned to the properties of the owned NFT.

Based on my (still developing) knowledge of the MVM, one way this is possible would be to define a resource, let’s call it NFToken, that maintains a value of type bytes. This value would be a serialized byte array of a JSON object that contains the mapping of the NFToken ID to the property values.

While this may be a possible, it would require a lot of effort without JSON support builtins. Even with JSON support builtins, it would probably be an extremely expensive transaction to deserialize, update JSON, and serialize.

Since an account can’t own multiple of the same resource, it makes a NFT implementation a bit more complicated.

Am I over complicating this? Is there some sort of wrapper implementation that I haven’t thought about that would handle this?

5 Likes

Hi Taylor,
To support multiple NFTs with different attributes under a single account, I think we will need collections (e.g., a vector of NFT resources or a map from an identifier attribute to a NFT resource). The initial release of Move does not have collections, but they are a top priority (along with generics, which are related) for our next release. The technical roadmap for Libra describes our plans in more detail.

We will write more about how to support this use-case once we release collections.

1 Like

Do we have any information about the future plans for Collections? Linear, Associative? Possible dynamic typing to support different resources mixed with other items?

1 Like

Awesome to hear, thanks for the roadmap link! Must have glanced over it when going through the docs.

Is Github the best place to track progress on the roadmap milestones?