Many NFT projects have been using whitelists/allowlists to reward their most active community members. The members in this list are allowed to mint...
For further actions, you may consider blocking this person and/or reporting abuse
While this is a great solution, it comes with great cost haha. The gas cost per address is 20k, so it costs around 0.0035 eth per address added, and if you have A LOT of addresses, this will start to become a problem
Thanks for sharing! Do you know a better way to do the whitelist?
Depending on your use case using a patricia tree or using signatures can save a lot of gas.
For example you can create an empty wallet and use itβs private key to sign a message on your backend that your contract can recreate and use ecrecover to check if the address is correct.
Do you know any good resource explaining this? Or maybe a smart contract using this technique?
Patricia tree or signatures?
You can share whatever you can π
bytes32 hash = keccak256(abi.encodePacked(this, msg.sender, quantity, tier));
bytes memory prefix = "\x19Ethereum Signed Message:\n32";
bytes32 prefixedHashMessage = keccak256(abi.encodePacked(prefix, hash));
address signer = ecrecover(prefixedHashMessage, _v, _r, _s);
require(signer == serverAddress, "Invalid signature");
The contract will expect a message signed with contract address, sender address, how many you need to buy and the price tier. Even if the message is intercepted and changed, the sign will be invalid because it will be different than what the server's signed message. For example if the server signed a message with 1 quantity at tier4 pricing, you cannot change the variables to 5 mints at tier1 because the contract side generated hash will be different and transaction will fail.
I'm sure in time we will be able to handle all of these with web3 solutions but for now I think we still need a mixed solution due to gas prices
this sounds pretty interesting. I'm in the process of finishing up my own NFT project and can't afford the gas fee to set up a whitelist. How much cheaper do you think this would come out to relatively?
Ecrecover costs 3000 gas, so it will save 17k gas per adress
Hello, could you also do a little tutorial? Thank you
Sounds great! By any chance would you be able to help me implement this method in my whitelist? I can send you a percentage of sales!
I found another NFT Project, MetaAngels, which should be doing the whitelist in this approach. The contract location is: etherscan.io/address/0xad265ab9b99...
this is great, thank you!! looked this up after the fishy fam fiasco, their contract only checked for the current NFT balance of the WL minter in the WL mint function. so they could just transfer out the tokens and keep minting more. unfortunate, but very easy fix.
thanks to this tutorial, i am confident we will not be facing the same issue in our mint πΈ
Wow! I'm glad you found this helpful. Also, I'd love to know more about your project π
This is a great article. Thank you! I am wondering if this approach is practical if setAllowList() is used within an contract running on Polygon with an allowList array size of ~9000? What interface could I use to input such an array to the instantiated contract? Etherscan seems to have a limit on the size of the array that can be inputted.
Hi sir , I try load this contract in remix . This is step i perform however it doesnt work
1) setIsAllowListActive = true
2) setAllowList - put an address and numallowedtomint =1
The error execption has trriggered
transact to Doodles.setAllowList errored: Error encoding arguments: Error: expected array value (argument=null, value="0x623CD18A2344476063Ee2f806EEdDdbcE9cd5499", code=INVALID_ARGUMENT, version=abi/5.5.0)
Can you pls advise ?
dev-to-uploads.s3.amazonaws.com/up...
Hi Rauf , can you pls advise
Hey! Thank you for this write-up. I'm building a NFT project around mindfulness-based running community, and learning more about smart contracts to add whitelist and tier functions to it (after learning from Hashlips on YouTube).
This might be a stupid question, but I don't see any Whitelists on Doodle's current smart contract. My understanding is that you need to have the addresses with WL access need to be in the smart contract so they can be verified by the owner's contract. Is that because they had it on only for the pre-sale, and removed the addresses from the contract after that? Or is the contract able to retrieve the list of WL addresses out side of the contract code? Much thanks! ππ½
This is amazing π€© Thank You
But I have question
I want ask about the NFT price
How we can make another price for whitelist userβs?
Sorry for the late reply!
You can create two separate
payable
functions. One for public mint and one for the whitelisted members. You can userequire
to check if someone's paying the right amount.Public mint function
Whitelist mint function
Let me know if this answers your question.
How and where do people pay for their guaranteed nft ?