Let's provide some context before we dive into the details.
When you create a non-fungible token, you need to have two files hosted off-chain:
- a media file
- a metadata file
These files should be hosted off-chain due to blockchains' inability to store large data volumes and the high cost of data storage. The blockchain only retains the ownership record of an NFT. The NFT, in turn, points to the off-chain hosted metadata file, effectively offsetting the storage cost.
Now, let's take a look at the two files:
- The Media File: This file can be of any type/format (e.g., picture, audio, video, document). Essentially, this is the asset your token represents.
- The Metadata File: This is a JSON file serving as your token's descriptor. It allows you to define attributes such as the token's name, base_uri, and other properties of your choice. To aid in the discovery of your NFT, structuring your metadata file using a standard scheme is advisable.
When deploying a ERC-721 contract on Co:Create, you'll need to provide a
base_uri parameter. This
base_uri is a URI that leads to the contract's metadata file.
Here's an example of a metadata URI:
Accessing this link will lead you to a non-fungible token's metadata, which includes a link to the media file itself:
Media can be created & hosted for the NFT collection using the Media API. This media can be any digital content that is associated with the NFT, such as an image or a video. Media can apply to the full collection or it can be applied to a single token. The output of this is a media URL which is publicly accessible.
The next step is to create metadata for the collection using the Metadata API. This metadata can include details about the NFT, such as its name, description, and attributes. If choosing to use Co:Create’s Media API as well, the media URL provided as part of the GET media response is also added to the metadata. Metadata can also apply to the full collection or it can be applied to a single token.
The output of this step is a metadata URI which is added to the token contract upon deployment. (To reduce gas costs, metadata is never stored on-chain unless absolutely necessary. Only the URI is stored on-chain, which points to where the metadata can be viewed.)
Co:Create's ERC721 API can be used to deploy a new ERC721 contract, including the metadata URI from the previous step.
Once the metadata and media have been created and the token contract has been deployed, the NFT can be minted to a user’s wallet. Minting is the process of creating a new NFT on the blockchain. This can also be done using Co:Create’s ERC721 API.
This step is only relevant if implementing a dynamic NFT use case.
As the end user completes actions that would result in a change to the NFT, the media & metadata associated with the user’s token can be updated to reflect these changes. Updates to each can be made using Co:Create’s Media & Metadata APIs.
Updated 3 months ago