Stargaze: Create an NFT Collection Using IPFS and Stargaze
This guide was originally published on https://docs.filebase.com. Check out the Filebase documentation site for the latest Web3 tutorials using IPFS through Filebase.
Learn how to create an NFT Collection using IPFS and stargaze.
What is Stargaze?
Stargaze is the first interoperable layer-1 network for NFTs, providing features such as zero gas fees, a native NFT launchpad and marketplace, and interoperability with the Cosmos and Ethereum networks.
Read below to learn how to create an NFT Collection using IPFS and stargaze.
Prerequisites:
- Install Node.js and npm.
- Download and install an IDE of your choice, such as VSCode.
- Sign up for a free Filebase account.
1. Start by opening a new terminal window. Run the following commands to clone the Stargaze public tools and create a new project:
git clone https://github.com/public-awesome/stargaze-tools stargaze-filebase
cd stargaze-filebase
yarn install
2. Create a testnet account with the command:
yarn account
Copy the output of this command, you will need it in the next step.
3. Make a copy of the config.example.js
file called config.js
.
Open the config.js
file and fill in the mnemonic and address fields with the information from the previous command’s output.
//// ACCOUNT INFO ////
// The account seed phrase to use for deployment
mnemonic:
'enlist hip relief stomach skate base shallow young switch frequent cry park',
// Your STARS address
account: 'stars1...',
4. Receive some testnet funds by joining the Stargaze Discord server and requesting testnet stars in the #faucet channel.
5. Next, we need to create an IPFS bucket on Filebase.
To do this, navigate to console.filebase.com. If you don’t have an account already, sign up, then log in.
6. Select ‘Buckets’ from the left sidebar menu, or navigate to.
Select ‘Create Bucket’ in the top right corner to create a new bucket for your NFTs.
7. Enter a bucket name and choose the IPFS storage network to create the bucket.
Bucket names must be unique across all Filebase users, be between 3 and 63 characters long, and can contain only lowercase characters, numbers, and dashes.
8. Now, upload your NFTs to Filebase using the web console and selecting ‘Folder’, then select the folder that contains your NFT files.
These files need to be named in sequential order, such as 0.png, 1.png, 2.png, etc.
You may also include metadata.json files in this folder, if desired. The .json file for each NFT should be in the format:
{
"id": 0,
"description": "Filebase NFT",
"external_url": "https://forum.openzeppelin.com/t/create-an-nft-and-deploy-to-a-public-testnet-using-truffle/2961",
"image": "https://ipfs.filebase.com/ipfs/IPFS_CID",
"name": "My Filebase NFT 0"
}
9. You will see your folder uploaded as a single object:
10. Copy the CID of your folder:
11. Navigate to your IPFS Folder using the Filebase IPFS gateway to see your folder’s files:
https://ipfs.filebase.io/ipfs/IPFS_CID
12. In your config.js
file, configure the following lines to reflect your NFT collection’s information:
//// COLLECTION INFO ////
// The name of your collection
name: 'Collection Name',
// The 3-7 letter ticker symbol for your collection
symbol: 'SYM',
// Project description
description: 'An NFT Collection',
// Link to image to use as the main image for the collection.
// Either IPFS or valid http links allowed. Gif compatible.
// (at least 500 x 500 pixels)
image:
'ipfs://IPFS_CID/1.png',
Replace IPFS_CID
with your IPFS folder’s CID that you copied previously.
13. Then, configure the following lines to determine mint price, number of NFTs allowed per wallet, and other factors:
//// MINTER CONTRACT ////
// The base URI to be used to programatically mint tokens
baseTokenUri: 'ipfs://...',
// The number of tokens to mint
numTokens: 100,
// The price (in STARS) for your NFTs (minimum 50 STARS)
unitPrice: 100,
// The max amount of NFTs an address can mint
perAddressLimit: 1,
// The date when the sale goes live
// If whitelist is enabled, only whitelisted addresses will be able to purchase
// startTime in ISO format
startTime: '2022-03-11T21:00:00.000Z',
// The minter contract address
// Get this after running `yarn minter`
minter: 'stars1...',
// SG721 contract address
// Get this after running `yarn minter`
sg721: 'stars1...',
14. Save your configuration file.
15. To whitelist an address or list of addresses, use the following command:
yarn whitelist --add 'address1,address2,address3,...address100'
16. Next, get your minter’s contract using the following command:
yarn minter
Then, copy the first contract_address
value, and input it for the minter contract address, then copy the second contract_address
value and input it for the SG721 contract address in the config.js
file:
// The minter contract address
// Get this after running `yarn minter`
minter: 'stars1...',
// SG721 contract address
// Get this after running `yarn minter`
sg721: 'stars1...',
17. To mint an NFT to a specific address, use the command:
yarn mint --to [address]
This will mint the next sequential token ID to the specified address.
18. To verify that everything is working as expected, you can view testnet transactions using the Stargaze testnet explorer.
19. If you’re ready to launch this project on the Stargaze mainnet network, you can follow this tutorial.
Want to learn more about Filebase? You can sign up for a free account today to get started with IPFS.