How to Create an NFT Marketplace in the Solana Network using Metaplex and Candy Machine V2.

My project 47

If you’re here, you’re still early. Web 3 blockchain technology is at its inception.

No matter what you have heard about the NFT Market, here you will learn about various concepts like Metaplex, Solana CLI Tools, and NFT’s; which are powerful, but still expanding Web 3 tools.

Let’s create Solana minting website using Solana Candy Machine V2. These brand-new technology tools are not user interface friendly yet. So, this process will require basic coding knowledge and the use of developer tools to create a successful upload of our NFT collection to the blockchain.

  • Solana CLI tools, CLI stands for Command Line Interface.
  • Metaplex is the single greatest piece of critical NFT technology ever built in Solana.
  • NFT are non-fungible tokens.

Metaplex is where all the NFT activity on Solana happens. It has become the new standard. You are no longer at the mercy of NFT marketplaces like Solanart or Solsea. or even OpenSea. With Metaplex you are creating your own marketplace on Web 3.

You can create your own NFT marketplace or minting website on the Solana blockchain using Metaplex and sell your NFTs to the whole world. Plus removing the middleman and their 3% fees is always awesome.

Metaplex’s off-chain component allows creators to launch a custom storefront, similar to Shopify or WordPress. This open-source project provides a graphical interface to the on-chain Metaplex program, for creators, buyers, and curators of NFTs. The design and layout of storefronts can be customized to suit the needs of the entity creating it, either as a permanent storefront or an auction hub for a specific auction or collection.

All identification on the Storefront is based on wallet addresses. Creators and store admins sign through their wallets, and users place bids from connected wallets. Custom storefronts allow creators to create unique experiences per auction. Additionally, the Metaplex Foundation is working on multiple partnerships that will enable building immersive storefronts using VR/AR.

Your buyers can then mint your NFTs and then sell it on the secondary marketplace on the same website.

The question some might have, why choose Solana to build your NFT marketplace?

Solana is the fastest Layer 1 blockchain with 60,000 transactions per second with a speed of 0.4 second transaction. Did we mention the ridiculously low transaction costs?

Welcome to this is a hands-on guided course where you will be creating an NFT marketplace or minting website on the Solana blockchain using Metaplex and Candy Machine V2.

Metaplex is a protocol built on top of Solana that allows:

  • Creating/Minting Non-Fungible Tokens;
  • Starting A variety of auctions for primary/secondary sales;
  • and Visualizing NFTs in a standard way across wallets and applications.

Metaplex is an open-source platform built by and for creators to launch their own self-hosted and custom storefronts for NFTs. Users Metaplex Storefront connects to a powerful on-chain decentralised program that mints and sells the NFTs, removing the middleman and their fees.

  • Pros – Connects creators to buyers without needing to pay a marketplace fee to anyone. Heaps of successful Solana NFT projects have been launched on this platform including Degen Ape Academy, Solana Monkey Business, Genopets, Nyan Heroes, and Oddkey.
  • Cons – Only supports $SOL as payment

Metaplex is comprised of two core components: an on-chain program, and a self-hosted front-end web3 application. In order to run Solana commands, Metaplex is needed.

We recommend you visit all links on this article and read over Solana and Metaplex Documentation.


  1. Introduction
  2. Prerequisites
  3. Fork and clone the Metaplex repository
  4. Change the default addresses
  5. Setup and deploy our store
  6. Mint an NFT on a marketplace

Create a Solana Mint Site with Candy Machine V2

You will need recent version of the following 6 developer tools:


Prerequisite installation sites:

Install the Solana Tool Suite | Solana Docs Let’s go through the documentation

Node.js ( – JavaScript runtime

ts-node – npm ( – TypeScript execution environment

Installation | Yarn ( – package manager to install the required dependencies

Git – Installing Git ( – to clone the repository

Visual Studio Code – Code Editing. Redefined

Install the Solana Tool Suite

There are multiple ways to install the Solana tools on your computer depending on your preferred workflow:


  • Open a Command Prompt (cmd.exe) as an Administrator
    • Search for Command Prompt in the Windows search bar. When the Command Prompt app appears, right-click and select “Open as Administrator”. If you are prompted by a pop-up window asking “Do you want to allow this app to make changes to your device?”, click Yes.
  • Copy and paste the following command, then press Enter to download the Solana installer into a temporary directory:

curl –output C:\solana-install-tmp\solana-install-init.exe –create-dirs

  • Copy and paste the following command, then press Enter to install the latest version of Solana. If you see a security pop-up by your system, please select to allow the program to run.

C:\solana-install-tmp\solana-install-init.exe v1.10.8

  • When the installer is finished, press Enter.
  • Close the command prompt window and re-open a new command prompt window as a normal user
    • Search for “Command Prompt” in the search bar, then left click on the Command Prompt app icon, no need to run as Administrator)
  • Confirm you have the desired version of solana installed by entering:

solana –version

  • After a successful install, solana-install update may be used to easily update the Solana software to a newer version at any time.

After you have installed all the software proceed to verify the installation of all the developer tools:

verify installation

Make sure they are all installed properly, if you get a version number then you have installed them correctly or else it will show error. Once all six developer tools are properly installed and verified, we can move to the next step which is creating a file system wallet that will interact with the Candy Machine V2.


Download Metaplex from the link below.

Metaplex Github link GitHub – metaplex-foundation/metaplex: Protocol and application framework for decentralized NFT minting, storefronts, and sales.

Open program using Visual Studio Code

Open a new terminal

enter command: cd js

This command will now direct you to js and you will be able to access folders: js> packages >package.json –once in that file change the URL, and that is the URL where we will deploy the project.

Run the following installation commands when you open Visual Code.

Lets install Yarn

npm run yarn


We will proceed to install Metaplex and we will also create Solana File System Wallet that will interact with the Candy Machine V2, links are below: This .json file or wallet will keep our private key safe while also giving us a public key we can use.

Important Warning, must read!!!

We will create File System Wallet which will create a .json file that will contain your private key.

Be sure to keep this file in a safe place. Anyone with access to this file will have acess to your wallet and be able to take all the Solana that is stored in that wallet!

Do not give this file system wallet to anyone!

Now that we have warned you about the dangers file sharing for Web 3, being careful about how we store these files, ensures that our crypto stays safe.

We highly recommend trying to first deploy the Candy Machine on Solana devnet, before moving to the mainnet-beta environment. This way you can freely test different settings without having to move SOL to your wallet.

In this guide we will use devnet, although all commands presented will work in a similar fashion once you are in mainnet-beta.

Setting up a devnet wallet (for testing)

The steps described here will create a wallet to be used in the Solana devnet environment. In normal circumstances you would redact your mnemonic, store it somewhere safe and take advantage of the --outfile flag.

To create a new wallet, we will use the solana-keygen command:

solana-keygen new --outfile ~/.config/solana/devnet.json


Generating a new keypair

For added security, enter a BIP39 passphrase

NOTE! This passphrase improves security of the recovery seed phrase NOT the
keypair file itself, which is stored as insecure plain text

BIP39 Passphrase (empty for none):

Wrote new keypair to /Users/febo/.config/solana/devnet.json
pubkey: 6j4nNrozTJkk1zatiXHezSLZArnRUq3WkGKHACThXGpZ
Save this seed phrase and your BIP39 passphrase to recover your new keypair:

The next step is to make this our default keypair:

solana config set --keypair ~/.config/solana/devnet.json

and make sure we are on the devnet:

solana config set --url
My project 45

Config File: ~/.config/solana/cli/config.yml
WebSocket URL: wss:// (computed)
Keypair Path: ~/.config/solana/devnet.json
Commitment: confirmed

File System Wallet

This is how to create and use a file system wallet with the Solana CLI tools. A file system wallet exists as an unencrypted keypair file on your computer system’s filesystem.

File system wallets are the least secure method of storing SOL tokens. Storing large amounts of tokens in a file system wallet is not recommended.

Before you Begin,

Make sure you have installed the Solana Command Line Tools.

Generate a File System Wallet Keypair

Use Solana’s command-line tool solana-keygen to generate keypair files. For example, run the following from a command-line shell:

mkdir ~/my-solana-wallet

solana-keygen new –outfile ~/my-solana-wallet/my-keypair.json

This file contains your unencrypted keypair. In fact, even if you specify a password, that password applies to the recovery seed phrase, not the file. Do not share this file with others. Anyone with access to this file will have access to all tokens sent to its public key. Instead, you should share only its public key.

To display its public key, run:

solana-keygen pubkey ~/my-solana-wallet/my-keypair.json

It will output a string of characters, such as:


This is the public key corresponding to the keypair in ~/my-solana-wallet/my-keypair.json.

The public key of the keypair file is your wallet address.

1st let’s separate a directory for our project, then change it into the new directory that we created.

Use command: cd sonala-nft and click enter

We are now inside that directory.

We will now create a wallet and keypair .json file,

create file wallet

./ indicates that I want to store in the current directory.

Next it will ask for a pass phrase to make it more secure.

seed phrase

It will also show public key for our Solana wallet.


It will show a seed phrase recovery, save this somewhere safe because we will use it later.

use command: ls -l

ls l

Now copy paste the Solana wallet.

copy and paste pubkey

Now we’ll go to the Git Candy Machine V2

Copy clone code and download, get clone and paste the https and it will download the code for the candy machine

git clone

Copy Solana address before leaving.

Using Visual Code

Before we install the dependencies for NFT directory, VS code we will need visualize NFT Solana.

Lets look for the Solana NFT directory.

Open a new file and paste the Solana address

copy address
paste address on visual code

Open a new terminal

install yarn dependencies

We can proceed to install the dependencies and for Metaplex to function we need install yarn, it will install all the dependencies.

run dependencies command

Now let’s configure the Solana network keypair json file

We will test this process through the Devnet network, this network doesn’t use real Solana.

For the Mainnet network you must use the right URL, https, check out the Solana documentation, this will be the network to launch the collection to the public.

devnet keypair.json

2nd command is to configure the keypair the path to the keypair json, the wallet that we created will appear.

–Now we must fund the wallet, Dev Solana air drop it will drop some fake Solana, since we are still in the Devnet Network (or testing network).

fake solana fund wallet

Funding your devnet wallet

In order to add SOL to your devnet wallet, you can request funds from a faucet:

solana airdrop 2


If the command is successful, you will see the updated balance at the end. Make sure you are entering the airdrop amount that is within the airdrop limit. Currently the maximum airdrop request limit is 2 SOL and there is a daily total limit of 24 SOL.


The solana airdrop command is sometimes unreliable. If the command doesn’t work, you can use the airdrop tool at


Do not send real SOL to a devnet wallet.

Verify your Address against your Keypair file

To verify you hold the private key for a given address, use solana-keygen verify:

solana-keygen verify <PUBKEY> ~/my-solana-wallet/my-keypair.json

where <PUBKEY> is replaced with your wallet address. The command will output “Success” if the given address matches the the one in your keypair file, and “Failed” otherwise.

Creating Multiple File System Wallet Addresses

You can create as many wallets addresses as you like. Simply re-run the steps in Generate a File System Wallet and make sure to use a new filename or path with the --outfile argument. Multiple wallet addresses can be useful if you want to transfer tokens between your own accounts for different purposes.

Configure CANDY MACHINE settings.

Go to config file – all the configuration for the candy machine

The table below provides an overview of the settings available:

SettingOptionsAccepted ValuesDescription
priceNumberThe amount in SOL or SPL token for a mint
numberIntegerThe number of items in the Candy Machine
gatekeeper (captcha prevent bots from getting your nft
gatekeeperNetworkAddressGateway provider address
expireOnUsebooleanRequires a new gateway challenge after a use
solTreasuryAccountPublicKeySOL wallet to receive proceedings SOL payments
splTokenAccountPublicKeySPL token wallet to receive proceedings from SPL token payments
splTokenPublicKeyMint address of the token accepted as payment
goLiveDateDatetimeTimestamp when minting is allowed – the Candy Machine authority and whitelists can bypass this constraint
valueDatetime or IntegerValue to test the end condition. This will be either a date string (if date is set to true) or a integer amount value (if amount is set to true)
datebooleanEnable the use of a date to stop the mint – when the date specified in the value option is reached, the mint stops
amountbooleanEnable stopping the mint after a specific amount is minted – the amount is specified in the value option
“burnEveryTime” : trueWhitelist token is burned after the mint
“neverBurn” : trueWhitelist token is returned to holder
mintPublicKeyMint address of the whitelist token
presalebooleanIndicates whether whitelist token holders can mint before goLiveDate (presale)
discountPriceNumberPrice for whitelist token holders
nameStringName of the mint. The number of the mint will be appended to the name
uriStringSingle URI to all mints
hashString32 character hash – in most cases this is the hash of the cache file with the mapping between mint number and metadata so that the order can be verified when the mint is complete
storageStorage type to upload images and metadata
“arweave-sol”Uploads to arweave using Bundlr and payments are made in SOL (Recommended option. Works on mainnet and devnet. Files are only stored for 7 days on devnet.)
“arweave-bundle”Uploads to arweave and payments are made in AR (only works in mainnet and requires an Arweave wallet)
“arweave”Uploads to arweave via Metaplex Google Cloud function (works on devnet and mainnet)
“ipfs”Uploads to IPFS (must specify either Infura Project ID or Secret Key)
“nft-storage”Uploads to NFT.Storage (no payment required, works on all networks)
“aws”Uploads to AWS (must specify AWS Bucket name)
ipfsInfuraProjectIdStringInfura Project ID
ipfsInfuraSecretStringInfura Project Secret
nftStorageKeyStringNFT.Storage API Key (optional)
arweaveJwkStringArweave JWK wallet file
awsS3BucketStringAWS bucket name
noRetainAuthoritybooleanIndicates whether the candy machine authority has the update authority for each mint or if it is transferred to the minter. This should be kept as false for the vast majority of cases. Leave this as false if you are unsure which to pick.
noMutablebooleanIndicates whether the NFTs’ metadata is mutable or not after having been minted

Minimal information that your NFT should have. Any settings you don’t want use type “null”

“price”: 1.0,
“number”: 10,
“gatekeeper”: null,
“solTreasuryAccount”: “”,
“splTokenAccount”: null,
“splToken”: null,
“goLiveDate”: “25 Dec 2021 00:00:00 GMT”,
“endSettings”: null,
“whitelistMintSettings”: null,
“hiddenSettings”: null,
“storage”: “arweave-sol”,
“ipfsInfuraProjectId”: null,
“ipfsInfuraSecret”: null,
“nftStorageKey”: null,
“awsS3Bucket”: null,
“noRetainAuthority”: false,
“noMutable”: false

  • price – in Solana
  • gatekeeper – captcha prevent bots from getting your NFT
  • sol treasury account
  • time of launch
  • date will stop minting or after a certain
  • whitelisting settings
  • SPL token this will serve as verification discount
  • burn (or delete )
  • pre-sale or discount – early access to mint and/or discount
  • storage where you store the NFT metadata IPFS, PINATA, etc.
  • the number of NFT’s minted

Preparing your Assets

The Candy Machine is a distribution program and in order to use it to mint NFTs, it needs to be loaded up with your project’s artwork and metadata.

Your assets consist of a collection of images (e.g., .png) and metadata (.json) files organized in a 1:1 mapping – i.e., each image has a corresponding metadata file.

There are a multitude of unique ways to generate images and metadata, and in most scenarios, you will automate this process. In this guide we will cover the creation of a simple collection to illustrate the metadata requirements and Candy Machine distribution. You should familiarize yourself with the Token Metadata Standard.

Example NFT Collection

A 10-item collection will have 20 files in total:


Each pair 0.png and 0.json are combined to represent the first NFT in this example collection; 1.png and 1.json describe the second NFT and so forth. These files are typically grouped into a single folder, usually named assets, but that is not a hard requirement. Grouping them into a single folder simplifies next steps and is highly encouraged.

The content of the image files reflect the artwork you would like to display for each NFT and the content of the metadata files describe each of these pieces of artwork using the schema defined in the Token Metadata Standard.

The first item in your collection must have the index 0, the second 1 and so forth. In a 10000 NFT drop, will start with the pair 0.png and 0.json, and end with the pair 9999.png and 9999.json. The numbering must also be consecutive – i.e., should not have gaps in the numbering.


It is important to double check that you do not skip any indices, e.g., 0.png2.png3.png (missing 1.png). Otherwise you will experience problems when minting your collection.

Sample Items of the Collection

Below are two simple examples of items in this collection:

• Image: 0.png

image 1

• Metadata: 0.json

"name": "Number #0001",
"symbol": "NB",
"description": "Collection of 10 numbers on the blockchain. This is the number 1/10.",
"seller_fee_basis_points": 500,
"image": "0.png",
"attributes": [
{ "trait_type": "Layer-1", "value": "0" },
{ "trait_type": "Layer-2", "value": "0" },
{ "trait_type": "Layer-3", "value": "0" },
{ "trait_type": "Layer-4", "value": "1" }
"properties": {
"creators": [
{ "address": "N4f6zftYsuu4yT7icsjLwh4i6pB1zvvKbseHj2NmSQw", "share": 100 }
"files": [{ "uri": "0.png", "type": "image/png" }]
"collection": { "name": "numbers", "family": "numbers" }


• Image: 9.png


• Metadata: 9.json

"name": "Number #0010",
"symbol": "NB",
"description": "Collection of 10 numbers on the blockchain. This is the number 10/10.",
"seller_fee_basis_points": 500,
"image": "9.png",
"attributes": [
{ "trait_type": "Layer-1", "value": "0" },
{ "trait_type": "Layer-2", "value": "0" },
{ "trait_type": "Layer-3", "value": "1" },
{ "trait_type": "Layer-4", "value": "0" }
"properties": {
"creators": [
{ "address": "N4f6zftYsuu4yT7icsjLwh4i6pB1zvvKbseHj2NmSQw", "share": 100 }
"files": [{ "uri": "9.png", "type": "image/png" }]
"collection": { "name": "numbers", "family": "numbers" }


Notice that the difference in the metadata between each image is on:

  • "name" property: "Number #0001" in the first image and "Number #0010" in the last image
  • "description" property: it shows "number 1/10" in the first image and "number 10/10" in the last image
  • "image" property: "0.png" in the first image and "9.png" in the last image
  • "properties.files.uri" property: "0.png" in the first image and "9.png" in the last image
  • "attributes" property: the values for "Layer-3" and "Layer-4" trait-types are different, since they describe attributes of the images

It is also important to make sure that you set royalties percentage awarded to creators ("seller_fee_basis_points" property) is set and each creators’ wallet is listed in the "properties.creators" property.


You can download the complete sample collection for testing and experimentation. Subsequent steps in this walkthrough will assume it’s the collection in use.

Verifying Assets

Once you completed your project’s artwork and metadata preparation, it is important to verify that the files are ready to be uploaded. The Candy Machine CLI provides the verify_assets command to check that the files in the assets folder are in the correct format. This involves verifying that:

  1. Files types are supported (e.g., png, jpg, mp4). Note that the command does not verify the content of the files; it does a lightweight verification that the extension of the files are from a supported type.
  2. For each image/audio/video file, there is a correspondent json metadata file using the correct index naming in the image and animation_url properties.
  3. Creators have been consistently added to all metadata files. The command expects that all assets have the same creators.

To proceed with the verification process, you will execute the verify_assets command:

ts-node ~/metaplex/js/packages/cli/src/candy-machine-v2-cli.ts verify_assets ./assets

The only required parameter is the directory of the assets—in this example, ./assets is the name of the directory. Executing the command using the sample collection will produce the following output:

started at: 1646926416415
Verifying token metadata for 10 (img+json) pairs
Checking manifest file: ~/metaplex/js/packages/cli/test/assets/0.json
Checking manifest file: ~/metaplex/js/packages/cli/test/assets/1.json
Checking manifest file: ~/metaplex/js/packages/cli/test/assets/2.json
Checking manifest file: ~/metaplex/js/packages/cli/test/assets/3.json
Checking manifest file: ~/metaplex/js/packages/cli/test/assets/4.json
Checking manifest file: ~/metaplex/js/packages/cli/test/assets/5.json
Checking manifest file: ~/metaplex/js/packages/cli/test/assets/6.json
Checking manifest file: ~/metaplex/js/packages/cli/test/assets/7.json
Checking manifest file: ~/metaplex/js/packages/cli/test/assets/8.json
Checking manifest file: ~/metaplex/js/packages/cli/test/assets/9.json
ended at: Thu Mar 10 2022 15:33:36 GMT+0000 (Greenwich Mean Time). time taken: 00:00:00

The above represents an example of a successful verification. When the command finds any inconsistency, it will report an error under the filename (0.json in this case) where the error occurred, as shown below:

started at: 1646926416415
Verifying token metadata for 10 (img+json) pairs
Checking manifest file: ~/metaplex/js/packages/cli/test/assets/0.json
We expected the `image` property in ~/metaplex/js/packages/cli/test/assets/0.json to be 0.jpg.
This will still work properly (assuming the URL is valid!), however, this image will not get uploaded to Arweave through the `metaplex upload` command.
If you want us to take care of getting this into Arweave, make sure to set `image`: "0.jpg"
The `metaplex upload` command will automatically substitute this URL with the Arweave URL location.

Checking manifest file: ~/metaplex/js/packages/cli/test/assets/1.json
Checking manifest file: ~/metaplex/js/packages/cli/test/assets/2.json
Checking manifest file: ~/metaplex/js/packages/cli/test/assets/3.json
Checking manifest file: ~/metaplex/js/packages/cli/test/assets/4.json
Checking manifest file: ~/metaplex/js/packages/cli/test/assets/5.json
Checking manifest file: ~/metaplex/js/packages/cli/test/assets/6.json
Checking manifest file: ~/metaplex/js/packages/cli/test/assets/7.json
Checking manifest file: ~/metaplex/js/packages/cli/test/assets/8.json
Checking manifest file: ~/metaplex/js/packages/cli/test/assets/9.json
ended at: Thu Mar 10 2022 15:33:36 GMT+0000 (Greenwich Mean Time). time taken: 00:00:00

As soon as your assets are verified, you are ready to create your Candy Machine.

Creating the Candy Machine

Candy machine v2 comes improved random minting capabilities for your NFT Collection. Once you have your collection prepared, the next step is to upload your assets and create a Candy Machine. This step is completed by a single command via the Candy Machine CLI.

Before you can proceed, you need to check that:

  • Your images and metadata are located in the same directory – in most cases this will be a directory named assets
  • You have funds in your wallet – the command solana balance will tell your current balance
  • You have created your Candy Machine configuration file (e.g., config.json)

To create a Candy Machine, space is allocated on chain to temporarily store the names and URI links (mirroring what is in your .json file in the .cache directory). To store this data on chain, you are required to pay on chain rent costs. After your mint (or whenever you want to end it), you can run the withdraw command to reclaim all of the rent costs. Check the withdraw section for more details. For a 10k collection, the rent costs are approximately 16.7 SOL. This scales linearly with the number of items in your collection. Thus, you can get an approximate on chain rent cost estimate by multiplying the number of items in your collection by 0.00167 SOL.


In the Solana network, files start at 0, not 1 like in the Ethereum network (Opensea). We must now upload the assets which are your actual NFT images and .json metadata.

copy and paste this command,

To proceed, you will execute the upload command:

ts-node ~/metaplex/js/packages/cli/src/candy-machine-v2-cli.ts upload \
-e devnet \
-k ~/.config/solana/devnet.json \
-cp config.json \
-c example \
upload command solana network

In this command we are specifying that we will run the upload in the devnet environment (-e option), we will use the wallet keypair ~/.config/solana/devnet.json (-k option), the Candy Machine configuration file config.json (-cp option), the cache file suffix example (-c option) and upload our assets from the folder ./assets.

In the end it will shows sucess or error.

successful true
Bottom message should say successful = true
  • WARNING: The “arweave” storage option will be going away soon. Please migrate to arweave-bundle or arweave-sol for mainnet.
  • Beginning the upload for 10 (img+json) pairs
    started at: 1640191406699
    Size 10 { mediaExt: ‘.png’, index: ‘0’ }
    Processing asset: 0
    initializing candy machine
    initialized config for a candy machine with publickey: ABceMmLMwmSfL5mL1cCrpPMKGupMXUezEY3JyZ1JSd6h
    Processing asset: 0
    Processing asset: 1
    Processing asset: 2
    Processing asset: 3
    Processing asset: 4
    Processing asset: 5
    Processing asset: 6
    Processing asset: 7
    Processing asset: 8
    Processing asset: 9
    Writing indices 0-9
    Done. Successful = true.
    ended at: 2021-12-22T16:44:38.446Z. time taken: 00:01:11

Any execution that does not complete an upload successfully will have an output Successful = false. In this case, re-run the upload command until a successful execution is achieved.

The command also outputs the Candy Machine PublicKey, which you can verify on the Solana Explorer:

Next Verify the upload of the assets to the network

The Candy Machine provides a command to verify if the metadata URI on chain has been successfully uploaded.

Now is time verify the upload and we will run the following command:

ts-node ~/metaplex/js/packages/cli/src/candy-machine-v2-cli.ts verify_upload \
-e devnet \
-k ~/.config/solana/devnet.json \
-c example

verify upload of assets Solana

Once it verifies all the assets it will say it is ready to deploy!

The command will check that each entry in the cache file matches the URI stored on-chain. A successful execution will generated an output similar to:

Key size 10
Name Number #0001 with checked out
Name Number #0002 with checked out
Name Number #0003 with checked out
Name Number #0004 with checked out
Name Number #0005 with checked out
Name Number #0006 with checked out
Name Number #0007 with checked out
Name Number #0008 with checked out
Name Number #0009 with checked out
Name Number #0010 with checked out
uploaded (10) out of (10)
ready to deploy!

verify upload of assests


Mint Tokens

At this point, your Candy Machine is ready to mint tokens. Depending on your configurations, it is either restricted to whitelist users or the goLiveDate has not been reached yet. In all cases, the owner (authority) of the Candy Machine – i.e., the wallet that created the Candy Machine – can mint tokens.

The only exception is when captcha is enabled. In this case, it is not possible to mint tokens from the command line. If you would like to mint tokens, update the goLiveDate to null and temporarily disable the captcha settings.

Mint One Token

Minting one token can be done using the command mint_one_token:

ts-node ~/metaplex/js/packages/cli/src/candy-machine-v2-cli.ts mint_one_token \
-e devnet \
-k ~/.config/solana/devnet.json \
-c example

If successful, the output will be similar to:

wallet public key: N4f6zftYsuu4yT7icsjLwh4i6pB1zvvKbseHj2NmSQw
mint_one_token finished 3R9XADK91RWESj3FZdzB2QXHchpjwcS5khdwZVoSd3petHyqt2T6MjntMxozX2meRFyaFZEsqjPxbCUjxz5eL5z9

You can check that the mint was successful by using the spl-token command to check the accounts available on your wallet:

spl-token accounts

If the mint was successful, you will see a new account in your wallet:

Token                                         Balance
G1zDZMHjU6bs4ibrZdeaM85dHYtno1B1xUmZ1VR7XCsQ 1

Mint Multiple Tokens

You can also mint multiple tokens using the command mint_multiple_tokens and specifying the number of tokens to be minted:

ts-node ~/metaplex/js/packages/cli/src/candy-machine-v2-cli.ts mint_multiple_tokens \
-e devnet \
-k ~/.config/solana/devnet.json \
-c example \
--number 2


If successful, the output will be similar to following output:

Minting 2 tokens...
wallet public key: N4f6zftYsuu4yT7icsjLwh4i6pB1zvvKbseHj2NmSQw
transaction 1 complete 37e4NjN5yPWevAus1m3XyCNgRPAxanQ5YdePn732U73XPa2MsHccJamoqkUFi6AtPwU8j3CATT84qq9G7ciAfRSU
minting another token...
wallet public key: N4f6zftYsuu4yT7icsjLwh4i6pB1zvvKbseHj2NmSQw
transaction 2 complete 5emunaycm99shUXuH3Xs6vCbTe6c8X6UqGoQYJ8qkwUd2mVppvojXyz2bxuYPmLVriuoqobBRNwFkp5Q2zCRV6pu
minted 2 tokens
mint_multiple_tokens finished

You can follow the steps above to verify that the tokens are in your wallet.

A Front End Minting Experience

While the Candy Machine is ready to mint, in most cases you will want to provide a front end experience to allow your community the chance to mint, too.

You can use the Candy Machine v2 UI, which is already in the Metaplex repository and downloaded when you executed the git clone command.

Setting up

Open the file .env.example located in the folder ~/metaplex/js/packages/candy-machine-ui and modify the following:

  • Set the value of REACT_APP_CANDY_MACHINE_ID to match the ID of your Candy Machine. The ID was in the output of the upload command and can also be found inside your Candy Machine cache file – this is located in the same directory that you executed the upload command (e.g., .cache/devnet-example)
  • Specify the intended network you wish to use. In this example we are using the devnet:REACT_APP_CANDY_MACHINE_ID=<YOUR CANDY MACHINE PROGRAM ID>

  • Once your REACT_APP_CANDY_MACHINE_ID has been updated. Rename .env.example to .env

The public RPC endpoints ( and are not suitable for Candy Machine mints and may cause significant issues to your minting site. We strongly recommend that you use a custom RPC endpoint for your mint. You can find more information about the custom RPC solutions in the RPC section of our community docs.

After these changes are made, run the command yarn install && yarn start inside the folder ~/metaplex/js/packages/candy-machine-ui. This will start a local server with a front end experience. From here, you should customize the mint page and deploy it in your host service.


We strongly recommend that you keep the standard implementation for the mint button functionality when using captcha (gatekeeper) settings. This will guarantee that the captcha tokens are issued at the correct time (e.g., after the mint begins). The CMv2 is designed to reject captcha tokens that are created before the mint is live to avoid bots pre-solving captchas – your transaction will fail if the token is created at the wrong time.

User Interface

The UI supports all different configurations of your Candy Machine v2, including whitelist (presale + discount) and end settings—e.g., it automatically adapts the UI components depending on whether the whitelist token is detected or not, discount for whitelist users is set and displays a countdown to the end of mint when end settings "date"=true is used.

Default Mint

Before goLiveDate is reached:

Mint Countdown

When mint is live:

Mint Live

Whitelist Mint

Whitelist token not detected, mint is not active before goLiveDate:

Whitelist + No Token

Whitelist token detected and whitelist settings set to presale and discount price:

Whitelist Presale + Discount

Whitelist only mint:

Whitelist Only

Whitelist + presale and goLiveDate set to null:

Whitelist + No Token

End Settings Mint

Countdown to the end of the mint:

End Settings

End settings date reached, mint stopped:

End Settings Complete

Now let’s run the Mint command

mint one nft

Set up candy machine with the front end

Let’s find the Metaplex directory by going to,

js >package >candymachine UI

metaplex directory

Open and remove example from file

Right click it rename as .env

Remove and upload address of the candy machine that was generated when we uploaded the file.

specify network Solana

public key we need copy and paste

Specify the network since we are on Devnet:

Mainnet/ beta

RPC for the Mainnet

Command + s, save close file.

We have to change in candy machine UI directory in the terminal.

cd metaplex >js >packages > candy-machine-ui

clear terminal

intall depencies yarn command

use command to install dependencies and start the server.

linking dependencies yarn command

This when website page will automatically be launched/

compiled succesfully

connect to phantom wallet and minting live. You have completed a successful addition of your digital assets to the Solana blockchain without the need of 3rd Party Marketplace like Opensea or SOlsea.

nft creation copy 1


— Metaplex install yarn install ~/solana-nft/metaplex/js (only on mac and linux)

~/ Does not work on Windows, you need to specify your full path yarn install C:/Users/username/solana-nft/metaplex/js (windows command will be similar to this)

— Solana CLI configuration —

solana config set –url

solana config set –keypair keypair.json

— Upload commands —

Mac or Linux ( “\” indicates the command continues on the next line, only use on Mac or Linux) npx ts-node ~/solana-nft/metaplex/js/packages/cli/src/candy-machine-v2-cli.ts upload \ -e devnet \ -k keypair.json \ -cp config.json \ ./assets

Windows ~/ Does not work on Windows, you need to specify your full path (NOTE put command in one line to avoid errors) npx

ts-node C:/Users/username/solana-nft/metaplex/js/packages/cli/src/candy-machine-v2-cli.ts upload -e devnet -k keypair.json -cp config.json ./assets

— Verify upload command —

Mac or Linux npx ts-node ~/solana-nft/metaplex/js/packages/cli/src/candy-machine-v2-cli.ts verify_upload \ -e devnet \ -k keypair.json

Windows ~/ Does not work on Windows, you need to specify your full path (NOTE put command in one line to avoid errors) npx ts-node C:/Users/username/solana-nft/metaplex/js/packages/cli/src/candy-machine-v2-cli.ts verify_upload -e devnet -k keypair.json

– Mint one token command —

Mac or Linux npx ts-node ~/solana-nft/metaplex/js/packages/cli/src/candy-machine-v2-cli.ts mint_one_token \ -e devnet \ -k keypair.json

Windows npx ts-node C:/Users/username/solana-nft/metaplex/js/packages/cli/src/candy-machine-v2-cli.ts mint_one_token -e devnet -k keypair.json

IMPORTANT – Windows Users (put commands in one line to avoid errors)

— upload command

npx ts-node C:/Users/my-username/solana-nft/metaplex/js/packages/cli/src/candy-machine-v2-cli.ts upload -e devnet -k keypair.json -cp config.json ./assets

— upload verify command

npx ts-node C:/Users/my-username/solana-nft/metaplex/js/packages/cli/src/candy-machine-v2-cli.ts verify_upload -e devnet -k keypair.json

— mint one nft through cli npx ts-node C:/Users/my-username/solana-nft/metaplex/js/packages/cli/src/candy-machine-v2-cli.ts mint_one_token -e devnet -k keypair.json

Clone and Install Metaplex

Creating and controlling a Candy Machine is done through the Metaplex command line tool, currently distributed in the Metaplex GitHub repository. For now, recommend pulling the latest code from the master branch:

git clone ~/metaplex

This will create a directory metaplex in your home directory with the lastest code from the repository. If you decide to clone the repository to a different location, you will need to change the path in subsequent instructions.

You will then need to install the dependencies. From outside the metaplex directory:

yarn install --cwd ~/metaplex/js/

You can check that everything is working by running the Candy Machine CLI command:

ts-node ~/metaplex/js/packages/cli/src/candy-machine-v2-cli.ts --version

1. Intro to terms
2. Configuration
3. Preparing your Assets
4. Creating the Candy Machine
5. Verify Upload
6. Mint Tokens

Recommended Articles

1 Comment

  1. techno

    Launch an NFT marketplace that supports art, music, real-estate or GameFi with our NFT Marketplace Development Services. Build robust blockchain solutions with an industry-leading NFT Marketplace Development Company. Build enterprise blockchain solutions.

Leave a Reply

Your email address will not be published.