Airdrop Edition NFTs to Holders of an NFT Collection

Airdrop Edition NFTs to Holders of an NFT Collection


In this guide, we are going to airdrop ERC1155 tokens to all holders of an ERC721 collection.

Before we get started, below are some helpful resources where you can learn more about the tools we will use in this guide.

Let's get started!

Setting up the Contracts

To begin, we're going to deploy two NFT Collections.

  1. The ERC721 NFT Drop - representing our original NFT collection.
  2. The ERC1155 Edition - the NFTs we're going to be airdropping.

Creating an NFT Drop

Go to the thirdweb dashboard and select the NFT drop contract. Add the details for your NFT Drop and finally click Deploy Now!


Once you deploy the contract you will get this warning


So, click on set claim conditions and add a new claim condition with the details for your project.

Now, go to the NFTs tab. Let's batch upload some NFTs for the users to mint. For this guide, I am going to use the Shapes batch upload example.

Click on batch upload and upload the images and the CSV/JSON file.

Once they are uploaded you will be able to see the NFTs! To learn more about batch upload check out this guide.

Finally, click on the claim button and claim some NFTs so we can airdrop the Edition NFTs later 😉.

Creating the ERC1155 collection

Go to the thirdweb dashboard and select the Edition contract. Add the details for your NFT Drop and finally click Deploy Now!


Now, we need to mint an NFT, so go to the NFTs tab, add the details for your NFT, and set the initial supply to the number of NFTs that you want (Make sure that this amount is more than the amount that needs to be airdropped). Finally, hit Mint.

Airdropping NFTs to the holders

To airdrop the NFTs, we will create a script that will get all the owners of the ERC721 collection and create a CSV file from it.

We'll use this CSV file to airdrop the ERC1155 NFTs to each address that owns an NFT.

We are going to write the script in JavaScript, so initialise a new node.js project like this:

mkdir airdrop-nft

cd airdrop-nft

npm init -y

We will also add the required dependencies:

npm i @thirdweb-dev/sdk ethers # npm

yarn add @thirdweb-dev/sdk ethers # yarn

Now we can start writing our script, so create a new file called scripts/airdrop.mjs and add the following:

import { ThirdwebSDK } from "@thirdweb-dev/sdk";
import fs from "fs";
import path from "path";

(async () => {
  const sdk = new ThirdwebSDK("goerli");
  const contract = await sdk.getContract(

  if (!contract) {
    return console.log("Contract not found");

  const nfts = await contract?.erc721.getAll();

  if (!nfts) {
    return console.log("No NFTs found");

  const csv = nfts?.reduce((acc, nft) => {
    const address = nft.owner;
    const quantity = acc[address] ? acc[address] + 1 : 1;
    return { ...acc, [address]: quantity };
  }, {});

  const filteredCsv = Object.keys(csv).reduce((acc, key) => {
    if (key !== "0x0000000000000000000000000000000000000000") {
      return {
        [key]: csv[key],
    return acc;
  }, {});

  const csvString =
    "address,quantity\r" +
      .map(([address, quantity]) => `${address},${quantity}`)

  fs.writeFileSync(path.join(path.dirname("."), "nfts.csv"), csvString);
  console.log("Generated nfts.csv");

This script is getting all the NFTs from the original NFT collection, and then we are reducing it to get the amount of NFTs owned by each owner.

Finally, we are using fs to create a new csv file and add in the data.

Update your contract address, and run the script.

node scripts/airdrop.mjs

You will see a new nfts.csv file that has two columns like this:


Once you are done updating/checking your CSV file, go back to the Edition contract and click on the NFT. In the drawer switch to the airdrop tab and upload your addresses.


Now, click on airdrop and your NFTs will be airdropped 🎉


In this guide, we learned how to airdrop Edition nfts to holders of an NFT collection. Share the amazing Dapps that you built on the thirdweb discord! If you want to take a look at the code, check out the GitHub Repository.