0%
Overview page background
HomeOverviewsSolana
What is Candy Machine v2? A Complete Guide

What is Candy Machine v2? A Complete Guide

Written by Shray Jain

Brady Werkheiser headshot

Reviewed by Brady Werkheiser

Published on 2022-07-217 min read

Candy Machine is a Solana-based program developed by Metaplex Studios, an NFT ecosystem for marketplaces, games, and arts & collectibles, to reliably sell non-fungible tokens (NFTs). The studio and its community have been moving fast to support several thousand NFT developers and the most popular Solana NFT collections and creators who are interested in launching their very own NFT projects on the Solana blockchain network.

Metaplex is a collection of tools, smart contracts, and other technologies that have been designed to make the process of minting and releasing NFTs simpler. Metaplex has three major projects; Token Metadata, Candy Machine, and Auction House.

For the purposes of this article, we will solely focus on Candy Machine, often described as working like the gumball-style candy machine where users insert one token to receive an NFT.

The program uses the Metaplex command line interface (CLI) to generate an NFT, connect relevant metadata and an image to the NFT token, and ultimately set-up a fair auction. This implies that end-users are unable to purchase NFTs ahead of the mint time and once the limit of NFT mints has been reached, no more are generated.

In addition to generative NFTs, creators can also generate 1-of-1 NFTs or even semi-fungible tokens for their respective communities. Moreover, Candy Machine’s name has been derived from a real-world mechanical candy machine. This is because there is a general expectation that once an individual puts a token into the machine, they will only receive one item. Of course, there are some exceptions such as when the Candy Machine will return your token if there are no more NFTs left to mint.  

What is the difference between Candy Machine v1 and v2?

The second version of Candy Machine provides many functionality improvements over its predecessor. In general, the latest version of the program enables new distribution possibilities and offers enhanced protection from bot attacks, all packaged in the same easy-to-use interface.

As a result of the upgrade, Candy Machine v1 has been deprecated and is no longer supported. This means that creating a new instance of Candy Machine v1 is no longer possible and end-users are encouraged to use Candy Machine v2 instead.

In Candy Machine v2, Metaplex has introduced improvements associated with how end-users configure Candy Machine and new settings that enable mint pausing at a certain point. In addition, any configuration value can be updated. Nevertheless, here are a few features that developers and creators can be excited about:

1. Unpredictable Mint Index

In the previous version of Candy Machine, it was feasible to estimate the specific NFT that would be minted during a generative NFT launch because the mint would happen in a sequential order.

This non-randomized order created the opportunity to be able to choose which NFT to mint, given that all of the information about the items was available on-chain. This provided an unfair advantage to NFT collectors with developer backgrounds.

The second-iteration eliminates this possibility by using an unpredictable mint index, which is not possible to predict. This functionality ensures that there’s a level playing field when it comes to minting NFTs using Candy Machine v2. 

2. Captcha Settings

By incorporating Captchas, mints have now been limited to humans which means far fewer bots. While there are Solana NFT communities that give access to NFT minting bots through their own NFT collection and token-gated Discord, Candy Machine's Captcha settings make it more difficult to auto-mint NFTs using bots.

3. Whitelist

Users now have the ability to create numerous configurations for NFT whitelists where users can mint before the official start date, obtain NFTs at discounted prices, or even have exclusive access to mints. Because any SPL token can be used to create whitelists, it is up to the project creator's discretion how they are distributed. 

4. Large Collection Support and Hide-and-Reveal Drops

Using version 2 of Candy Machine it is now possible to create large collections and hide-and-reveal drops by specifying a single hash. Though the hash is the same across all the mints, the name of each item is specified with a unique number, allowing an off-chain process to later update the metadata with the actual item. 

What can you build with Candy Machine v2?

Using Candy Machine v2, developers and creators can set up their own Solana NFT shops, add a mint page to their website, and safely launch a successful NFT project.

According to Metaplex, over 11.5 million NFTs have been minted using the organization’s protocols which have provided standards & tools for more than 100,000 projects and online communities. 

How does Candy Machine v2 work?

Once you have downloaded the prerequisite Solana developer tools and configured your machine, you should be able to create a new Candy Machine that is ready to mint tokens after initial deployment.

Creators who are interested in providing a convenient end-to-end consumer experience should consider providing a frontend minting experience to allow the community the chance to mint as well.

Metaplex’s native user interface supports a variety of configurations of Candy Machine v2 such as whitelisting (for both pre-sale and discounts) and end-settings (i.e., automatically adapting the UI components depending on whether the whitelist token is detected or not.

What common problems does Candy Machine solve?

The motivation behind Candy Machine was to address problems with the way NFT drops were being managed and processed on the Solana blockchain. Some important problems that have been addressed in the latest update include the following: 

  • Acceptance of buyer funds even when the underlying project was out of NFTs to sell 

  • Not having a precise and global start time 

  • Projects were not producing consistent, valid NFTs 

  • Structuring NFT metadata correctly 

  • Protection from persistent NFT bot attacks 

  • Creating an on-chain collection of NFTs for authentication purposes

In general, there was a clear need to create an easier way to solve the most fundamental problems that buyers, sellers, and marketplaces experienced in the NFT landscape. Metaplex’s Candy Machine addresses these shortcomings in a dynamic way. 

Why is it best to build an NFT drop with Candy Machine?

There are a few reasons why developers should consider using Candy Machine. Even though globally recognized NFT creators use automated minting tools similar to Candy Machine, the Metaplex-developed tool is highly recommended because it is now a fully on-chain distribution program for NFTs.

Today, Metaplex’s tool has become common across the industry as a result of its inherent utility, noteworthy documentation, and logic to combat threats such as bot attacks. In conjunction with Strata's Dynamic NFT Pricing Mint tool, creators can reliably launch NFT campaigns on Solana with a simple toolkit.

What is a Candy Machine ID?

Each NFT project using Candy Machine to mint NFTs, is always designated with a unique identifier (ID), which developers can use to verify the authenticity of the underlying asset on the Solana blockchain. If the NFT was supposedly generated on Candy Machine but lacks a Candy Machine ID (CMID), users should be cautious of minting, buying, or trading for the NFT. 

Because each project has a specific CMID, NFT bots will analyze the Solana blockchain to find listed CMIDs and try to mint the NFT before the launch starts. Because NFT sniping tools exist, come NFT projects create honeypots, or fake CMIDs that accept SOL tokens, but don't return an NFT, to deter bots.

How to Deploy Candy Machine v2

There are a few important steps to follow to ensure Candy Machine v2 is up-and-running. To start, you will need the following Solana development tools downloaded on your local machine.

If running the program on Mac OS with the Apple M1 chip, additional dependencies will be required.  

  1. Git - an open-source and distributed version control system 

  2. Node - an open-source JavaScript (JS) runtime environment that executes JS code outside a web browser 

  3. Yarn - software packaging system developed by Meta Platforms for the Node.js Javascript runtime environment

  4. TypeScript Node - a TypeScript-based execution environment

  5. Solana CLI - a command-line interface to interact with the Solana blockchain 

  6. Metaplex - a command-line interface to interact with Metaplex 

1. Install Metaplex Candy Machine v2

Developers can clone the Metaplex repository by pulling the CLI from GitHub. Subsequently, by downloading the relevant dependences, end-users should be able to compile and run the software. Nonetheless, users should check whether everything has been installed properly and ensure that they have defined environment variables.

2. Set up a Solana Wallet

Connect a relevant Solana wallet and add funds to create and deploy a Candy Machine. Users can either rely upon an existing keypair with funds or create a new keypair specifically for this project. Then, add funds.

3. Configure Candy Machine

Maintain your choice of settings across areas such as whitelisting, Captcha protection, and gatekeeper settings. The Candy Machine reads a JSON file that can be adjusted to your preferences. 

4. Prepare Your NFTs

As the Candy Machine is a distribution program for NFTs, it’s important for it to be loaded with your project’s artwork and metadata. Once you have completed the initial preparation, it is critical that you verify that the files are ready to be uploaded. In fact, the Candy Machine CLI provides the verify_assets command to check that uploaded assets are in the correct format. 

5. Deploy the Candy Machine

Once you verify that your keypair has funds and your assets have been uploaded appropriately, you are ready to deploy the candy machine. In addition, you can also confirm whether the upload is ready to be deployed using the Candy Machine CLI. 

6. Mint Tokens

Now that you have completed the majority of the initialization steps, your Candy Machine is ready to mint Solana NFTs. Depending on configurations, it is either restricted to whitelist users or the goLiveDate has not been reached yet. Nevertheless, the owner of the Candy Machine should be ready to mint tokens. 

7. Sign Mints

Once you have finished minting, you may want to consider you will want to sign your NFTs to verify yourself as the creator. Being verified means that the creator with that wallet address has signed the NFT, proving that they are the actual creator.

Typically, the verified creator will be the Candy Machine by default. This permits the broader marketplace, storefronts, and CLIs to search for NFTs that were minted by a Candy Machine seamlessly and with trust. For example, you could use a Solana-based NFT analytics tool that relies on data being parsed through by a Solana API. 

8. Set Up a Website

For the most convenient setup, creators are encouraged to use the frontend UI provided by Metaplex. More information on creating a frontend for your NFT mint, or how to use Candy Machine v2, refer to the official documentation Metaplex.

Congratulations! You’re all set and ready to mint your very first NFT using Candy Machine v2.

Overview cards background graphic
Section background image

Build blockchain magic with Alchemy

Alchemy combines the most powerful web3 developer products and tools with resources, community and legendary support.