This is a repo that shows how to create NFTs with metadata that is 100% on-chain
- NPM & Node.js
Don't commit and push any changes to .env files that may contain sensitive information, such as a private key! If this information reaches a public GitHub repository, someone can use it to check if you have any Mainnet funds in that wallet address, and steal them!
.env
example:
export RINKEBY_RPC_URL='https://polygon-mumbai.g.alchemy.com/v2/your-address'
export MNEMONIC='your mnemonic phrase here'
export PRIVATE_KEY='your_private_key'
export PUBLIC_KEY='your_public_key'
export ETHERSCAN_API_KEY='your_etherscan_key'
export PINATA_API_KEY=your_pinata_api_key
export PINATA_API_SECRET=your_pinata_api_secret
Then you can install all the dependencies
git clone https://github.com/bodasooqa/freaky-goblins-nft
cd freaky-goblins-nft
then
npm install
FIRST OF ALL:
source .env
To begin with, you should put your png in the trait-layers
directory and specify the correct data in the utils/main.py
script and run it.
This script will generate the required images and upload them to Pinata, and also will generate metadata for your NFTs and put Pinata pins in a separate file (utils/data/hashes_to_unpin.json
) so that they can be quickly unpinned, clearing the Pinata space.
This will deploy to a local hardhat network.
npx hardhat deploy --tags goblin
To deploy to testnet:
You'll need testnet MATIC in your wallet
npx hardhat deploy --network mumbai --tags goblin
To deploy to Polygon mainnet:
You'll need MATIC in your Polygon Mainnet wallet
npx hardhat deploy --network polygon --tags goblin
To unpin your images from pinata after uploading use:
node utils/pinata-unpin.js
Use the utils/opensea-polygon-sell-order.scpt
(Apple Script) to set the price for your NFTs on Opensea.
Once deployed, each will look something like this:
You'll need an ETHERSCAN_API_KEY
environment variable. You can get one from the Etherscan API site.
npx hardhat verify --network <NETWORK> <CONTRACT> <CONSTRUCTOR_PARAMETERS>
example:
npx hardhat verify --network polygon "0x0000000000000000" "Freaky Goblins" "GOBLIN" "ipfs://XXXXXXXXXXXXX/" "0x0000000000000000"