• Homepage •
Supported protocols •
Chainstack blog •
Chainstack docs •
Blockchain API reference
•
Start for free •
This project contains all tutorial files from the How to mint a music NFT: Dropping fire tunes with Chainstack IPFS Storage tutorial, originally published on the Chainstack Developer Portal: Web3 [De]Coded.
This repository contains scripts and contracts needed to create a new wallet, check its balance, compile an NFT contract, and mint music NFTs using pre-set metadata on the Ethereum network with Chainstack IPFS Storage, Hardhat and Web3js.
- Clone or fork this repo to a preferred location by running in CLI:
git clone https://github.com/chainstacklabs/music-nft-minter-tutorial-repo.git
- Install dependencies by running in CLI:
npm ci
- Rename
.env.sample
to.env
and fill in your endpoint URLs for each network, then your Chainstack and Etherscan API keys:
GOERLI="https://your-goerli-endpoint-here"
SEPOLIA="https://your-sepolia-endpoint-here"
MAINNET="https://your-mainnet-endpoint-here"
CHAINSTACK="Bearer y0urChainstackAPIkeyHer3"
ETHERSCAN="Y0URETHERSCANAPIKEYHER3"
- Generate a new wallet address key pair and fund it from the Chainstack $NETWORK faucet by running in CLI:
npx hardhat run scripts/wallet.js --network $NETWORK
- Check wallet balance by running in CLI:
npx hardhat run scripts/balance.js --network $NETWORK
- Deploy the NFT minter smart contract from the ABI & BIN files by running in CLI:
npx hardhat run scripts/deploy.js --network $NETWORK
- Pin all media files and JSON metadata with Chainstack IPFS Storage by running in CLI:
npx hardhat run scripts/pin.js
- Mint an NFT with the metadata from the pinned JSON file by running in CLI:
npx hardhat run scripts/mint.js --network $NETWORK
- .env.sample - Sample Dotenv file containing pre-formatted slots needed for key script variables
- contracts/MyFirstMusicNFT.sol - Smart contract supporting functions to mint NFTs with custom tokenURI
- src/ - Sample media files and metadata JSON you can use to test minting
- scripts/wallet.js - Script to generate a wallet address and key pair
- scripts/balance.js - Script to check the balance of a wallet address
- scripts/deploy.js - Script to deploy the NFT minter smart contract from the ABI & BIN files
- scripts/pin.js - Script to pin relevant media files and JSON metadata with Chainstack IPFS Storage
- scripts/mint.js - Script to mint an NFT with the metadata from pinned JSON metadata file