NFT Drop
thirdweb's drop contracts lazy mint your NFTs and makes them available to be claimed by your users.
The NFT Drop contract is best used when you want to release a 1-of-1 or 1-of-many NFT collection, such as a PFP (profile picture) collection, and uses the ERC721 Standard. The NFT Drop contract allows you to define the conditions for when and how your users can mint an NFT, including allowlists, release dates, claim limits and delayed reveals.
When you add NFTs to your drop contract, they are not minted at this point. You prepare everything for your users so that they can mint the NFT(s). This means the user who claims the NFT is the one who mints it, and it is minted into their wallet. By default, the user is the one who pays the gas fees.
You could use the NFT Drop contract to:
- Release a PFP Collection where each NFT has a different combination of traits
- Release NFTs of your artwork, and have your community mint them for a price
- Create a restricted-access NFT drop, where only a certain list of wallets can claim it
Create an NFT Drop Contract
Learn how to create any of thirdweb's pre-built contracts in the Deploying Contracts page.
Getting the contract in your application
To start using your NFT Drop contract inside your application, you'll need to use it's contract address. You can get the contract address from the dashboard.
- Javascript
- React
- Python
- Go
import { ThirdwebSDK } from "@thirdweb-dev/sdk";
const sdk = new ThirdwebSDK("rinkeby");
const contract = sdk.getNFTDrop("{{contract_address}}");
import { useNFTDrop } from '@thirdweb-dev/react'
export default function Component() {
const nftDrop = useNFTDrop("<YOUR-CONTRACT-ADDRESS>")
// Now you can use the nft drop contract in the rest of the component
}
from thirdweb import ThirdwebSDK
from eth_account import Account
# You can customize this to a supported network or your own RPC URL
network = "mumbai"
# This will create a random account to use for signing transactions
signer = Account.create()
sdk = ThirdwebSDK(network, signer)
contract = sdk.get_nft_drop("{{contract_address}}")
import (
"github.com/thirdweb-dev/go-sdk/thirdweb"
)
privateKey = "..."
sdk, err := thirdweb.NewThirdwebSDK("mumbai", &thirdweb.SDKOptions{
PrivateKey: privateKey,
})
contract, err := sdk.GetNFTDrop("{{contract_address}}")
Lazy Minting Your NFTs
Using the dashboard
You can batch upload NFTs through the dashboard by uploading a .csv
file or a .json
file that contains the metadata of all your NFTs, alongside the assets (images, videos, etc).
- You must include a
name
column for each NFT in the.csv
orjson
file - Asset file names must be sequential. E.g.
0.png
,1.png
,2.png
.
You can use our examples to get started:
For a more in-depth guide on how to create your NFTs in the NFT Drop contract, check out our guide How to Release an NFT Drop.
Using the thirdweb SDK
- Javascript
- React
- Python
- Go
// Custom metadata of the NFTs to create
const metadatas = [{
name: "Cool NFT",
description: "This is a cool NFT",
image: fs.readFileSync("path/to/image.png"), // This can be an image url or file
}, {
name: "Cool NFT",
description: "This is a cool NFT",
image: fs.readFileSync("path/to/image.png"),
}];
const results = await contract.createBatch(metadatas); // uploads and creates the NFTs on chain
const firstTokenId = results[0].id; // token id of the first created NFT
const firstNFT = await results[0].data(); // (optional) fetch details of the first created NFT
React SDK support for createBatch is coming soon.
Want this feature sooner? Let us know in Discord!
from thirdweb.types.nft import NFTMetadataInput
# You can customize this metadata however you like
metadatas = [
NFTMetadataInput.from_json({
"name": "Cool NFT",
"description": "This is a cool NFT",
"image": open("path/to/file.jpg", "rb"),
}),
NFTMetadataInput.from_json({
"name": "Cooler NFT",
"description": "This is a cooler NFT",
"image": open("path/to/file.jpg", "rb"),
}),
]
txs = contract.create_batch(metadatas)
first_token_id = txs[0].id
first_nft = txs[0].data()
image0, err := os.Open("path/to/image/0.jpg")
defer image0.Close()
image1, err := os.Open("path/to/image/1.jpg")
defer image1.Close()
metadatas := []*thirdweb.NFTMetadataInput{
&thirdweb.NFTMetadataInput{
Name: "Cool NFT",
Description: "This is a cool NFT",
Image: image1
}
&thirdweb.NFTMetadataInput{
Name: "Cool NFT 2",
Description: "This is also a cool NFT",
Image: image2
}
}
tx, err := contract.CreateBatch(metadatas)
Setting Claim Phases
A claim phase is a set of conditions that define when and how your users can mint an NFT.
You can have multiple claim phases that occur in sequence.
For each claim phase, you can define:
- When the claim phase will start
- How many NFTs you want to drop
- How much you want to charge per NFT
- What currency you want to use
- Which wallet addreses are allowed to mint (allowlist)
- How many NFTs can be claimed per transaction
- How many seconds wallets have to wait between claims
Using the dashboard
For a more in-depth guide on how to set-up your NFT Drop with multiple claim phases and an allowlist, check out our guide Release an NFT Drop with an allowlist and multiple claim phases.
Using the thirdweb SDK
- Javascript
- React
- Python
- Go
const presaleStartTime = new Date();
const publicSaleStartTime = new Date(Date.now() + 60 * 60 * 24 * 1000);
const claimConditions = [
{
startTime: presaleStartTime, // start the presale now
maxQuantity: 2, // limit how many mints for this presale
price: 0.01, // presale price
snapshot: ['0x...', '0x...'], // limit minting to only certain addresses
},
{
startTime: publicSaleStartTime, // 24h after presale, start public sale
price: 0.08, // public sale price
}
]);
await contract.claimConditions.set(claimConditions);
React SDK support for claimConditions is coming soon.
Want this feature sooner? Let us know in Discord!
Python SDK support for claimConditions is coming soon.
Want this feature sooner? Let us know in Discord!
Go SDK support for claimConditions is coming soon.
Want this feature sooner? Let us know in Discord!
Delayed Reveals
Delayed reveals allow you to reveal the contents of the NFT to the user later at a specific date, and show a placeholder asset in the meantime.
Using the dashboard
- Reveal upon mint: Collectors will immediately see the final NFT when they complete the minting.
- Delayed Reveal: Collectors will mint your placeholder image, then you reveal at a later time.
For a more in-depth guide on how to set-up your NFT Drop with delayed reveal, check out our guide Release an NFT drop with delayed reveal.
Using the thirdweb SDK
- Javascript
- React
- Python
- Go
// the real NFTs, these will be encrypted until you reveal them
const realNFTs = [{
name: "Common NFT #1",
description: "Common NFT, one of many.",
image: fs.readFileSync("path/to/image.png"),
}, {
name: "Super Rare NFT #2",
description: "You got a Super Rare NFT!",
image: fs.readFileSync("path/to/image.png"),
}];
// A placeholder NFT that people will get immediately in their wallet, and will be converted to the real NFT at reveal time
const placeholderNFT = {
name: "Hidden NFT",
description: "Will be revealed next week!"
};
// Create and encrypt the NFTs
await contract.revealer.createDelayedRevealBatch(
placeholderNFT,
realNFTs,
"my secret password",
);
// Whenever you're ready, reveal your NFTs at any time
const batchId = 0; // the batch to reveal
await contract.revealer.reveal(batchId, "my secret password");
React SDK support for revealer is coming soon.
Want this feature sooner? Let us know in Discord!
Python SDK support for revealer is coming soon.
Want this feature sooner? Let us know in Discord!
Go SDK support for revealer is coming soon.
Want this feature sooner? Let us know in Discord!
Setting Royalty Fees
Royalty fees are fees you earn on secondary sales of your NFTs. For example, if somebody mints an NFT from your drop and then sells it to another user, you will earn a royalty fee.
Using the dashboard
From the dashboard, in the Settings tab you can set the royalty percentage and the address that should receive the revenue from royalties earned from secondary sales of the assets.
Using the thirdweb SDK
- Javascript
- React
- Python
- Go
// royalties on the whole contract
contract.royalty.setDefaultRoyaltyInfo({
seller_fee_basis_points: 100, // 1%
fee_recipient: "0x..."
});
// override royalty for a particular token
contract.royalty.setTokenRoyaltyInfo(tokenId, {
seller_fee_basis_points: 500, // 5%
fee_recipient: "0x..."
});
React SDK support for royalty is coming soon.
Want this feature sooner? Let us know in Discord!
Python SDK support for royalty is coming soon.
Want this feature sooner? Let us know in Discord!
Go SDK support for royalty is coming soon.
Want this feature sooner? Let us know in Discord!
Minting / Claiming NFTs
With an NFT Drop contract, users claim NFTs by minting them into their wallet. Typically you will have a "mint" button that your users can click, which mints this user the next unclaimed NFT in your collection.
Using the embed
We have a pre-built embed that you can use to display your NFT Drop within your website.
You can access your NFT Drop's embed URL from the dashboard.
Using the thirdweb SDK
- Javascript
- React
- Python
- Go
const address = "{{wallet_address}}"; // address of the wallet you want to claim the NFTs
const quantity = 1; // how many unique NFTs you want to claim
const tx = await contract.claimTo(address, quantity);
const receipt = tx.receipt; // the transaction receipt
const claimedTokenId = tx.id; // the id of the NFT claimed
const claimedNFT = await tx.data(); // (optional) get the claimed NFT metadata
React SDK support for claimTo is coming soon.
Want this feature sooner? Let us know in Discord!
address = {{wallet_address}}
quantity = 1
tx = contract.claim_to(address, quantity)
receipt = tx.receipt
claimed_token_id = tx.id
claimed_nft = tx.data()
address := "{{wallet_address}}"
quantity = 1
tx, err := contract.ClaimTo(address, quantity)
Viewing NFTs
Our SDKs provide helpful ways to view the NFTs in your collection.
One NFT
- Javascript
- React
- Python
- Go
const tokenId = 0;
const nft = await contract.nft.get(tokenId);
React SDK support for get is coming soon.
Want this feature sooner? Let us know in Discord!
nft = contract.get(0)
print(nft)
nft, err := contract.Get(0)
All NFTs
- Javascript
- React
- Python
- Go
const nfts = await contract.getAll();
console.log(nfts);
React SDK support for getAll is coming soon.
Want this feature sooner? Let us know in Discord!
nfts = contract.get_all()
print(nfts)
nfts, err := contract.GetAll()
ownerOne := nfts[0].Owner
nameOne := nfts[0].Metadata.Name
Claimed NFTs
- Javascript
- React
- Python
- Go
const claimedNFTs = await contract.getAllClaimed();
const firstOwner = claimedNFTs[0].owner;
React SDK support for getAllClaimed is coming soon.
Want this feature sooner? Let us know in Discord!
claimed_nfts = contract.get_all_claimed()
first_owner = claimed_nfts[0].owner
claimedNfts, err := contract.GetAllClaimed()
firstOwner := claimedNfts[0].Owner
Unclaimed NFTs
- Javascript
- React
- Python
- Go
const unclaimedNFTs = await contract.getAllUnclaimed();
const firstUnclaimedNFT = unclaimedNFTs[0].name;
React SDK support for getAllUnclaimed is coming soon.
Want this feature sooner? Let us know in Discord!
unclaimed_nfts = contract.get_all_unclaimed()
first_nft_name = unclaimed_nfts[0].name
unclaimedNfts, err := contract.GetAllUnclaimed()
firstNftName := unclaimedNfts[0].Name
NFTs owned by a specific wallet
- Javascript
- React
- Python
- Go
// Address of the wallet to get the NFTs of
const address = "{{wallet_address}}";
const nfts = await contract.getOwned(address);
console.log(nfts);
React SDK support for getOwned is coming soon.
Want this feature sooner? Let us know in Discord!
nfts = contract.get_owned("{{wallet_address}}")
print(nfts)
owner := "{{wallet_address}}"
nfts, err := contract.GetOwned(owner)
name := nfts[0].Metadata.Name
Viewing Supply
Claimed supply
- Javascript
- React
- Python
- Go
const claimedNFTCount = await contract.totalClaimedSupply();
console.log(`NFTs claimed so far: ${claimedNFTCount}`);
React SDK support for totalClaimedSupply is coming soon.
Want this feature sooner? Let us know in Discord!
total_claimed = contract.total_claimed_supply()
Go SDK support for totalClaimedSupply is coming soon.
Want this feature sooner? Let us know in Discord!
Unclaimed supply
- Javascript
- React
- Python
- Go
const unclaimedNFTCount = await contract.totalUnclaimedSupply();
console.log(`NFTs left to claim: ${unclaimedNFTCount}`);
React SDK support for totalUnclaimedSupply is coming soon.
Want this feature sooner? Let us know in Discord!
total_unclaimed = contract.total_unclaimed_supply()
Go SDK support for totalUnclaimedSupply is coming soon.
Want this feature sooner? Let us know in Discord!
Transferring NFTs
You can transfer NFTs from one wallet to another.
- Javascript
- React
- Python
- Go
const walletAddress = "{{wallet_address}}";
const tokenId = 0;
await contract.nft.transfer(walletAddress, tokenId);
React SDK support for transfer is coming soon.
Want this feature sooner? Let us know in Discord!
to = "{{wallet_address}}"
token_id = 0
receipt = contract.transfer(to, token_id)
to := "0x..."
tokenId := 0
tx, err := contract.Transfer(to, tokenId)
Burning NFTs
Burning is the process of removing the token from circulation by sending it to an inaccessible address. It does not delete the token from the blockchain.
Using the dashboard
Using the SDK
- Javascript
- React
- Python
- Go
const result = await contract.burn(tokenId);
React SDK support for burn is coming soon.
Want this feature sooner? Let us know in Discord!
Python SDK support for burn is coming soon.
Want this feature sooner? Let us know in Discord!
tokenId := 0
tx, err := contract.Burn(tokenId)