Skip to main content

ERC721 Assets Overview

ERC721 Assets

ERC721 Assets are commonly known as Non-Fungible Tokens, or NFTs. NFTs identify something in a unique way. This type of asset can have a different value than another token from the same collection based on age, rarity, or visual appeal.

ERC721 Mint transactions

Adding an ERC721 asset to a collection is commonly known as "minting" that asset.

You can mint assets by running a mint transaction. You can perform this transactions through the Myria SDK. After the assets are minted, you can use them in your project or game, or show them together with other items in a collection.

Currently, Myria supports mint transactions for ERC721 tokens (also known as NFTs). An ERC721 token is used to identify something in a unique way. You can read more about ERC721 tokens here. Upcoming versions of Myria's developer platform will include support for fungible ERC20 tokens.

Creating ERC721 mint transactions

Prerequisites

  • Generate a Web3 public key and Stark Key, and register your developer account entity as described in the quickstart
  • Create a project as described here
  • Create a collection as described here

ERC721 minting flow

  1. Run a script to submit a new mint transaction
  2. Myria will attempt to mint an asset based on the data provided
    • If the mint succeeds, the asset status is set to MINTED, and Myria creates a transaction with Prepare status. When a transaction is confirmed on the Myria chain, its status is set to Success
    • If the mint fails, Myria returns an asset object with MINT_FAILED status. No asset is minted and transaction details are not included

Asset Token Id

Each asset has a tokenId that represents a unique identifier of that asset within the collection. If you provided the correct metadataApiUrl format as an argument when you were creating a collection, then you will be able to access your minted asset via the following URL structure:

URI/TOKEN_ID
  • URI - metadataApiUrl from a given collection
  • TOKEN_ID - unique token identifier of the mintable asset within that collection, should be an incremental value
Warning

Make sure there is no trailing / at the end of the URI or you won't be able to mint assets.

See an example here:

https://gateway.pinata.cloud/ipfs/QmSjWbBS3rPu5K2TnhyXmwGE1GcVZMRFKg5K3iMLGca1m8/2

Selling ERC721 Assets on Myria Marketplace

You can list your ERC721 assets for sale in the Myria NFT marketplace, either through the Marketplace user interface or via the Myria SDK.

Collections

Collections enable you to manage digital assets. Every asset minted on Myria belongs to a collection, and every collection belongs to a project. One collection can have multiple assets, and one project can have multiple collections.

After you've registered a developer account, and created your project, you can add collections to that project. After you've created your collection, you can add assets to it.

Creating collections

Prerequisites

  • Generate a Web3 public key and Stark Key, and register your developer account entity as described in the quickstart
  • Create a project as described here

Collection creation flow

The basic collection creation flow is:

  1. Deploy a smart contract on the Ethereum network
  2. Create the Metadata API URL
  3. Attempt to create a collection
    • If the developer acount is registered on Myria, a collection is created
    • If the developer acount isn't registered on Myria, the request fails

Components of a collection

Creating a collection on the Myria L2 protocol requires the following information:

1. Collection name and description

A collection is defined by its name, which is a required property. You can also add optional properties such as description, collection's image URL, and icon URL.

2. Contract address

Before you create your collection, you have to deploy a smart contract on Ethereum. After deploying the contract, you will receive an address, which you will use when creating your collection. You can deploy the contract using this guide.

If the provided contract address doesn't match, you will receive an error when minting assets.

Note, the asset minting process on Myria doesn't require Ethereum L1 contract interaction, but the minted ERC721 assets will match the corresponding schema for ERC721 tokens on the Ethereum network.

3. Metadata API URL

Collections have a distinct metadata schema to define the properties of the digital assets it contains. All assets within a collection follow this schema. These properties can include character traits, edition numbers, categories, etc.

The schema needs to be provided as the metadataApiUrl and return a JSON object with key/value pair.

Creating the Metadata API URL

You can create a metadataApiUrl using one of three options:

NameSolutionProsCons
Custom server or cloud providerCentralizedGives full control of your metadata schemaDevelopers can change the returned metadata schema, which is misaligned with the immutable nature of Web3
Pinata, IPFSSemi-decentralizedDistributes metadata schema file across multiple IPFS nodesChanges to metadata schema will cause the change of metadataApiUrl which is not supported - For pinata, the metadata hosting sometime might not stable with free license and you might get the timeout if your folder store the big number of json file and leads to failed mint. We recommend that you can contact Pinata Support team or using IPFS direcly if meet those issues
ArweaveFully-decentralizedStores your data permanently with one-time payment onlyChanges to metadata schema will cause the change of metadataAPiUrl which is not supported
info

You need to implement only one of the options above.

Authentication details

Collections have to be a part of a project. In order to create a collection, have the projectID, public address and corresponding Stark Key ready.

Metadata

Metadata Schema

Our team recommends using an Opensea Metadata Structure for your metadata schema. Otherwise, your assets will appear incorrectly on most L1 and L2 NFT marketplaces, including Myria marketplace, Opensea, and others.

A typical structure is:

{
"description": "Friendly Creature that enjoys long swims in the ocean.",
"external_url": "https://openseacreatures.io/3",
"image": "https://storage.googleapis.com/opensea-prod.appspot.com/puffs/3.png",
"name": "Dave Starbelly",
"attributes": [
{
"trait_type": "Base",
"value": "Starfish"
},
{
"trait_type": "Eyes",
"value": "Big"
},
],
}

On-chain vs Offchain metadata

On-chain

On-chain metadata is the immutable data stored on a blockchain that uniquely represents a particular asset. The smart contract associated with the asset collection stores metadata for each ERC721 asset in a blueprint field. This metadata is created during the minting process on Ethereum L1.

Storing data on a blockchain is expensive. That's why your blueprint should only have the information about the asset you will need to access from the Ethereum L1 often, such as the Metadata API Url.

Off-chain

Off-chain metadata is the additional metadata properties used to improve the UI experience on nft marketplaces.

This data helps to filter and customize the way you present your assets. It is also stored off-chain.

Limitations

The following are known limitations for all mint transactions:

  • A mintable asset has to belong to a collection and cannot be removed after it's created.
  • You cannot perform a mint transaction if the collection's contract doesn't implement the mintFor() function.
  • The mintable assets should follow the ERC721 standard.
  • Each tokenId should be unique. If a non-unique tokenId is submitted you won't be able to mint your asset.

The following are known limitations for all collections:

  • In the Staging environment you can create five collections and 50,000 mint transactions per collection per month. If you want to create collections for your project on the Production environment, or you need to increase those limits, please contact our team. Be sure to include your project id in the request message.
  • The metadataApiUrl is immutable and can't be modified after the collection is created. You need to provide the correct link that won't change in the future.
  • After a collection is created, it cannot be deleted due to the immutability of the blockchain.