Published in


How To Launch a Generative NFT Collection With IPFS And Avalanche

Using Pinata and Hardhat

Getting Started

mkdir avalanche-drop && cd avalanche-drop
npm init -y
npm i -D hardhat @nomiclabs/hardhat-waffle
npx hardhat

The Smart Contract

npm install @openzeppelin/contracts

Creating the Collection on IPFS

npm i -g pinata-upload-cli
pinata-cli -a YOUR_JWT_HERE
pinata-cli -u ./Pinnies
const fs = require('fs');const imageDir = fs.readdirSync("./Pinnies");imageDir.forEach(img => {
const metadata = {
name: `Pinnie ${img.split(".")[0]}`,
description: "A Pinnie in the Limited Pinata Family Collection",
image: `ipfs://FOLDER_CID/${img.split(".")[0]}.png`,
attributes: []
fs.writeFileSync(`./metadata/${img.split(".")[0]}`, JSON.stringify(metadata))
pinata-cli -u ./metadata

Deploying the Contract

require("@nomiclabs/hardhat-waffle");const AVALANCHE_TEST_PRIVATE_KEY = "PRIVATE_KEY_FOR_FUJI";module.exports = {
solidity: "0.8.0",
networks: {
avalancheTest: {
url: '',
gasPrice: 225000000000,
chainId: 43113,
npx hardhat compile
npx hardhat run --network avalancheTest scripts/deploy.js


npx hardhat run --network avalancheTest scripts/mint.js
npx hardhat run --network avalancheTest scripts/tokenUri.js

Wrapping Up



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store