> For the complete documentation index, see [llms.txt](https://8bit-1.gitbook.io/solibrary/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://8bit-1.gitbook.io/solibrary/nft-gate-guard.md).

# NFT Gate Guard

## NFT Gate Guard

### Overview <a href="#overview" id="overview"></a>

The **NFT Gate** guard restricts minting to holders of a specified NFT collection.

Check that the payer

has 1 NFT

from this collection

Core Candy Machine

Owner: Core Candy Machine Core Program

Core Candy Guard

Owner: Core Candy Guard Program

GuardsnftGate- Required Collection...

Collection NFT

Mint Account

Owner: Token Metadata Program

Mint from

*Candy Guard Program*

Access Control

Mint from

*Candy Machine Program*

Mint Logic

Asset

[React Flow](https://reactflow.dev/)

### Guard Settings <a href="#guard-settings" id="guard-settings"></a>

The NFT Gate guard contains the following settings:

* **Required Collection**: The mint address of the required NFT Collection. The NFT we provide as proof when minting must be part of this collection.

Set up a Candy Machine using the NFT Gate Guard

JavaScript

```
create(umi, {
  // ...
  guards: {
    nftGate: some({
      requiredCollection: requiredCollectionNft.publicKey,
    }),
  },
});
```

API References: [create](https://mpl-core-candy-machine.typedoc.metaplex.com/functions/create.html), [NftGate](https://mpl-core-candy-machine.typedoc.metaplex.com/types/NftGate.html)

### Mint Settings <a href="#mint-settings" id="mint-settings"></a>

The NFT Gate guard contains the following Mint Settings:

* **Mint**: The mint address of the NFT to provide as proof that the payer owns an NFT from the required collection.
* **Token Account** (optional): You may optionally provide the token account linking the NFT with its owner explicitly. By default, the associated token account of the payer will be used.

Note that, if you’re planning on constructing instructions without the help of our SDKs, you will need to provide these Mint Settings and more as a combination of instruction arguments and remaining accounts. See the [Candy Guard’s program documentation](https://github.com/metaplex-foundation/mpl-core-candy-machine/tree/main/programs/candy-guard#nftgate) for more details.

Set up a Candy Machine using the NFT Gate Guard

JavaScript

When minting via the Umi library, simply provide the mint address of the NFT to use as proof of ownership via the `mint` attribute like so.

```
mintV1(umi, {
  // ...
  mintArgs: {
    nftGate: some({ mint: nftToBurn.publicKey }),
  },
});
```

API References: [mintV1](https://mpl-core-candy-machine.typedoc.metaplex.com/functions/mintV1.html), [NftGateMintArgs](https://mpl-core-candy-machine.typedoc.metaplex.com/types/NftGateMintArgs.html)

### Route Instruction <a href="#route-instruction" id="route-instruction"></a>

*The NFT Gate guard does not support the route instruction.*
