0%
Overview page background
HomeOverviewsSolana
How to Airdrop Solana NFTs Using Metaplex and Gumdrop

How to Airdrop Solana NFTs Using Metaplex and Gumdrop

Daniel Idowu headshot

Written by Daniel Idowu

Brady Werkheiser headshot

Reviewed by Brady Werkheiser

Published on August 2, 20226 min read

This tutorial walks you through how to airdrop NFTs on Solana using Gumdrop, one of the NFT tools created by Metaplex.  If you are new to developing NFT projects on Solana, this beginner-friendly tutorial is for you.

Estimated time to complete this guide: 15 minutes

In this tutorial, we will:

  1. Create an NFT

  2. Mint an NFT

  3. Airdrop an NFT with the Gumdrop Command Line Interface (CLI)

  4. Create a link to share with friends using Vervel and Gumdrop

And don’t worry if you don’t understand what these words mean yet! We’ll go through everything together. 

An NFT airdrop is when a free NFT is transferred to a wallet address. NFT airdrops are popular ways for NFT projects to reward collectors, incentivize community engagement, or hand out allowlist tokens for upcoming NFT mints. NFT airdrops are most frequently employed as an NFT marketing tactic.

Some examples of NFT airdrops include:

  1. Swim Protocol - airdropped a Swimmer NFT to people who used their cross-chain bridge

  2. Aurory - airdrops new art and collectibles to collectors of their Aurorian NFTs

  3. Degenerate Ape Academy - airdropped mint tokens to token holders to participate in the Degenerate Trash Panda mint

By essentially giving away a free item to its holders, NFT projects can continue to create value for their tokens and community.

Gumdrop is an NFT feature from Metaplex that allows creators to directly send users on an allowlist to a reclamation link by building the tree with off-chain handles and allowing users to redeem into any wallet. Gumdrop can also be used with Candy Machine, complete NFT airdrops, and distribute tokens. 

Gumdrop makes NFT airdrops on Solana easy by simplifying the process of dropping our Non-fungible tokens using an allowlist.

To make sure you’re all set for this tutorial, you’ll need the following tools installed on your machine:

  1. NodeJS (version 16)

  2. TS-Node

  3. SolanaCLI

  4. Yarn

  5. Git

  6. Metaplex CLI

  7. Phantom Wallet

If you're new to Solana development, learn how to install Solana developer tools before moving forward.

You can utilize NVM, if you have a different version of Node installed on your machine.

If anything seems overwhelming right now, don't worry. Each tool's functionality will be demonstrated as we move on.

Installing and configuring the Gumdrop CLI is handled through the Gumdrop GitHub repository. They provide everything you need. Let’s clone the repository and get it onto our computer. We also need to confirm node, yarn, and ts-node are installed before proceeding. 

You can install ts-node by running:

Copied
npm install -g ts-node

You can verify by running:

Copied
ts-node --version

 Now, let’s create an empty folder with the mkdir command in your terminal. We will name this folder solana-airdrop.

Run the following command inside the folder to create a Solana wallet:

Copied
solana-keygen new --outfile ~/solana-airdrop/solana-devnet/keypair.json

The message you see in your terminal should be saved in a secure location because we'll need the pubkey and seed phrase later.

Here is an example of what that should look like:

Solana wallet generation output
Solana wallet generation output

Next, clone the Gumdrop project into the solana-airdrop folder:

Copied
git clone https://github.com/metaplex-foundation/gumdrop.git

Then we navigate to the directory containing the CLI:

Copied
cd packages/cli/src

Next, run: 

Copied
yarn install 

This command will install all the necessary dependencies. The installation process can take a few minutes.

Next, we're going to connect to the Solana Devnet cluster as we wouldn't like to spend any money for learning purposes. Mark that for real-world applications, we'd need to use the mainnet. You change it to devnet by running the command below:

Copied
solana config set -url https://api.devnet.solana.com

Now, we need to create a new key that would hold our NFT. The "Se" basically means that our pubkey starts with “Se”

Copied
solana-keygen grind --starts-with Se:1
Solana keypair generation output
Solana keypair generation output

Let's run a couple more commands to configure our new Solana address:

Copied
solana config set --keypair Se93wChXsXBzeWjEXrhufRAHJE6sP6dMaS7aCsvneDU

This should display the following: 

Solana wallet address configuration output
Solana wallet address configuration output

Now we need to get test Solana tokens. Since we're in the devnet, you can quickly get some sol by running the command below in the terminal:

Copied
solana airdrop 5

Alternatively, you can grab some devnet SOL tokens from a Solana faucet

Solana faucet website interface
Solana faucet website interface

You can confirm you have Solana in your devnet wallet by running this script in the command line: 

Copied
solana balance

Now, we will link the newly formed devnet wallet to Phantom. To do this, click settings, select Change Network, and then choose Devnet.

Connect your Phantom wallet to Solana's devnet cluster
Connect your Phantom wallet to Solana's devnet cluster

We must now acquire the private key for the devnet wallet. Open your terminal and use cat to inspect the keypair.json file's contents to get that:

Copied
cat .config/solana/devnet.json

To add the devnet wallet to Phantom:

  1. Open Phantom

  2. Copy the output you just received

  3. Give it a suitable name

  4. Select Import Private Key from the top left navigation menu

  5. Click Add/Connect Wallet

  6. Paste the key into the Private Key area

Now, your Devnet Phantom Wallet should reflect 5 SOL.

You can use platforms like Metaplex, Holaplex, or Solsea that follow the metadata standard for creating and minting your Solana NFT. 

Here's what to do first:

  1. Set up your wallet and ensure it has some SOL tokens

  2. Visit the Holaplex website

  3. Connect your Phantom wallet to the Metaplex platform

Metaplex will ask for permission to view your funds, and request approval for transactions. You can approve this.

Creating an NFT using Holaplex
Creating an NFT using Holaplex

Next:

  1. Click the create tab

  2. Select browse file

  3. Upload any image of your choice

  4. Add a Name and description to your Image

  5. Give some attributes

  6. Click Next

We set our NFT to unlimited to allow us to create as many copies as we wish to mint.

We should now be able to see the NFT in your wallet after clicking mint and it being successful.

Now, get the metadata and store it in a secure file, and transfer the NFT from your Phantom wallet to the pubkey address you generated earlier.

You can query that by running:

Copied
solana-keygen pubkey my-keypair.json

Alternatively, more advanced Solana developers can mint with Candy Machine

Before you move on, you must understand that the gumdrop program supports three drop types: 

  1. The Token Airdrop

  2. NFT candy machine pre-sale

  3. The Edition prints

We must also define our distribution method and whitelist:

Copied
ts-node gumdrop-cli.ts

A list of options guiding us on how to use the CLI is listed here: 

Copied
ts-node src/gumdrop-cli.ts help create

For the drop type, we will be going with Token Airdrop

This method allows the CLI to move the tokens to the generated disposable keypair, enabling a more logical creation of additional gumdrops.

Copied
--claim-integration transfer -transfer mint -k

For the distribution method, we can airdrop using SMS, Discord, Email, or wallets. For this tutorial, we airdropped via wallets using the command below:

Copied
--distribution-method wallets

Before moving on to run the full command, we have to create a whitelist.json file. The allowlist will help specify the recipients of the Airdrop. 

It is a list containing the receivers with identifying values such as mints or prints to be claimed and the number of editions. 

The whitelist is in this format below:

Copied
[ {   "handle": "2tYbLBHmpsEbf6hn8woKFeXQxQK8qZ9ZhnU5pXAx6WhU",   "amount": 1     },  {   "handle": "2tYbLBHmpsEbf6hn8woKFeXQxQK8qZ9ZhnU5pXAx6WhU",   "amount":1     } ]

You can replace it with the information below and populate it based on the number of friends that will receive the NFT airdrop. 

We can then reference the distribution list with the following command:

Copied
--distribution-list whitelist.json

Finally, run all the commands below:

Copied
ts-node gumdrop-cli.ts create \ -transfer mint of mint > -k of nft> \ --claim-integration transfer \ --distribution-method wallets \ --distribution-list whitelist.json

Now, let's airdrop the NFTs to the address of your choice. In the file directory, locate the “log” folder, check all of the files, and look for the .json file containing URLs as shown below. The file contains the content of the whitelist.json file with URLs meant for the recipient of the airdrop. You can follow that link in your browser.

You should have something like this:

Gumdrop NFT claim interface
Gumdrop NFT claim interface

Gumdrop provides an interactive UI that makes it easy for recipients to claim their airdrop. We can deploy this custom gumdrop site to Vercel. 

And that's it! You have built a gumdrop site that can airdrop NFTs to friends.

When the gumdrop is finished, the master edition can be recovered by closing the gumdrop. If you close the gumdrop, the recipients might be unable to claim their gumdrop.

The code snippet to close a gumdrop is:

Copied
ts-node gumdrop-cli.ts close \ --base \ --keypair \ --claim-integration \ --

To withdraw authority or return tokens, you can pass further information about the claim integration.

You can choose to deploy your Gumdrop website. I would recommend Vercel, which is known to provide a robust developer experience, especially when building frontend frameworks and static websites.

First, head over to Vercel and sign-up for a free account, and use GitHub for faster integration. 

Create a new project in Vercel
Create a new project in Vercel

Here's what to do next:

  1. Select new project and import the file from your Github repository

  2. Fill in the Project name and define the directory

  3. Toggle the Build and Output Settings and make changes as shown below‍

Import a file from GitHub to create a Vercel website for your Solana NFT airdrop
Import a file from GitHub to create a Vercel website for your Solana NFT airdrop

Now, confirm that the Output Directory is set to override, and click Deploy to get a unique link for the project!

Congratulations! You just deployed a Custom Gumdrop website 🎉

If you'd like to share with your friends, you can simply share the link. You should also retrieve their wallet addresses as the allowlist distribution method is set to wallet. 

Overview cards background graphic
Section background image

Build blockchain magic

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

Get your API key