Getting Started
Create an NFT
Create an NFT using Metaplex Core on Solana.
What You'll Learn
This guide shows you how to create an NFT with:
- Custom name and metadata
- Image and description
- Optional attributes
Create an NFT
The following code is a fully runnable example. Below the parameters that you might want to customize are shown. You can learn more about NFT creation details in the Core documentation.
1import { createUmi } from '@metaplex-foundation/umi-bundle-defaults'
2import { create } from '@metaplex-foundation/mpl-core'
3import { mplCore } from '@metaplex-foundation/mpl-core'
4
5// Initialize UMI
6const umi = createUmi('https://api.devnet.solana.com')
7 .use(mplCore())
8
9// Create a new NFT asset
10const asset = await create(umi, {
11 name: 'My NFT',
12 uri: 'https://example.com/metadata.json'
13}).sendAndConfirm(umi)
14
15console.log('Asset created:', asset.publicKey)
1
On-Chain Parameters
Customize these parameters for your NFT:
| Parameter | Description |
|---|---|
name | NFT name (max 32 characters) |
uri | Link to off-chain metadata JSON |
Metadata and Images
Below you can find the minimum metadata that you need to upload. Additional fields like external_url, attributes, and properties are optional and can be found with further description and examples in the JSON schema. You need to upload the JSON and the image so that they are accessible from everywhere. We recommend to use a web3 storage provider like Arweave. If you want to do so by code you can follow this guide.
{
"name": "My NFT",
"description": "An NFT on Solana",
"image": "https://arweave.net/tx-hash",
"attributes": []
}
Plugins
MPL Core Assets support the use of plugins at both the Collection and Asset levels. To create a Core Asset with a plugin you pass in the plugin type and its parameters into the plugins array arg during creation. You can find more information about plugins in the Plugins Overview page. In the context of NFTs like Profile Pictures the Royalties plugin is a common use case.
