The Candy-Machine-Mint project is designed to let users fork, customize, and deploy their own candy machine mint app to a custom domain, ultra fast.
This Candy Machine takes heavily from Exiled Apes and kevinfaveri, and would not be possible without them, but attempts to simplify and provide an easy-to-follow and complete guide.
This guide will not cover topics such as XXX.
I recommend using Linux to make this process as easy as possible.
-
Ensure you have recent versions of both
node
andyarn
installed. -
Follow the instructions here to install the Solana Command Line Toolkit.
-
Follow the instructions here to install the Metaplex Command Line Utility.
- Installing the Command Line Package is currently an advanced task that will be simplified eventually.
- Clone the project
git clone https://github.com/maxwellfortney/next-candy-machine
- Install yarn dependencies
cd next-candy-machine
yarn install
- rename the
.env.template
file at the root directory to.env.local
.
- Set URL to devnet
solana config set --url https://api.devnet.solana.com
- Generate a new keypair
solana-keygen new --outfile ~/.config/solana/devnet.json
- Set the keypair in your Solana config
solana config set --keypair ~/.config/solana/devnet.json
This will output our 1st required environment variable into the terminal as pubkey
, and will be our treasury SOL address. Set NEXT_PUBLIC_TREASURY_ADDRESS
in our .env.local
to this address.
- Airdrop SOL to wallet (repeat command if desired)
solana airdrop 1
This guide will not cover creating images and metadata. For more info see Token Metadata Standard as well as Prepare NFT Assets.
The following commands assume your images and metadata are located at the home directory under nft-assets ~/nft-assets/
.
- Upload assets
ts-node ~/metaplex-foundation/metaplex/js/packages/cli/src/candy-machine-cli.ts upload ~/nft-assets --env devnet --keypair ~/.config/solana/devnet.json
This will output our 2nd required environment variable into the terminal as initialized config for a candy machine with publickey
, and will be a SOL address. Set NEXT_PUBLIC_CANDY_MACHINE_CONFIG
in our .env.local
to this address.
If initialized config for a candy machine with publickey
if not output into the terminal, delete the file located at ./cache/devnet-temp.json
and re-run the command in step 1 above.
- (Optional, but recommended) Verify your assets. If all is well, this command will finish with output
ready to deploy!
ts-node ~/metaplex-foundation/metaplex/js/packages/cli/src/candy-machine-cli.ts verify -k ~/.config/solana/devnet.json
- Run the following command to create a candy machine
ts-node ~/metaplex-foundation/metaplex/js/packages/cli/src/candy-machine-cli.ts create_candy_machine -k ~/.config/solana/devnet.json
This will output our 3rd required environment variable into the terminal as candy machine pubkey
, and will be a SOL address. Set NEXT_PUBLIC_CANDY_MACHINE_ID
in our .env.local
to this address.
We need to set a price in SOL, as well as a mint start date for our candy machine.
- This command will set the price to 1 SOL, and the mint start date to the current time in epoch time.
ts-node ~/metaplex-foundation/metaplex/js/packages/cli/src/candy-machine-cli.ts update_candy_machine -k ~/.config/solana/devnet.json -p 1 -d now
This will output our 4th required environment variable into the terminal as updated startDate timestamp
, and will be a epoch time. Set NEXT_PUBLIC_CANDY_START_DATE
in our .env.local
to this time.
You can now start the NextJs app by running yarn dev
and navigating to http://localhost:3000/
, connect your desired wallet and begin minting your devnet new NFTs.
- Change
NEXT_PUBLIC_SOLANA_NETWORK
tomainnet-beta
- Change
NEXT_PUBLIC_SOLANA_RPC_HOST
tohttps://api.mainnet-beta.solana.com
your preffered RPC URL such as QuickNode
- Connect your Github account to Vercel
- Create a new project from your repo
- Before clicking
Deploy
, add all of your environment variables - Click
Deploy