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 Solana Wallet:

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

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.

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

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:

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:

Confirm your metadata looks correct and click Next
:

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

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!

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
:

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:

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:

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

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:

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
Using the CLI, create a new Node.js & Javascript project with the Solana SDK preconfigured for you, using the following command:
npx thirdweb create --template node-solana-javascript-starter
Open the project up in your favourite text editor and let's configure the program's royalty fees now.
Open the index.js file and clear out the existing code then add the following:
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:

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

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

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:

From the bottom-up (bottom transaction first), we see:
- I buy the NFT from Magic Eden, paying
- 0.1
SOL which is forwarded through the program to the primary sale recipient address. - I pay 50% of the 5% royalty fee (
- 0.0025 SOL
) to creator 1 - 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!