1

Trying to figure out how to do the following. I wouldn't need the code, just an understanding of viable methods as I can't locate an answer.

An NFT minting process for 2,000 NFTs. IDs from 0-9 would be 'legendary' NFTs. What I'd like to do, is have each minter try their luck getting an ID from 0-9 first. If it fails, to then mint from the #10-1999 set of tokens.

I was hoping for it to work like this:

1 - get a random number between 0-1999

2 - if it falls between 0-9, I can mint the next available token between 0-9 (if there's any left)

3 - if it doesn't just mint the next available token between 10-1999.

Chainlink - This seems to be a two-call process, so I can't generate the randomness on the fly.

Pseudo-randomness - I've seen the standard random number option, using keccak256 but I understand this to be predictable for miners?

Can I use Chainlink's fulfillRandomWords callback to mint the token, considering I'd generate a random number 2000 times?

Are there any other options available to me?

2 Answers 2

2

The best practice you can implement Is to use Chain Link VRF V2 , for creating randomness. It will help you to create pure random numbers. But remember it will cost you link token as gas-fee. Bcz chain link is not free.

Don't use keccak256 for generating randomness because it is predictable.

Watch this video first , so that your concert of creating randomness with Chainlink clear. https://youtu.be/ndKOnPfFrvQ

2

I wrote a post using three different alternatives to create vrf numbers (Chainlink/API3 or Witnet). There is also a repo with the demo code. https://medium.com/coinmonks/schedule-randomness-with-gelato-and-witnet-api3-chainlink-vrf-1ebc0aac37d

Hope it helps!

Your Answer

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

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