Introduction

MPL Core Asset

Overview

Setting itself apart from existing Asset programs, like Solana’s Token program, Metaplex Core does not rely on multiple accounts, like Associated Token Accounts. Instead, Core stores the relationship between a wallet and the "mint" account in the asset itself.

The Core Asset Account

The Core Asset account represents the bare minimum data for a digital asset. This structure provides an unopinionated blockchain primitive for on-chain ownership.

Is my Asset in a Collection?

MPL Core Assets can belong to collections. The updateAuthority field in the MPL Core Asset data provides two duties, either to report the update authority of the Asset, or to provide the publicKey of the MPL Core Collection to which it belongs.

When accessing the updateAuthority field either directly via the asset, or via the collectionAddress helper of the MPL Core Asset, the returning result will be one of the following outcomes:

Collection

The asset belongs to the collection at the given address.

Create Asset

{
  __kind: 'Collection'
  fields: [PublicKey]
}
import { fetchAssetV1 } from '@metaplex-foundation/mpl-core'

const asset = await fetchAssetV1(umi, assetAddress.publicKey)
const collectionId = collectionAddress(asset)

console.log({collectionId})
console.log({asset})

// log
collection: '2222222222222222222222222222222'
asset: {
    key: AssetV1,
    owner: "11111111111111111111111111111111",
    updateAuthority: {
      type: 'Collection',
      address: '2222222222222222222222222222222'
    },
    name: "My Core Asset",
    uri: "https://example.com/metadata.json",
    ...
}

Address

The asset has an update authority set and does not belong to a collection.

Create Asset

import { fetchAssetV1 } from '@metaplex-foundation/mpl-core'

const asset = await fetchAssetV1(umi, assetAddress.publicKey)
const collectionId = collectionAddress(asset)

console.log({collectionId})
console.log({asset})

// log
collectionId: undefined
asset: {
    key: AssetV1,
    owner: "11111111111111111111111111111111",
    updateAuthority: {
      type: 'Address',
      address: '2222222222222222222222222222222'
    }
    name: "My Core Asset",
    uri: "https://example.com/metadata.json",
    ...
}

None

The asset has no update authority set.

Create Asset

import { fetchAssetV1 } from '@metaplex-foundation/mpl-core'

const asset = await fetchAssetV1(umi, assetAddress.publicKey)
const collectionId = collectionAddress(asset)

console.log({collectionId})
console.log({asset})

// log
collectionId: undefined
asset: {
    key: AssetV1,
    owner: "11111111111111111111111111111111",
    updateAuthority: {
      type: 'None',
    },
    name: "My Core Asset",
    uri: "https://example.com/metadata.json",
}

Off Chain Metadata

One important attribute of the Asset Account is the URI attribute that points to a JSON file off-chain. This is used to safely provide additional data whilst not being constrained by the fees involved in storing on-chain data. That JSON file follows a certain standard that anyone can use to find useful information on tokens.

Off Chain Metadata can be stored at any publicly accessible location. Popular places to host your json files include;

  • Arweave
  • NFT.Storage/IPFS
  • Amazon AWS S3/Google Cloud
FieldTypeDescription
namestringName of the asset.
symbolstringSymbol of the asset.
descriptionstringDescription of the asset.
imagestringURI pointing to the asset's logo.
animation_urlstringURI pointing to the asset's animation.
external_urlstringURI pointing to an external URL defining the asset — e.g. the game's main site.
attributesarrayArray of attributes defining the characteristics of the asset.
  • trait_type (string): The type of attribute.
  • value (string): The value for that attribute.
propertiesobjectAdditional properties that define the asset.
  • files (array): Additional files to include with the asset.
    • uri (string): The file's URI.
    • type (string): The file's type. E.g. image/png, video/mp4, etc.
    • cdn (boolean, optional): Whether the file is served from a CDN.
  • category (string): A media category for the asset. E.g. video, image, etc.

Note that, this JSON file can be stored using a permanent storage solution such as Arweave to ensure it cannot be updated. Additionally, one can set the Update Authority field to None to make it immutable and, therefore, forbid the URI and Name attributes to ever be changed. Using this combination, we can guarantee the immutability of the off-chain JSON file.

Previous
Getting Started