Deployed sample NFT contract can be viewed on rinkeby.etherscan.io/address/0x0E7121b8aaEBd6F4fAbe13890E33d9E8fD0Fd345
- Have access to the public (public wallet address) and private key to your Ethereum account.
- Have an alchemy account set-up (the free one works!)
- Have an etherscan account.
Hardhat
yarn add hardhat
Dotenv
yarn add dotenv
Ethers.js
yarn add @nomiclabs/hardhat-ethers ethers@^5.0.0
OpenZeppelin
yarn add @openzeppelin/contracts
Alchemy Web3
yarn add @alch/alchemy-web3
Hardhat-etherscan (to verify your contract)
yarn add @nomiclabs/hardhat-etherscan
-
Make a copy of
.sample-env
and fill it outcp .sample-env .env
You should fill out at least the following fields:
RINKEBY_API_URL
,ETHERSCAN_API_KEY
,PRIVATE_KEY
andPUBLIC_KEY
.The
CONTRACT_ADDRESS
field will be filled out after you deploy your smart contract! -
Make any modifications the smart contract in
./contract
and deploy script in./script/deploy.js
-
Compile the contract
npx hardhat compile
-
Edit the deploy script.
Modify
scripts/deploy.js
to include the specific deploy arguments that you want your ERC721 contract to be deployed with. -
Deploy the contract
npx hardhat run scripts/deploy.js --network rinkeby
You should see a confirmation in your terminal like this:
Compiling 1 file with 0.8.0
Compilation finished successfully
Contract deployed to address: 0x...
Check out your newly deployed contract on etherscan.
www.rinkeby.etherscan.io/address/[DEPLOYED_CONTRACT_ADDRESS]
You should update your .env
's CONTRACT_ADDRESS
to be your newly deployed contract address.
If you changed the name of your NFT contract, make sure you update the paths in your scripts contracts/scripts
.
Verifying your contract is important for building trust. For transparency to your users, you should always verify your smart contracts so users can easily inspect the contracts they are interacting with.
Run the following command with your DEPLOYED_CONTRACT_ADDRESS
, the network where it's deployed, and the constructor arguments that were used to deploy it.
npx hardhat verify --network mainnet DEPLOYED_CONTRACT_ADDRESS "Constructor argument 1"
Read this tutorial for more info.
If you want to make a change to the initial base uri you set on deploy, you can update it.
Update the uri
variable in scripts/setBaseURI.js
to your new base uri and run the script.
node scripts/setBaseURI.js
Edit whitelist/giftlist.json
and whitelist/whitelist.json
to include the addresses you want to be each respective 'whitelist'. To set your whitelists, run the following scripts.
node scripts/setWhitelistMerkleRoot.js
node scripts/setGiftMerkleRoot.js
Are you ready to build the front-end? Head over to web
.