What is Metadata?
In the world of Web3, Metadata is a set of data that describes a digital token or a collection.
This data can include elements like the name, description, media file, and properties, among others.
Applications like Enjin wallet, NFT.io, and Subscan need to know where to find this data to show it correctly.
Each token or collection has an on-chain attribute called “uri”. This is a link to a .json file that holds the Metadata.
To learn more about metadata on the Enjin Blockchain, you can visit the Enjin Documentation page: https://docs.enjin.io/docs/metadata-standard
Dynamic Metadata Fetching
Metadata Hierarchy
When an application loads token metadata, it starts by looking for the uri
attribute on the token level.
If there’s no uri
on the token level, it then looks for the uri
attribute on the collection level.
While each token could have it’s own uri
attribute, It is sometimes more convenient, and efficient, to use Dynamic Metadata.
How it works
For Dynamic Metadata fetching, the token uri
attribute does not exist for each token. Instead, one uri
attribute is set on the collection level, with the dynamic keyword {id}.json
.
For example: https://yourdomain.com/{id}.json
When fetching a token dynamically, the {id}
is replaced with the collection ID, followed by the token ID, like this: https://yourdomain.com/8143-72.json.
Dynamic Metadata works best for NFTs with large supply, as usually each NFT has it’s own Metadata, and by using Dynamic Metadata there’s less data stored on-chain, drastically reducing the amount of ENJ tokens required when creating the tokens.
Metadata on NFT.io
When Creating or Editing a token / a collection on NFT.io, the name, description, media, and properties fields are added to the metadata, which is linked to the collection / token uri
attribute on-chain.
Editing Metadata via NFT.io creates a new .json file containing the Metadata, and overwrites the uri
attribute of the collection / token on-chain.
Metadata of NFTs migrated from Ethereum / JumpNet
Metadata for NFTs migrated from Ethereum / JumpNet is dynamically fetched, and it uses this uri
: https://platform.production.enjinusercontent.com/ethereum/assets/metadata/{id}.json
.
With that said, editing the collection on NFT.io would overwrite the collection uri
and therefore break the dynamic fetching, and the tokens in the collection won’t have any metadata assigned to them.
In that case, the collection uri needs to be reverted back to https://platform.production.enjinusercontent.com/ethereum/assets/metadata/{id}.json
, for the dynamic fetching and tokens metadata to be whole again.
To fix the broken metadata, either revert back to the previous platform uri, or host the metadata on your own, outside of Enjin Platform.
- If you wish to revert back to the previous platform uri, first continue to the How to update the collection uri attribute section below.
- After reverting back to the previous platform uri, if you wish to change the collection name / description / image, continue to the How to update a specific metadata attribute section.
- If you wish to host the metadata on your own, in a dynamic way, continue to this guide: Creating and Hosting Metadata Dynamically
How to update the collection uri attribute
Preparation Steps
- Before proceeding, it's important to make sure that the collection owner wallet is accessible through the Polkadot{.js} extension in your browser.
- It's also crucial that the wallet is configured correctly for use with the Enjin Blockchain Console. To make sure of that, please follow the steps in this link: Configuring Polkadot{.js} for use with the Enjin Blockchain Console
- Make sure you are connected to the Enjin Matrixchain to mutate uri of a collection on the Enjin Matrixchain.
Mutating the Collection uri Attribute
Step 1: Navigate to the "My Collections" page
Navigate to the Enjin Blockchain console: console.enjin.io. Make sure that you are connected to the Enjin Matrixchain. If not, switch to it by following the steps in this guide: Switching to the Enjin Matrixchain
In the Enjin Blockchain Console, hover over the "Network" tab, and click the "NFTs" button, followed by "My Collections"
Step 2: Sending the transaction
Locate the collection you wish to change the uri attribute for and click on it.
Then, click on the “Manage Attributes” button.
Select the collection owner wallet in the “using the selected address” field.
In the "key of an attribute" field, insert uri
.
In the "value of an attribute" field, insert the uri you wish to update to.
In this example we are updating the uri to https://platform.production.enjinusercontent.com/ethereum/assets/metadata/{id}.json
.
Then, sign the transaction with your wallet.
Once the transaction is approved on-chain, the uri will be updated.
How to update a specific metadata attribute
To update a specific collection / token attribute such as collection name, description, media etc. follow the same steps from the How to update the collection uri attribute section, but instead of inserting uri
in the “key of an attribute” field , insert the attribute you wish to update (name / description / media / etc.).
To update a token attribute instead of the collection, make sure to choose the token first before clicking the "Manage Attributes" button.
Make sure to follow the Metadata Standard.
Comments
0 comments
Please sign in to leave a comment.