Features

Creating Assets

As discussed in the Core overview, digital assets on Core are composed of exactly one on-chain account and off-chain data describing the token. On this page, we'll go over the process of minting these assets.

The Creation Process

  1. Upload off-chain data. First, we must ensure our off-chain data is ready. This means we must have a JSON file stored somewhere that describes our asset. It doesn't matter how or where that JSON file is stored, as long as it's accessible via a URI. The off chain metadata can look similar to the old token metadata standard.
  2. Create on-chain Asset account. Then, we must create the on-chain Asset account that will hold our asset's data.

Let's dig into these steps in more detail, whilst providing concrete code examples.

Uploading off-chain data

You may use any service to upload your off-chain data or simply store it on your own server but it is worth noting that some of our SDKs can help with that. They use a plugin system that allows you to select the uploader of your choice and offer a unified interface for you to upload your data.

Upload assets and JSON data

const [imageUri] = await umi.uploader.upload([imageFile])
const uri = await umi.uploader.uploadJson({
  name: 'My NFT',
  description: 'This is my NFT',
  image: imageUri,
  // ...
})

Now that we have our URI, we can move on to the next step.

Create an Asset

To create an asset the create instruction should be used. Below is a simple example, you can do more things with it, like adding your asset to a collection, or assigning plugins which is described later.

Create Asset

import { generateSigner } from '@metaplex-foundation/umi'
import { createV1 } from '@metaplex-foundation/mpl-core'

const asset = generateSigner(umi)

const result = createV1(umi, {
  asset: asset,
  name: 'My Nft',
  uri: 'https://example.com/my-nft',
}).sendAndConfirm(umi)

Create an Asset into a Collection

MPL Core Assets can be minted straight into a collection providing you already have your MPL Core Collection premade before hand. To create a Collection Asset visit here.

Create Asset with Plugin

import { generateSigner } from '@metaplex-foundation/umi'
import { createCollectionV1, createV1 } from '@metaplex-foundation/mpl-core'

const collection = generateSigner(umi)

await createCollectionV1(umi, {
  collection: collection,
  name: 'My NFT',
  uri: 'https://example.com/my-nft.json',
}).sendAndConfirm(umi)

const asset = generateSigner(umi)
const result = createV1(umi, {
  asset: asset,
  name: 'My Nft',
  uri: 'https://example.com/my-nft.json',
  collection: collection.publicKey,
}).sendAndConfirm(umi)

Create an Asset with Plugins

MPL Core Assets support the use of plugins at both a Collection and at an Asset level. To create a Core Asset with a plugin you pass in the plugin and it's parameters into the plugins array arg during creation. The below example creates a mint with the Freeze plugin.

Create Asset with Plugin

import { generateSigner } from '@metaplex-foundation/umi'
import {
  createV1,
  createPlugin,
  ruleSet,
} from '@metaplex-foundation/mpl-core'

const creator1 = publicKey('11111111111111111111111111111111')
const creator2 = publicKey('22222222222222222222222222222222')

const asset = generateSigner(umi)

await createV1(umi, {
  asset: assetSigner,
  name: 'My NFT',
  uri: 'https://example.com/my-nft.json',
  plugins: [
    {
      plugin: createPlugin({
        type: 'Royalties',
        data: {
          basisPoints: 500,
          creators: [
            {
              address: creator1,
              percentage: 20,
            },
            {
              address: creator2,
              percentage: 80,
            },
          ],
          ruleSet: ruleSet('None'), // Compatibility rule set
        },
      }),
    },
  ],
}).sendAndConfirm(umi)

The list of plugins includes but is not limited to:

Previous
FAQ