Create A Solana NFT Drop With A Royalty Share/Split

Create A Solana NFT Drop With A Royalty Share/Split

In this guide, we'll show you how to release an NFT Drop on the Solana blockchain, and allow other users to mint a randomly selected NFT from the drop.

We'll set up our NFT Drop with royalty fees, which will be split amongst a list of creators, each with a set percentage.

Let's get started!

Pre-Requisites

If this is your first time building on Solana, follow this Getting Started with Solana Guide to set yourself up for success with a wallet and some test funds.

Creating the NFT Drop Program

We offer a prebuilt NFT Drop program for you to deploy, meaning you don't have to get your hands dirty in Rust or eat glass to get yourself set up on the Solana blockchain.

First, head to the dashboard and connect your Phantom Wallet:

image.png

From here, let's deploy the NFT Drop program, which allows us to batch-upload NFT metadata and let other wallets mint them:

image.png

Before we deploy, we need to define the metadata of our program itself. This is the information about your collection, such as the image, name, symbol (ticker), and description.

An important setting we need to define here is the Total Supply of the NFT Collection. This number represents how many NFTs we're going to mint.

image.png

Under the Network section, select Devnet to deploy to the Solana test network or Mainnet to deploy to the "real" Solana blockchain.

image.png

Congratulations 🎉 you just deployed an NFT Collection to Solana.

Let's see what we can do with it now.

Batch Uploading NFT Metadata

In the NFT Drop program, NFTs are "lazy-minted" by the admin/program deployer.

Lazy minting is the process of uploading your NFT metadata and defining it in your program, but not actually minting the NFTs just yet. We're simply preparing all the information so that other users can mint the NFTs we've uploaded.

To upload our NFT metadata to the program, click the Batch Upload button:

image.png

The batch upload accepts the most popular formats of NFT metadata:

  • A .json file, or multiple .json files
  • A .csv file

For reference, you can use the example.csv or example.json files we have for representing your NFT metadata. You can use the same metadata as I am by downloading it from Github.

Drag and drop your metadata and media files like so:

image.png

Confirm your metadata looks correct and click Next:

image.png

Finally, let's upload our NFT metadata by clicking Upload X NFTs:

image.png

Behind the scenes, this is uploading and pinning your NFT metadata to IPFS, meaning your metadata is decentralized and immutable.

Accept the transaction in your wallet and voilà! Your NFTs are lazy-minted!

image.png

Setting Claim Conditions

When you release your NFTs, you can define how you want users to mint them. Claim conditions outline key elements of your drop including price, release date, royalties, etc.

Head to the Claim Conditions tab from the dashboard and click Add Claim Conditions:

image.png

I'm going to configure the drop to start immediately, release all 30 of the NFTs I uploaded in a free mint and set a 5% royalty fee:

image.png

To confirm your changes, click Save Claim Conditions and approve the transaction.

Now your NFTs are officially ready to be minted! 🥳

Minting NFTs

To keep this guide simple, we'll mint the NFTs directly from the dashboard. You can follow our Building An NFT Drop Application guide to creating a custom minting page if you choose to do so!

From the Overview tab, click the Claim button to mint an NFT from the drop:

image.png

I'll claim 1 NFT from the drop using a separate wallet (different from the deployer wallet for demo purposes) by clicking Claim:

image.png

When the transaction goes through, you'll notice a randomly selected NFT will be minted. For me, I got the super rare Red Hexagon NFT:

image.png

Now let's see how we can configure our NFT Drop to send royalty fees to multiple wallet addresses using the SDK.

Adding A Shared Revenue Stream

Head to the terminal and create a new Node.js application:

npm init -y

Let's install the thirdweb Solana SDK into our new project:

npm install @thirdweb-dev/sdk

Open the project up in your favourite text editor and let's configure the program's royalty fees now.

Create a new file called index.mjs, and instantiate the SDK using your wallet's private key:

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

// IMPORTANT: Never expose your private key. This is just for demonstration purpsoses.
// Anyone with your private key has full control over your wallet.
// Learn more about securing your private key:
// https://portal.thirdweb.com/sdk/set-up-the-sdk/securing-your-private-key
const privateKey = "...";

// Instantiate the SDK onto the network you deployed your program to
const sdk = ThirdwebSDK.fromPrivateKey("mainnet-beta", privateKey);

IMPORTANT: Your private key grants full control over your wallet. It's vital you never expose this value. Learn how to store and access your private key securely

Next, we can connect to our program using its address (which you can get from the dashboard) and update the creators of our program.

For example, in the code below, I'm updating my program to have two creators who both receive 50% of the royalties:

// Connect to the smart contract
const nftDrop = await sdk.getNFTDrop(
  // Your program address (available in the dashboard)
  "BSNUBdqfKpKTjHxDGHbuzzMukHaevbQSkFWzosobveSb"
);

// Update the "creators" field to include multiple wallets
const tx = await nftDrop.updateCreators([
  {
    address: "76Mrc4fDJYgjzXsnAW3yhDKgJujfkhakKUmh3ipkH6vJ",
    share: 50,
  },
  {
    address: "FJoBHe9CNpuN6jWisiDu7w5fwQLcRQvACiLfgd2wcNT7",
    share: 50,
  },
]);

console.log("🎉 Updated creators successfully!")

Remember to replace the program and wallet addresses with your values.

From the terminal, run the script to update the creators:

node index.mjs

When successful, you should see the 🎉 Updated creators successfully! message in your terminal.

Let's see this royalty distribution in action!

Listing NFT For Sale

We can sell our NFT on a marketplace such as Magic Eden now directly through our Phantom Wallet.

After minting from the drop, you should now see the NFT in the Collectibles tab:

image.png

Click the List button to sell your NFT on Magic Eden:

image.png

Set a price for your NFT and click Next, then List Now.

image.png

After buying the NFT (I'm using a separate wallet again), we can notice the transfer of Solana to different addresses in the transaction details:

image.png

From the bottom-up (bottom transaction first), we see:

  1. I buy the NFT from Magic Eden, paying - 0.1 SOL which is forwarded through the program to the primary sale recipient address.
  2. I pay 50% of the 5% royalty fee (- 0.0025 SOL) to creator 1
  3. I pay 50% of the 5% royalty fee (- 0.0025 SOL) to creator 2

That's it! All secondary sales of this NFT will take a 5% royalty fee and this fee will be distributed among the creators you defined using the SDK.

Wrapping Up

In this guide, we've successfully deployed an NFT Drop program to Solana.

Not only that, we've shipped some awesome features:

  • Primary sales go to the creator wallet
  • We take a 5% royalty fee on secondary sales
  • The royalty fee funds are distributed between multiple wallets.

Got questions? Jump into our Discord to speak with our team directly!