This is the back end to Nifty Minter, a dapp that uses AI to generate images for your NFTs and then goes ahead and mints it on the Goerli testnet.
npm install
- Run blockchain node with ganache
npm run ganache
- Add the network to MetaMask and import the ganache accounts
- you can change the port and chain ID in the package.json scripts,
but by default the RPC URL is
http://127.0.0.1:9002
, the chain ID is1338
, and the currency symbol isETH
.
- Deploy NFT contract to local blockchain
-
If the front end and back end repos are adjacent to each other, then the NFT ABI will automatically be written to the front end. Otherwise you'll have to change the file path in
common/tokens.js
.npx hardhat run scripts/deploy.js --network ganache
- Then you'll need to copy the outputted NFT address from the previous
command and update the NFT address in the front end file
src/config.json
-
Optionally, you can view the ganache/hardhat accounts' Ether balances with this command
npx hardhat run scripts/getBalances.js --network ganache
- See the front end for starting the web server
- Configure API keys in your
.env
PRIVATE_KEYS="{private key for the account your deploying with}"
ALCHEMY_API_KEY="{get key by creating a project with Alchemy}"
ETHERSCAN_API_KEY="{do the same with etherscan}"
- Deploy to Goerli or whichever network
npx hardhat run scripts/deploy.js --network goerli
- Verify Contract
npx hardhat verify {copy contract address from previous command} '{Name of your dapp}' '{Symbol}' '{Fee cost in wei}' --network goerli