1

I am trying to do an NFT launch via email. I have a basic NFT smart contract that I'm ready to deploy. I also have a react app with metamask connected and a button for the end user to mint an NFT. My NFT and react minting site is based on this code https://github.com/angkushsahu/Robopunks.

I have a list of whitelisted people but I only have their email addresses. How can I make it so only people that I email an invite to can mint an NFT? Does anyone have a tutorial or codebase I can reference?

2 Answers 2

0

You got a few options. No judgement.

  1. You can use a special website with one-time codes. Mail one code to each email customer. And that can directly mint.
  2. You can use a special website with one-time codes. Mail one code to each email customer. And that will use an on-chain mint pass to prepare them for minting.
  3. Deploy your smart contract but don't announce it. Then mail your email list and ask them to buy but to not tell anybody until a certain time.
1
  • 1
    I went with option 1. Commented Jun 22, 2022 at 2:07
1

I would go with the pre-signed ERC-191 style transactions https://eips.ethereum.org/EIPS/eip-191.

When minting, the user can then input their email into the form that you hash (in order to have a fixed-length access control) and you pass that hash along with the v, r, and s values to the mint call.

Let me break it down, to explain better:

  1. Create a script that will hash the email addresses from your whitelist.
  2. Use the hashes in another script that generates the v, r and s values and maps them to each hash in a JSON format:
{
  "EMAIL_HASH":{
    "STRUCTURE_ID":{
      "r": R_VALUE,
      "s": S_VALUE,
      "v": V_VALUE
    }
  },
  "SECOND_EMAIL_HASH":{
    "STRUCTURE_ID":{
      "r": R_VALUE,
      "s": S_VALUE,
      "v": V_VALUE
    }
  },
  .
  .
  .
}
  1. Send out the email inviting the people to mint.
  2. The form should accept their email, hash it, match the hash to the json and pass the values to the mint function.
  3. The mint function should use the ecrecover to validate that the values are correct.
  4. Remember to set up access control that only allows one claim per hashed email if you don't want to allow for infinite minting.

This Medium post has been a good reference when I first used the approach: https://betterprogramming.pub/handling-nft-presale-allow-lists-off-chain-47a3eb466e44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.