Skip to content

nghdavid/NFT-Whitelist

Repository files navigation

NFT whitelist

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.

Main Features

  • 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.

Smart contract Technique

  • Merkle tree
  • EIP-191 signature
  • ChainLink VRF
  • ERC721

Backend Technique

  • Ethers.js
  • Express.js
  • Openzeppelin/merkle-tree

Demo

  • Mint by signature

signature

  • Mint by proof (Merkle tree)

merkle

How to start my project

  • 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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published