Getting Started
Before we can create a Candy Machine, you will need to install and operate a handful of developer tools.
During this guide, we will use \
within example commands prior to new lines. On most shells (such as the shells on macOS and Linux), this symbol means a new line. However, on Windows Command Prompt, it does not. If you are on Windows and are using the Command Prompt, enter the commands in a single line and remove the \
characters that we use in our examples.
Tooling required
You will need recent version of the following tools:
- git: to clone the repository
- node: JavaScript runtime
- yarn: package manager to install the required dependencies
- ts-node: TypeScript execution environment
git version
output: git version 2.35.1
The latest LTS version of node is recommended:
node --version
output: v16.14.2
yarn --version
output: 1.22.18
ts-node --version
output: v10.4.0
Apple M1 Chip
If you have macOS with the Apple M1 Chip, you'll need to install some additional dependencies.
After installing brew, run the following:
brew install pkg-config cairo pango libpng jpeg giflib librsvg
See additional information: https://github.com/Automattic/node-canvas/wiki/Installation%3A-Mac-OS-X
Clone and Install the JS CLI Repo
Creating and controlling a Candy Machine is done through our JavaScript command line tool, currently distributed in the deprecated-clis GitHub repository. For now, recommend pulling the latest code from the main branch:
git clone https://github.com/metaplex-foundation/deprecated-clis.git ~/deprecated-clis
This will create a directory deprecated-clis
in your home directory with the latest 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
You can check that everything is working by running the Candy Machine CLI command:
ts-node src/candy-machine-v2-cli.ts --version
output: 0.0.2
Make sure you are using the candy-machine-v2-cli.ts
script.
Solana Wallet
The Candy Machine operates on the Solana blockchain. You will need a wallet with funds to create and deploy a Candy Machine. You can create and use a wallet using the Solana Tool Suite. This guide will assume that you are using the Solana CLI commands:
solana --version
output: solana-cli 1.9.1
You can check your wallet address:
solana address
output: 6j4nNrozTJkk1zatiXHezSLZArnRUq3WkGKHACThXGpZ
and your balance:
solana balance
output: 4 SOL
We highly recommend trying to first deploy a 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
Output
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:
## REDACTED ##
=======================================================================
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 https://metaplex.devnet.rpcpool.com/
If all the above steps are successful, your configuration be similar to:
solana config get
Output
Config File: ~/.config/solana/cli/config.yml
RPC URL: https://metaplex.devnet.rpcpool.com/
WebSocket URL: wss://metaplex.devnet.rpcpool.com/ (computed)
Keypair Path: ~/.config/solana/devnet.json
Commitment: confirmed
Funding your devnet wallet
In order to add SOL to your devnet
wallet, you can request funds from a faucet:
solana airdrop 2
Output
Requesting airdrop of 2 SOL
Signature: 41ZEZqpyNMLUy3kQahWSy349PeDz3Q82dNDHKiA7QcsrAzHs3f7YiDEZWjnFi434DoiiDiDkazkBRycRnctx1m6e
6 SOL
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 https://solfaucet.com.
Do not send real SOL to a devnet
wallet.