A Front End Minting Experience
This guide assumes you have already uploaded and deployed your Candy Machine. If you haven't yet done this, check out Sugar CLI to get started!
While the Candy Machine is ready to mint after being deployed, in most cases you will want to provide a front end experience to allow your community the chance to mint, too.
You can use the Candy Machine UI, which is in the metaplex-foundation/candy-machine-ui repository.
To download, run
git clone https://github.com/metaplex-foundation/candy-machine-ui ~/candy-machine-ui/
Open the file
.env.example located at the root of the new folder
~/candy-machine-ui and modify the following:
Set the value of
REACT_APP_CANDY_MACHINE_IDto match the
IDof your Candy Machine. The
IDwas in the output of the
sugar deploycommand and can also be found by running
sugar showin the same directory that you made your Candy Machine in.
Specify the intended network you wish to use. In this example we are using the
REACT_APP_CANDY_MACHINE_ID=<YOUR CANDY MACHINE PROGRAM ID>
REACT_APP_CANDY_MACHINE_IDhas been updated. Rename
The public RPC endpoints (
https://api.devnet.solana.com) are not suitable
for Candy Machine mints and may cause significant issues to your minting site. We strongly recommend that you use a
custom RPC endpoint for your mint. You can find more information about the custom RPC solutions in the RPC section of
our community docs.
After these changes are made, run the command
yarn install && yarn start inside the
~/metaplex/js/packages/candy-machine-ui. This will start a local server with a front end experience. From here,
you should customize the mint page and deploy it in your host service.
We strongly recommend that you keep the standard implementation for the mint button functionality when using
gatekeeper) settings. This will guarantee that the captcha tokens are issued at the correct time (e.g., after
the mint begins). The
CMv2 is designed to reject captcha tokens that are created before the mint is live to avoid bots
pre-solving captchas - your transaction will fail if the token is created at the wrong time.
The UI supports all different configurations of your Candy Machine v2, including whitelist (presale + discount) and end
settings—e.g., it automatically adapts the UI components depending on whether the whitelist token is detected or
not, discount for whitelist users is set and displays a countdown to the end of mint when end settings
goLiveDate is reached:
When mint is live:
Whitelist token not detected, mint is not active before
Whitelist token detected and whitelist settings set to presale and discount price:
Whitelist only mint:
Whitelist + presale and
goLiveDate set to
End Settings Mint
Countdown to the end of the mint:
date reached, mint stopped: