Solana programs Part 4: Metaplex Candy Machine — how does it work?
Published in
7 min readMay 29, 2022
The Metaplex Candy Machine is among the most popular smart contracts used for NFT minting on Solana. Recently, it has even implemented sophisticated logics for detecting and taxing bots.
How does the candy machine program work internally? What are its intended use cases and dependencies? How does it detect bots? This article elaborates on these technical details.
What’s Metaplex candy machine?
The Candy Machine is a distribution program used by
- NFT creators to set up a collection of NFTs (e.g., 10,000 diverse Okay Bears) to be distributed
- Users to mint the NFTs created in Step 1 (note: bots can mint NFT too!)
For 1, the distributor must first call the InitializeCandyMachine
instruction to create a candy machine:
A candy machine has a few important pieces of information:
authority
: who is authorized to update the candy machine, withdraw funds, etcwallet
: the wallet for receiving payment from NFT minters