Solana programs Part 4: Metaplex Candy Machine — how does it work?

sec3 (formerly Soteria)
Coinmonks

--

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.

Okay Bear #1756 NFT

What’s Metaplex candy machine?

The Candy Machine is a distribution program used by

  1. NFT creators to set up a collection of NFTs (e.g., 10,000 diverse Okay Bears) to be distributed
  2. 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, etc
  • wallet: the wallet for receiving payment from NFT minters

--

--