SoLibrary
  • Solana
  • The Meme Coin Problem and Solution
  • Developing on Solana
  • From Rust To Deployment
  • Solana Blockchain Explorer
  • Building a Solana dAPP
  • Deploying a Solana dApp
  • Deploying a Solana Memecoin using CLI
  • Solana Smart Contracts
  • Send Solana via javascript functions
  • Candy Machine
  • Pump fun APIs
  • Metaplex
  • Metaplex Program Library
  • Solana Program Library
  • UMI Framework
  • Umi and Web3js Differences
  • Fetching Accounts
  • UMI Helpers
  • HTTP Requests
  • Umi's Interfaces
  • Interface implementations
  • Kinobi
  • UMI Plugins
  • Registering Programs
  • Public keys and Signers
  • Connecting RPCS
  • Serializer
  • Storage
  • Transactions
  • Web 3.JS Adapters
  • Metaplex Umi Plugins
  • Core JS SDK v1.0
  • Local Validator
  • SolScriptions
  • FAQ
  • Initialize
  • Write Inscription Data
  • Fetch
  • Clear
  • Close
  • Authority
  • Sharding
  • Getting Started using JavaScript
  • Getting started using the Inscriptions CLI
  • Core Candy Machine
  • Getting Started using JavaScript
  • Candy Guard
  • Assets
  • Creating a Core Candy Machine
  • Inserting Items
  • Updating The Core Candy Machine
  • Guard Groups
  • Special Guard Instructions
  • Fetching a Core Candy Machine
  • Minting
  • Withdrawing a Core Candy Machine
  • Address Gate Guard
  • Allocation
  • Allowlist Guard
  • Asset Burn Guard
  • Asset Burn Multi
  • Asset Payment Guard
  • Asset Payment Multi
  • Asset Mint Limit
  • Bot Tax Guard
  • End Date Guard
  • Edition
  • Freeze Sol Payment guard
  • Freeze Token Payment Guard
  • Gatekeeper Guard
  • Mint Limit Guard
  • NFT Burn Guard
  • NFT Gate Guard
  • NFT Mint Limit Guard
  • NFT Payment Guard
  • Program Gate Guard
  • Redeemed Amount Guard
  • Sol Fixed Fee Guard
  • Sol Payment Guard
  • Start Date Guard
  • Third Party Signer Guard
  • Token Burn Guard
  • Token Gate Guard
  • Token Payment Guard
  • Token2022 Payment Guard
  • Generating Custom Guard Client for Core Candy Machine
Powered by GitBook
On this page
  • Let's get started.
  • Create Candy Machine
  • The next step is to update the date of the candy machine.
  • Create a Mint NFT Website

Candy Machine

A solana candy machine mint guide

Let's get started.

The first step is to clone Metaplex.

git clone 

Then cd into the src section.

cd metaplex/js/packages/cli/src/

And use the yarn install command. After we've installed it, we'll create a directory called assets first. Then put the images that you want to mint in there, naming them 0, 1, 2 in the order you want. For example, James will make 4 examples, so James will put 4 images in the assets directory, naming them 0.jpg, 1.jpg, 2.jpg, 3.jpg. And you have to create a .json file for each image.

{ 
  "name": "<name of desired image>", 
  "symbol": "", 
  "image": "<any image, e.g. 0.jpg>", 
  "properties": { 
    "files": [ 
      { 
        "uri": "<any image, e.g. 0.jpg>", 
        "type": "<type of image, e.g. image/png | image/jpeg>" 
      } 
    ], 
    "creators": [ 
      { 
        "address": "<YOUR WALLET'S PUBLIC KEY ADDRESS>", 
        "share": 100 
      } 
    ] 
  } 
}

Then we will use the command to upload the image that we prepared with candy machine cli to upload.

ts-node candy-machine-cli.ts upload -e devnet -k <keypair address> -s arweave <file address to upload>Which James's will be like this.ts-node candy-machine-cli.ts upload -e devnet -k /Users/kajame/Workspace/blockchain/solana/key.json -s arweave assets

But now it seems like there is an error as shown in the image below.

We'll make a temporary change first, which is to go to the src/upload.ts file and go to line 366. We'll make the following changes:

const manifest = getAssetManifest(
  dirname,
  `${assetKey.index}.json`,
);We will remove the .json, which will look like this.const manifest = getAssetManifest(
  dirname,
  `${assetKey.index}`,
);

Now try running this command again in the terminal.

ts-node candy-machine-cli.ts upload -e devnet -k /Users/kajame/Workspace/blockchain/solana/key.json -s arweave assets

You will find that there are no more problems.

If we observe, we will find that there is a directory named .cache and a file called devnet-temp.json and the uploaded image data.

Additional update: The above problem should no longer exist because it seems like they have merged and fixed the problem. Therefore, we may not need to edit the src/upload.ts file anymore.

Create Candy Machine

What we will do next is to create a Candy Machine, but James will use the Token that James created before as the coin for inserting (i.e. using the MID coin that we wrote about in previous articles to insert, by inserting 303 MID per 1 image) with the command:

ts-node candy-machine-cli.ts create_candy_machine -e devnet -k <Keypair.json address> -t <Token you want to use for payment> -a <Token account created when creating Token> -p <Token number including decimal specified in token>Which James will set it like this.ts-node candy-machine-cli.ts create_candy_machine -e devnet -k /Users/kajame/Workspace/blockchain/solana/key.json -t 3bm2qFdAJ4GXWFqrcoRX5xZ2mX4kgZRPgm5MMXMjXhPm -a 27gY9ewKm1NT856vGsaQGc191NZB7Nta6ntQfFhnRHX8 -p 303

If there are no errors, a message similar to the one below will be displayed.

Now James will get the candy machine pubkey as this value: 8cKsNhfcMWN2HxyPWPEh2PCdppsEDxq7T4iCzvdXg7GN

The next step is to update the date of the candy machine.

By using the command

ts-node candy-machine-cli.ts update_candy_machine -e devnet -k /Users/kajame/Workspace/blockchain/solana/key.json --date "now"

When the update is complete, the message as shown in the picture will be displayed.

From the image, the startDate timestamp value is: 1639328726.79

Create a Mint NFT Website

git clone 

After the project has been cloned, please add the .env file to the root project. Copy the values ​​from .env.example first.

REACT_APP_CANDY_MACHINE_CONFIG=__PLACEHOLDER__
REACT_APP_CANDY_MACHINE_ID=__PLACEHOLDER__
REACT_APP_TREASURY_ADDRESS=__PLACEHOLDER__
REACT_APP_CANDY_START_DATE=__PLACEHOLDER__REACT_APP_SOLANA_NETWORK=devnet
REACT_APP_SOLANA_RPC_HOST=

REACT_APP_CANDY_MACHINE_CONFIG Enter the candy machine config value, which can be found in the .cache/devnet-temp.json file. Enter the value in the config section.

REACT_APP_CANDY_MACHINE_ID Enter the value obtained when creating the candy machine, which is the candy machine pubkey.

REACT_APP_TREASURY_ADDRESS If we set spl-token when creating the candy machine, in this section we must enter the account address value that was created when creating the spl-token. However, if we did not set spl-token when creating the candy machine, we must enter the Wallet address that will go to this wallet when someone presses mint.

REACT_APP_CANDY_START_DATE Enter the start date timestamp value that we got when we used the command to update the date of the candy machine.

James will put the .env value as follows:

REACT_APP_CANDY_MACHINE_CONFIG=6RaVc8SVsgAnhSBGsUH1TP6pDrsaGrAyu5C5HeibBhxV
REACT_APP_CANDY_MACHINE_ID=8cKsNhfcMWN2HxyPWPEh2PCdppsEDxq7T4iCzvdXg7GN
REACT_APP_TREASURY_ADDRESS=27gY9ewKm1NT856vGsaQGc191NZB7Nta6ntQfFhnRHX8
REACT_APP_CANDY_START_DATE=1639328726.79REACT_APP_SOLANA_NETWORK=devnet
REACT_APP_SOLANA_RPC_HOST=

Then use the command

yarn install

And start with the command

yarn start

Then connect our Wallet properly. When connected, you will see that in the Balance section, it will show the spl-token coin that we specified when creating the Candy machine that we will use this coin for minting.

When we try to press Mint, we will see that it will show transaction approval details, which will be shown as the number 303 MID (which we specified when creating the Candy machine) as shown in the picture.

James is not sure if we can set it to only lose the specified spl-token. If we try it, we will update this article.

When you press approve, you will see that the number of coins available will decrease by the specified amount.

But now I'm not sure if the NFT that was minted doesn't show the image. I'm not sure if it's because something has changed. Because when I tried it, it seemed to show the image, but when I did it recently, it didn't show. But I think if I try it on the mainnet, I think there shouldn't be a problem.

After the mint is complete, the number of coins will increase by the specified amount.

PreviousSend Solana via javascript functionsNextPump fun APIs

Last updated 10 months ago

Now that everything is ready, here James will be working on devnet. Readers can use the solana config get command to double check that it is really on devnet by looking at the RPC URL:

Error when running command

Someone has also opened an issue:

There is no problem anymore.
Display information when using the Candy machine creation command
Update date of candy machine

In this section, if we do not specify spl-token to use mint (did not specify -t when creating candy machine), we can clone the project from But if we specify the spl-token to be minted, I found a way to adjust it to use spl-token. The original link is in the Reference at the end.

After starting, go to and you will see a web page as shown in the picture.

When yarn start is ordered and the website
Show MID Coin Balance
Show transaction approval details, you will see 303MID lost.
The amount decreased by 303 MID.
This is the NFT that we minted.
The number of tokens in the wallet that created this token (before trying to mint)
https://api.devnet.solana.com
https://github.com/metaplex-foundation/metaplex/issues/1190
candy-machine-mint.
it is better to clone the project from this.
http://localhost:3000/
http://localhost:3000/ is opened