Introduction
Getting Started
Choose your preferred language or library below to get started or learn more about how Candy Machine works.
JavaScript
Get started with our JavaScript library based on the Umi framework.
Rust
Get started with our Rust crate.
Candy Machine 101
Candy Machine have 4 different phases:
- Creating and Configuring a Candy Machine
- Loading all the Assets
- Minting the Assets
- Deleting and Withdraw the Candy Machine
Create and Configure
Start by creating a new Core Candy Machine and configuring it with custom settings. This includes defining a collection that will be assigned to all NFTs created by the Candy Machine and all the customization that natively comes by adding Candy Guards to the Candy Machine.
Note: Candy Guards are modular code that adds custom behavior to the Candy Machine.
To learn more about how to create a Candy Machine, follow this link: Create a Candy Machine
Load Items
A newly created Candy Machine can't mint NFTs until it’s loaded with the assets to be minted.
Each item to load includes:
name
: The name of the Asset.uri
: The URI pointing to the JSON schema of the Asset that has already been uploaded via either an onchain (e.g. Arweave, IPFS) or off-chain (e.g. AWS, your own server) storage provider.
Note: If you're not familiar with how to upload metadata, you can follow this paragraph or use Sugar!
To learn more about how to load a Candy Machine, follow this link: Load a Candy Machine
Mint Asset
Once all items are loaded into the Candy Machine and pre-configured conditions are met, users can begin minting assets.
Note: To let the user easily access a way to mint from the candy machine, we've created this guide: Create a Website for minting Assets from your Core Candy Machine
To learn more about how to Mint from a Candy Machine, follow this link: Mint from a Candy Machine
Delete and Withdraw
After the Candy Machine has fulfilled its purpose, it can be safely deleted to reclaim the rent paid for storing its data on-chain.
To learn more about how to delete a Candy Machine, follow this link: Delete a Candy Machine
Candy Guards
Creators can use Candy Guards
to secure and customize the minting process of their Core Candy Machine by leveraging an additional program with 23 built-in guards!
For a list of all the available guards and how to use them, follow this link: Candy Guard Overview
Note: Metaplex Candy Machine is designed to be a large-scale NFT collections distributor and doesn't natively support setting a price for the NFTs. To add pricing, configure the Sol Payment or SPL token payment guard!
Custom Guards
Additionally, for the more advanced developers, Candy Guards include a "route instruction," allowing fully customizable mint request routing through custom guard logic.
To learn more about how to create your Custom Guard, follow this link: Special Guard Instructions
Candy Groups
Candy Machine also supports Guard Groups
, enabling multiple guard configuration with unique requirements that can operate simultaneously. This allows for different minting phases or behaviors within the same Candy Machine based on varying conditions.
To learn more about how to create Groups, follow this link: Guard Groups
Guard Example
To create a bot-protected Candy Machine that charges SOL, launches at a specific time, and limits mints per wallet, configure the following guards:
- Sol Payment: Requires the minting wallet to pay a configured amount of SOL to a destination wallet.
- Start Date: Allows minting only after a configured time.
- Mint Limit: Restricts each wallet from minting more than a set amount.
- Bot Tax: Penalizes failed mint attempts to deter bots by charging a small configured SOL fee to the minting wallet if any active guard blocks a mint.
On-chain, this configuration would look like this: