In this guide, you will learn how to create and mint Non-Fungible Tokens (NFTs) on the Zora Network using Crossmint.
By the end, you will learn how to:
- Create and Deploy an NFT Collection on the Zora Network using an API
- Create and mint NFTs on the Zora Network using the Mint API.
This guide will take you 10 mins to complete (approximately).
Let's get started!
Table of Contents:
- Setup
- Create an NFT Collection on Zora
- Create and Mint NFTs on Zora
- Create and Mint NFTs with No-code
- Conclusion
- What's Next?
- Need Help?
Setup
This section will guide you through understanding the difference between Crossmint's staging and production environments, creating an API key, and defining the necessary scopes for your project.
Difference between Staging and Production
Crossmint provides two distinct environments: staging and production.
The staging environment, accessible at https://staging.crossmint.com, is designed for testing and development, allowing you to experiment without real-world financial implications. It utilizes testnets and supports test credit cards, making it ideal for developers to validate changes and ensure everything works as expected.
The production environment is the live setting where end users interact with your application, accessed at https://www.crossmint.com. It operates on mainnets and accepts real transactions, necessitating thorough testing in the staging environment before deployment.
Create an API Key
Creating an API key is essential for interacting with Crossmint's functionalities. Here are the steps to create one:
- Create a Developer Account: Before you proceed, make sure that you have a Crossmint developer account. If not, please sign up - Crossmint Console.
- Navigate to the API Keys Section: Log into Crossmint's Console and navigate to "Developers" section and click on "API Keys".
- Create a New API Key: Select “Create new key,” choosing a Server-side Key for operations like creating collections and minting NFTs.
- Select the Required Scopes: Specify the scopes your project needs. For NFT operations, include:
- "nfts.create"
- "nfts.read"
- "collections.create"
- "collections.read"
Create an NFT Collection on Zora
Creating an NFT collection is the first step to minting your own NFTs on the Zora Network using Crossmint. Now, let's look at the steps to do this.
Deploy the NFT Collection
To start, you’ll need to prepare the metadata for your collection such as name, image URL, and description of the collection, and the supply limit if any.
Below is a JavaScript snippet to create an NFT collection. Ensure to replace
"YOUR_API_KEY" with your actual Crossmint API key and adjust the "metadata" and "chain" values to suit your collection.
const axios = require('axios');
const createCollection = async () => {
const url = "https://www.crossmint.com/api/2022-06-09/collections/";
const apiKey = 'YOUR_API_KEY'; // Replace with your actual API key from Crossmint
const data = {
chain: "zora", // Specify the blockchain you are deploying to
metadata: {
name: "My NFT Collection", // Name of your NFT collection
imageUrl: "https://www.example.com/collection-image.png", // Image URL representing your collection
description: "This is my first NFT collection on Zora", // A brief description of your collection
symbol: "MYNFT" // Collection symbol, applicable for EVM chains only
},
fungibility: "non-fungible", // Specify the fungibility nature of the collection
supplyLimit: 1000, // Optional: Specify the maximum number of tokens that can be minted
payments: {
price: "0.01", // Price of the token in the native currency for the selected chain
recipientAddress: "0xYOUR_WALLET_ADDRESS" // Your wallet address to receive payments
},
reuploadLinkedFiles: true // Reupload linked files in metadata to IPFS
};
try {
const headers = {
'X-API-KEY': apiKey,
'Content-Type': 'application/json'
};
const response = await axios.post(url, data, { headers });
console.log("Collection created successfully. Action ID:", response.data.actionId);
return response.data.actionId; // This action ID will be used to check the deployment status
} catch (error) {
console.error("Error creating collection:", error.response ? error.response.data : error.message);
}
};
createCollection();
This code sends a POST request to the Crossmint API endpoint to create a new NFT collection. The response includes an "actionId", which you’ll use to check the deployment status.
Verify Collection Deployment
After deploying your collection, it’s important to verify whether it was deployed successfully. You can use the "actionId" obtained from the previous step to check the status.
Here’s how you use the "actionId" to check your collection’s deployment status:
const verifyCollectionDeployment = async (actionId) => {
const url = `https://www.crossmint.com/api/2022-06-09/actions/${actionId}`;
const apiKey = 'YOUR_API_KEY'; // Replace with your actual API key from Crossmint
try {
const headers = {
'X-API-KEY': apiKey
};
const response = await axios.get(url, { headers });
console.log("Collection deployment status:", response.data.status);
} catch (error) {
console.error("Error checking collection deployment status:", error.response ? error.response.data : error.message);
}
};
// Assume the action ID was returned by the createCollection function
const actionId = "YOUR_ACTION_ID"; // Replace with your actual action ID from the collection creation response
verifyCollectionDeployment(actionId);
This function makes a GET request to the Crossmint API, providing the "actionId" as a parameter. The API then returns the status of the deployment, which helps you confirm whether the collection was deployed successfully or if there were issues that need to be addressed.
By following these steps, you can successfully create and verify an NFT collection on the Zora Network using Crossmint.
Create and Mint NFTs on Zora
After create the NFT collection on Zora, the next step is to mint NFTs into this collection.
Mint an NFT on the Created Collection
To mint an NFT on the collection you've created, you'll need to formulate a POST request with the recipient's details and the metadata for the NFT. The example below shows how to mint an NFT to a recipient using JavaScript and the Crossmint API. Replace "your-api-key-here" with your actual Crossmint API key, and ensure you have the collection ID and recipient details ready.
const axios = require("axios");
const mintNFT = async () => {
try {
const response = await axios.post(
"https://www.crossmint.com/api/2022-06-09/collections/{collectionId}/nfts",
{
recipient: "email:testy@crossmint.io:zora",
metadata: {
name: "Crossmint Example NFT",
image: "https://www.crossmint.com/assets/crossmint/logo.png",
description: "My NFT created via the mint API!",
},
},
{
headers: {
"X-API-KEY": "your-api-key-here",
},
}
);
console.log(response.data);
return response.data.actionId; // Keep this ID for status checking
} catch (error) {
console.error(error);
}
};
const actionId = mintNFT();
This code sends a request to Crossmint to mint an NFT with the specified metadata under the created collection. The "response.data.actionId" value returned is important as it's used to verify the status of the mint operation.
Verify the NFT was Minted using the Action ID
After minting your NFT, you might want to check the status of the minting process. The action ID obtained from the response when minting can be used to query the status. The example below demonstrates how to check the status of your minting action:
const checkMintStatus = async (actionId) => {
try {
const response = await axios.get(
`https://www.crossmint.com/api/2022-06-09/actions/${actionId}`,
{
headers: {
"X-API-KEY": "your-api-key-here",
},
}
);
console.log(response.data);
} catch (error) {
console.error(error);
}
};
// Assuming actionId is obtained from the mintNFT function
checkMintStatus(actionId);
This function queries the Crossmint API for the status of an action using the "actionId". It helps in tracking whether the minting operation was successful, still pending, or encountered any issues.
And that's it, you have now successfully created an NFT Collection on the Zora network and also created and minted NFTs on that collection.
Conclusion
In this guide, you learned how to create and mint NFTs on the Zora Network by setting up your environment, creating an API key with the necessary scopes, deploying an NFT collection, and finally minting NFTs within that collection. This process allows you create digital assets into the Zora Network
Create and Mint NFTs with No-code
If you are wondering how you can create an NFT Collection and mint NFTs with no-code, please read the in-depth guide below that teaches you how to do this with 0 code.
Conclusion
In this guide, we walked through the process of creating and minting NFTs on the Zora blockchain using Crossmint. We started by setting up our environment and creating an API key, proceeded to create an NFT collection, and then minted NFTs to that collection. Finally, we verified the success of our actions using the action id. This practical approach equips you with the fundamental knowledge needed to launch your NFT project on Zora efficiently.
What's Next?
If you are wondering how Crossmint has helped enterprises and brands by powering their NFT Drops, you can click on the link below to read all our Case Studies.
If you want to learn how to use the Crossmint to create Web 3 NFT Wallets for your users using their Email Address, please watch the YouTube video below.
Need help?
For support, please join the official Crossmint Discord Server. You can also use Crossmint Help Page for the same.