SoLibrary
  • Solana
  • The Meme Coin Problem and Solution
  • Developing on Solana
  • From Rust To Deployment
  • Solana Blockchain Explorer
  • Building a Solana dAPP
  • Deploying a Solana dApp
  • Deploying a Solana Memecoin using CLI
  • Solana Smart Contracts
  • Send Solana via javascript functions
  • Candy Machine
  • Pump fun APIs
  • Metaplex
  • Metaplex Program Library
  • Solana Program Library
  • UMI Framework
  • Umi and Web3js Differences
  • Fetching Accounts
  • UMI Helpers
  • HTTP Requests
  • Umi's Interfaces
  • Interface implementations
  • Kinobi
  • UMI Plugins
  • Registering Programs
  • Public keys and Signers
  • Connecting RPCS
  • Serializer
  • Storage
  • Transactions
  • Web 3.JS Adapters
  • Metaplex Umi Plugins
  • Core JS SDK v1.0
  • Local Validator
  • SolScriptions
  • FAQ
  • Initialize
  • Write Inscription Data
  • Fetch
  • Clear
  • Close
  • Authority
  • Sharding
  • Getting Started using JavaScript
  • Getting started using the Inscriptions CLI
  • Core Candy Machine
  • Getting Started using JavaScript
  • Candy Guard
  • Assets
  • Creating a Core Candy Machine
  • Inserting Items
  • Updating The Core Candy Machine
  • Guard Groups
  • Special Guard Instructions
  • Fetching a Core Candy Machine
  • Minting
  • Withdrawing a Core Candy Machine
  • Address Gate Guard
  • Allocation
  • Allowlist Guard
  • Asset Burn Guard
  • Asset Burn Multi
  • Asset Payment Guard
  • Asset Payment Multi
  • Asset Mint Limit
  • Bot Tax Guard
  • End Date Guard
  • Edition
  • Freeze Sol Payment guard
  • Freeze Token Payment Guard
  • Gatekeeper Guard
  • Mint Limit Guard
  • NFT Burn Guard
  • NFT Gate Guard
  • NFT Mint Limit Guard
  • NFT Payment Guard
  • Program Gate Guard
  • Redeemed Amount Guard
  • Sol Fixed Fee Guard
  • Sol Payment Guard
  • Start Date Guard
  • Third Party Signer Guard
  • Token Burn Guard
  • Token Gate Guard
  • Token Payment Guard
  • Token2022 Payment Guard
  • Generating Custom Guard Client for Core Candy Machine
Powered by GitBook
On this page
  • The Core Candy Guard account
  • Why another program?
  • All available guards
  • Conclusion

Candy Guard

What is a guard?

PreviousGetting Started using JavaScriptNextAssets

Last updated 10 months ago

A guard is a modular piece of code that can restrict access to the mint of a Core Candy Machine and even add new features to it!

There is a large set of guards to choose from and each of them can be activated and configured at will.

We’ll touch on later in this documentation but let’s go through a few examples here to illustrate that.

  • When the Start Date guard is enabled, minting will be forbidden before the preconfigured date. There is also an End Date guard to forbid minting after a given date.

  • When the Sol Payment guard is enabled, the minting wallet will have to pay a configured amount to a configured destination wallet. Similar guards exist for paying with tokens or NFTs of a specific collection.

  • The Token Gate and NFT Gate guards restrict minting to certain token holders and NFT holders respectively.

  • The Allow List guard only allows minting if the wallet is part of a predefined list of wallets. Kind of like a guest list for minting.

As you can see, each guard takes care of one responsibility and one responsibility only which makes them composable. In other words, you can pick and choose the guards your need to create your perfect Candy Machine.

The Core Candy Guard account

Each Core Candy Machine account should typically be associated with its own Core Candy Guard account which will add a layer of protection to it.

This works by creating a Core Candy Guard account and making it the Mint Authority of the Core Candy Machine account. By doing so, it is no longer possible to mint directly from the main Core Candy Machine program. Instead, we must mint via the Core Candy Guard program which, if all guards are resolved successfully, will defer to the Core Candy Machine Core program to finish the minting process.

Core Candy MachineOwner: Core Candy Machine ProgramFeaturesAuthority

Mint Authority = Candy Guard

...Core Candy GuardOwner: Core Candy Guard ProgramGuardsSol PaymentToken PaymentStart DateEnd Date...MintCore Candy Guard ProgramAccess Control

Anyone can mint as long as they comply with the activated guards.

MintCore Candy Machine Core ProgramMint Logic

Only Alice can mint.

NFTCandy MachineOwner: Candy Machine Core ProgramFeaturesAuthority

Mint Authority = Alice

Note that, since Core Candy Machine and Core Candy Guard accounts work hand and hand together, our SDKs treat them as one entity. When you create a Core Candy Machine with our SDKs, an associated Core Candy Guard account will also be created by default. The same goes when updating Core Candy Machines as they allow you to update guards at the same time. We will see some concrete examples on this page.

Why another program?

The reason guards don’t live in the main Core Candy Machine program is to separate the access control logic from the main Core Candy Machine responsibility which is to mint an NFT.

This enables guards to not only be modular but extendable. Anyone can create and deploy their own Core Candy Guard program to create custom guards whilst relying on the Core Candy Machine Core program for all the rest.

Core Candy MachineOwner: Core Candy Machine Core ProgramCore Candy GuardOwner: Core Candy Guard ProgramGuardsSol PaymentToken PaymentStart DateEnd Date...MintCore Candy Guard ProgramMintCustom Core Candy Guard ProgramDifferent Access ControlMintCore Candy Machine Core ProgramSame Mint LogicNFTCandy MachineOwner: Core Candy Machine Core ProgramCandy GuardOwner: Custom Core Candy Guard ProgramGuardsSol PaymentToken PaymentStart Date

My Custom Guard

Note that our SDKs also offer ways to register your own Core Candy Guard programs and their custom guards so you can leverage their friendly API and easily share your guards with others.

All available guards

Alright, now that we understand what guards are, let’s see what default guards are available to us.

In the following list, we’ll provide a short description of each guard with a link pointing to their dedicated page for more advanced reading.

Conclusion

Guards are important components of Core Candy Machines. They make it easy to configure the minting process whilst allowing anyone to create their own guards for application-specific needs.

...

...

: Restricts the mint to a single address.

: Allows specifying a limit on the number of NFTs each guard group can mint.

: Uses a wallet address list to determine who is allowed to mint.

: Configurable tax to charge invalid transactions.

: Determines a date to end the mint.

: Set the price of the mint in SOL with a freeze period.

: Set the price of the mint in token amount with a freeze period.

: Restricts minting via a Gatekeeper Network e.g. Captcha integration.

: Specifies a limit on the number of mints per wallet.

: Restricts the mint to holders of a specified collection, requiring a burn of the NFT.

: Restricts the mint to holders of a specified collection.

: Set the price of the mint as an NFT of a specified collection.

: Restricts the programs that can be in a mint transaction

: Determines the end of the mint based on the total amount minted.

: Set the price of the mint in SOL.

: Determines the start date of the mint.

: Requires an additional signer on the transaction.

: Restricts the mint to holders of a specified token, requiring a burn of the tokens.

: Restricts the mint to holders of a specified token.

: Set the price of the mint in token amount.

: Set the price of the mint in token22 (token extension) amount.

all available guards
React Flow
React Flow
Address Gate
Allocation
Allow List
Bot Tax
End Date
Freeze Sol Payment
Freeze Token Payment
Gatekeeper
Mint Limit
Nft Burn
Nft Gate
Nft Payment
Program Gate
Redeemed Amount
Sol Payment
Start Date
Third Party Signer
Token Burn
Token Gate
Token Payment
Token22 Payment