NFT whitelist showcases two methods for granting whitelists to users in the context of NFTs. It also utilizes secure random number generators provided by ChainLink VRF to mint NFTs randomly.
- Website Link
- NFT Backend code
- This NFT is deployed on Arbitrum Sepolia testnet
- Efficient Gas Usage: Save whitelists in a Merkle tree to reduce gas costs.
- Flexible Whitelist Issuance: Issue whitelists to users with EIP-191 signatures.
- Tamper-Proof RNG: Utilize ChainLink VRF to prevent manipulation of the random number generator by hackers.
- Merkle tree
- EIP-191 signature
- ChainLink VRF
- ERC721
- Ethers.js
- Express.js
- Openzeppelin/merkle-tree
- Mint by signature
- Mint by proof (Merkle tree)
- Claim ETH and $Link from Alchemy and Chainlink.
- Fill in .env (private key, arbitrum sepolia rpc url, etherscan api key).
- Run generate_merkle_tree.js to calculate a root value.
- Create VRF2.5 subscription and get subscription id.
- Change parameters of constructor in script/NFT.s.sol.
- Install foundry.
- Run: forge install smartcontractkit/chainlink
- Run: forge install OpenZeppelin/openzeppelin-contracts
- Run: source .env
- Run: forge script script/NFT.s.sol:NFTScript --rpc-url $SEPOLIA_RPC_URL --broadcast --verify -vvvv
- Add the consumer (address of the NFT just deployed) to your subscription.