After what felt like walking through a mine field trying to figure out how to create my own NFT on Solana with the current guides, I decided to put together a guide myself in a very beginner friendly fashion.
I won’t be taking a deeper dive into the specifics of how everything works, but rather help people with zero knowledge of rust obtain a general understanding on how to create their very own NFT on Solana with the help of Metaplex candy machine and a web starter kit.
Note: I used Ubuntu 21.10 – Wayland for it. Some things may vary depending on the operating system you are running.
What is a Metaplex Candy Machine?
Metaplex is a command line tool that interacts with the candy-machine program. In this guide, we will use it to:
Upload your images along with their metadata to arweave, then register them on the Solana blockchain.
Verify that the state of your candy machine is valid and complete.
Mint individual tokens.
Candy Machine is a system that manages fair mints.
• The minting process starts and finishes at the same time for everyone.
• It won’t accept your funds if there are no more NFTs to sell.
NodeJS (version 14.17.6)
- Metaplex CLI
- Phantom Wallet
If you have a different version of Node installed on your system, you can use nvm which allows you to quickly install and use different versions of node via the command line.
Installing The SolanaCLI
Solana already has really well made guides on installing and using the Solana command line.
• Install Solana Command Line Tools
Devnet is really useful for developers to test out their programs and applications.
You can set your default Solana url to devnet using:
$ solana config set --url https://api.devnet.solana.com
Now, let’s create a devnet wallet:
$ solana-keygen new --outfile ~/.config/solana/devnet.json
Remember to store your seed phrase somewhere safe.
I highly recommend making devnet your default keypair
$ solana config set --keypair ~/.config/solana/devnet.json
Funding The Devnet Wallet
Firstly, let’s make sure that we’re on devnet by checking the configuration.
$ solana config get
Config File: /Users/dev/.config/solana/cli/config.yml
RPC URL: https://api.devnet.solana.com
WebSocket URL: wss://api.devnet.solana.com/ (computed)
Keypair Path: /Users/dev/.config/solana/devnet.json
Now, let’s fund that wallet:
Firstly, We check the balance of our current wallet.
$ solana balance
Then we airdrop the amount of SOL to our wallet. Remember, the amount is capped to 5 SOL.
$ solana airdrop 4
Requesting airdrop of 4
Signature: Transaction Signature
Now, Let’s check our balance to confirm the airdrop was successful.
$ solana balance
4 SOL //This can vary depending on the balance you initially had.
In case you’re confused by any of the above steps, you can check the manuals to get a better understanding by running:
$ solana help config
$ solana help balance
$ solana help airdrop
Configuring Phantom Wallet
After setting up your phantom wallet, we can link our newly created devnet wallet above to phantom.
To do so, first we need to open its settings, click on
Change Network and select
Now, we need to obtain the devnet wallet private key. To obtain that, open your terminal and
cat to view the contents of the
$ cat .config/solana/devnet.json
Now copy the output you received and open phantom wallet. Click on the top left navigation menu and click on
Add/Connect Wallet and then click on
Import Private Key and give it a suitable name and paste the contents we copied before in the Private Key field.
You should be able to see 4 SOL in your wallet.
Running Candy Machine CLI
Please ensure that you have
yarn installed before proceeding.
ts-node by running:
$ npm install -g ts-node
Now, let’s clone the metaplex project into the location of your choice.
$ git clone https://github.com/metaplex-foundation/metaplex.git
$ cd metaplex/js
$ yarn install && yarn bootstrap && yarn build
To run the command line utility,
$ ts-node metaplex/js/packages/cli/src/candy-machine-cli.ts help
Usage: candy-machine-cli [options] [command]
-V, --version output the version number
-h, --help display help for command
upload [options] <directory>
help [command] display help for command
Organizing & Uploading Your Assets
For this guide, we will be using pre-made assets which you can download by clicking here. courtesy of solana-candy-factory
assets folder in a suitable location.
Here is how you should organize your NFT files to upload:
ls assets | sort -n
You can notice that these files come in numerical pairs, that is
1.json are the two halves of the NFT. The
png file is the art work and the
json file contains the metadata.
The directory name
assets does not matter. You can go with anything you like.
Validating Your Assets
This may feel tedious but it’s just as important. Checkout the the manual on carrying this out at
Uploading Your Project Assets
Now that we have the funds, assets all organized and vaidated, we can proceed with the fun stuff!
We will proceed with uploading our assets with the CLI. Remember, our assets are located at
$ ts-node metaplex/js/packages/cli/src/candy-machine-cli.ts upload assets --env devnet --keypair ~/.config/solana/devnet.json
Processing file: 0
Processing file: 1
Processing file: 2
Processing file: 3
By uploading, it sends the files to Arweave and also registers those files with your candy machine. Both Arweave and Solana are initialized after a successful run.
Validating Your Candy Machine
You can confirm the health and status of your on-chain assets using:
$ ts-node metaplex/js/packages/cli/src/candy-machine-cli.ts verify --env devnet --keypair ~/.config/solana/devnet.json
Looking at key 0
Name redacted-name 0 with https://arweave.net/redacted-tx-id checked out
Looking at key 1
Name redacted-name 1 with https://arweave.net/redacted-tx-id checked out
Looking at key 2
Name redacted-name 2 with https://arweave.net/redacted-tx-id checked out
Looking at key 3
Name redacted-name 3 with https://arweave.net/redacted-tx-id checked out
Starting Your Candy Machine
After verifying that our assets are good to go, we can finally start the candy machine.
$ ts-node metaplex/js/packages/cli/src/candy-machine-cli.ts create_candy_machine --env devnet --keypair ~/.config/solana/devnet.json
Updating Your Candy Machine
We can modify our candy machine details to include a start date and/or price etc.
$ ts-node metaplex/js/packages/cli/src/candy-machine-cli.ts update_candy_machine --env devnet --keypair ~/.config/solana/devnet.json --price 1 --date "29 Oct 2021 00:12:00 GMT"
Minting Our NFT
To mint our NFT, we can use
mint_one_token like so:
$ ts-node metaplex/js/packages/cli/src/candy-machine-cli.ts mint_one_token --env devnet --keypair ~/.config/solana/devnet.json
If all goes well, you can now open your phantom wallet, open the collectibles page (It’s beside the $ symbol on the bottom) and voila! Your newly minted NFT will be there!
Setting Up The Web Starter Kit
Now that we’ve successfully minted an NFT into our wallet, let’s make a web application to carry out the mint instead!
Note: This project is very new and could cause some issues, if it does then please report it on github.
The goal of the project is for you to be able to configure it and customize it to your liking.
Fork the project and then clone it to your desired location.
Now we need to build the project,
This is where things get a little bit complicated. When we uploaded our NFTs, a cache file was created in the same directory as our assets directory. However, this
.cache folder is hidden! If you’re on ubuntu, use
ctrl+h to display hidden files.
Once you have discovered that folder, open it and you’ll find
devnet-temp file. Open it in your IDE and you’ll see the following
We’re going to need all this data when we run our web application to mint.
Open up the candy-machine-mint folder, where you will find a file called
(The file is usually hidden, use
ctrl+h to display hidden files)
Rename it to
.env and then open it to edit the following details:
This is the
program.config key from our
This is the
candyMachineAddress from our
This the Solana address that receives the funds gathered during the minting process. You can set this to your devnet wallet address.
This is the
startDate key from our
Note: If you cannot find it, use
update_candy_machine as mentioned above as you may have missed out on mentioning the date.
This identifies the Solana network you want to connect to. Options are devnet, testnet, and mainnet.
This identifies the RPC server your web app will access the Solana network through.
Starting The Web Application
Open your terminal and navigate to the
candy-machine-mint directory and start the react app by using
Once you see Compiled Successfully in your terminal, Open http://localhost:3000 to view it in the browser.
You can now proceed with connecting your wallet, and clicking on the mint button.
After clicking on the mint button, you can check the collectibles page on your phantom wallet and you’ll see your newly minted NFT!
That’s all I will be covering in this guide. If you encounter any issues, comment down below and I’ll try to help!
- Follow Anatoly and Raj Gokal for good vibes.