NFT Metadata and Immutable X

Transcript

Toggle full transcript
00:00

Welcome to the next chapter of the Create, Configure and Sell NFT collections on ImmutableX course. In this chapter, we're going to talk about configuring NFT metadata.

00:10

This first lesson is an introduction to NFT metadata and how it applies to ImmutableX.

00:20

Let's start with the basic question. What is NFTs metadata? Well, metadata in this case is additional information that you can add to your digital asset.

00:30

And this might include things like the title of the NFT, a description of it, the name of the creator, URLs to media files,

00:40

maybe some metadata about those media files like the file types and also any other arbitrary properties that you want to add to describe that digital asset.

00:50

This metadata can then be used by games and apps to store, retrieve and display information about that digital asset.

01:00

This metadata can then be used to provide context about the asset and also to help ensure and describe its provenance and

01:10

authenticity and uniqueness. So what might this look like? Let's have a look at an example.

01:20

So we've got this NFT that we've created here on ImmutableX for Ignis Emberstone. And we can see that there is a bunch of information

01:30

here, including that title Ignis Emberstone, an image here and some properties that you can see there. This is what the metadata payload for that

01:40

NFT looks like. You can see we've defined a name, the URL to the image and then some of those other properties.

01:50

One of the interesting things to talk about, if we're going to be talking about NFT metadata, is the concept of traits. Now traits are, for example, these properties that you can see

02:00

here. In this case, Ignis has a class of mage, magic score of ten and attack score of five, a defence score of

02:10

two, for instance. Now, traits basically codify an, often unique, set of attributes and characteristics that help describe that NFT

02:20

and, within the context of the collection within which it sits, basically help to identify the uniqueness of

02:30

that NFT. Typical things that might be described in traits might be things like colors, shapes, patterns, textures, stats.

02:40

But really, the sky's the limit. As I said, traits often play a key role in uniquely identifying

02:50

and determining the value of an NFT within the context of an NFT collection. Now, if we take a look at ImmutableX, there are a few key

03:00

life cycle moments that exist in the lifecycle of the creation of an NFT and the interactions

03:10

with it that really define the metadata of that NFT. And it's worth keeping in mind that the metadata will exist on both Ethereum as a layer one and ImmutableX

03:20

as a layer two, and the mechanisms that both of those two blockchains use to determine the metadata are slightly different.

03:30

So understanding these key lifecycle moments helps us to determine how we control the metadata on both of those two blockchains. The first thing that's important is the act of creating a

03:40

collection on ImmutableX that corresponds to a NFT contract on Ethereum.

03:50

And the key bit of information that you specify at this point in time is the metadata API URL, and we'll see in a second what impact defining that actually has.

04:00

The second key life cycle moment is the moment in time when you first mint the NFT on ImmutableX from that collection.

04:10

And at this point in time you define two key properties. One of them is the token ID and the second one is the blueprint. And you would have seen these in the labs in the previous chapter.

04:20

And thirdly, when you withdraw an NFT for the first time from ImmutableX into Etherium,

04:30

you at that point in time have the token ID and Blueprint passed to the smart contract by ImmutableX

04:40

and you're able to use that information within your smart contract to determine how to set the metadata from an Ethereum perspective.

04:50

And you have a lot of flexibility about how you want to do that. So these are the key bits of information that determine the metadata approach from both layer one and layer two, metadata API, URL,

05:00

token ID and blueprint. And these are the key lifecycle moments. Create mint and withdraw where you have control over how the metadata is determined.

05:10

Let's start by looking at how immutable X determines the metadata. This is done via the ImmutableX NFT metadata URL,

05:20

and this is calculated by taking the metadata API URL that's defined against the collection and the token ID

05:30

that's defined against the NFT. And these for each individual NFT are basically combined together to create a URL that then has the definition

05:40

of the metadata for that NFT. So as an example, if we had a metadata API URL of

05:50

https://myapi.com and then a token ID of three, then ImmutableX would go to myapi.com/3

06:00

To try and retrieve the metadata for that particular NFT. And the expectation is that the metadata at that URL is an ERC-721 compatible metadata payload.

06:10

The other key thing that controls metadata is the blueprint.

06:20

The blueprint is an immutable string that's defined at mint time. When you mint the NFT on ImmutableX and it is passed to the Ethereum when withdrawing an NFT

06:30

and used in the smart contract code to create or mint the actual underlying NFT in Etherium.

06:40

This string can be used to encode metadata and allow the owner of a token in

06:50

ImmutableX to have some sort of certainty about what the attributes of their NFT are going to be on Ethereum, assuming that they can read the smart contract code and interpret

07:00

what will happen. The blueprint is a required field when minting an NFT on ImmutableX.

07:10

So you'll note in the lab that we had in the previous chapter, the blueprint was one of the fields that was specified there, and it has to have a value.

07:20

We have a suggested pattern that you could use, which is that if you set an ipfs content ID of the metadata payload for your metadata into the blueprint,

07:30

then in your smart contract code, you could actually set the token URI to the IPFS URL.

07:40

And this conforms with best practice on Ethereum with representing metadata as an immutable IPFS URL.

07:50

In terms of the ERC-721 metadata schema, this is essentially the main definition of it. The schema itself is quite simple.

08:00

It's a JSON object that has three properties at the very least as required properties: name, description and image where name is the name or title of the NFT, description

08:10

is a description, and the image is a URL pointing to the image based media asset of that NFT.

08:20

Now, whilst this is the minimum representation of ERC-721 metadata payload, you can also add other properties to it as well.

08:30

Here's a simple example of what ERC-21 metadata payload might look like. Now, the interesting thing about metadata payloads is

08:40

that different marketplaces will have different formats that they support for the definition of other properties. Then these three in particular traits.

08:50

So for instance, if we look at Opensea, Opensea's ERC-721 metadata standard includes an attribute key, which is an

09:00

array of JavaScript objects that have a trait_type attribute with the name of the trait and a description attribute with the value.

09:10

So in this case, this particular one has a base of starfish and eyes of big. This same metadata payload would look like this

09:20

for ImmutableX. So ImmutableX has a concept of including traits as standard key value pairs at the root level of

09:30

the metadata payload. Naturally, this means that the two metadata schemas aren't compatible with each other. But the good thing is, if you wanted to create one

09:40

payload that works for both Opensea and Ethereum and ImmutableX, you can actually combine the two together and have something that looks like this along with an attributes property

09:50

in ImmutableX in order to differentiate which of the properties are actually traits or not.

10:00

There's a concept of a metadata schema that can be defined per collection. This facilitates efficient storage and retrieval of data,

10:10

enhances data interoperability, allows for consistent description and categorization of data, and supports searching

10:20

and filtering of that data. And essentially, there's a number of different types of data that you can specify. So you tell ImmutableX this property is of

10:30

this type, maybe it's an Enam or text or Boolean or just great value. And then you can also indicate whether or not that particular property is

10:40

filterable or not, which then translates into some of the user experiences that you will see in ImmutableX.

10:50

The final thing to talk about is the metadata APIs that ImmutableX exposes. There's 4 APIs to talk about.

11:00

The first one is the Assets API. This is the API that allows you to retrieve the cached metadata that ImmutableX holds for an NFT.

11:10

You can do this by looking up the token address and token ID. of that asset.

11:20

Secondly, the IMintable token API provides you with the parameters that were originally passed through when a given NFT was first minted on ImmutableX,

11:30

and this includes the blueprint value. Thirdly is the metadata API.

11:40

This is the API that allows you to specify and retrieve the metadata schema on ImmutableX for

11:50

a given collection. And finally, the metadata refresh API. This is an API that lets you trigger a refresh for a

12:00

set of tokens or NFTs within a given collection. Thanks for joining me to talk about metadata as it relates to

12:10

NFTs on ImmutableX. Next, let's dive into a lab so that we can actually put this knowledge to practice.