I am thinking of developing small DApp where user would collect cards (NFT). Each card would have some image and value associated with it. User collects cards by purchasing Pack of Five Cards which user can open and get 5 random cards of different value. Some cards would me more rare than others... This would create marketplace where users can buy/sell cards...

The problem I have is how to generate these random cards. I read a lot about randomness on blockchain and how it can be exploited so I have few options.

Optiona A:

Use Chainlink's VRF which gives me number like this:

60 281 005 833 581 254 158 276 701 724 503 448 998 474 868 621 179 906 924 992 243 038 007 226 057 672

Which has 77 digits (I am not sure if this is always the case, but testing on kovan network it seems it always has 77 digits). I can use these group of 3 digits which will give me random card... But this way user is limited to buying max 5 (or less) x Packs of Five Cards... I need to use group of three digits or more depending on how many cards are there in a set and different cards would have different weights so I would use those weights to pick random card from set.

Option B:

User approves some stable coins to contract address via MetaMask, and calls my backend which in turns has private keys to contract and backend picks all random cards and just sends instructions to contract to mint new NFTs and assign them to user who bought it...

But in this approach I need to pay for gas fees, and also I suppose that gas fees would be high for creating like 100 tokens at once (if user bought 20 Packs of Five Cards)

Option C:

I don't know if this is possible, but is there a way to create contract on Chainlink node, which would generate as much random numbers as needed... I would still limit users to buy max 10 packs, and chainlink contract would in return generate max 50 random numbers in range 1 and 1000 (or a bit more depending on sum of all weights of cards in set) and return them to my contract which would then mint these NFTs...

Is there any other way how to implement this. And also I suppose Option B would create some negative comments since that would be outside of blockchain and it won't be transparent...

  • There's no best tool for everything. Ethereum is an environment constantly changing. Try the different approaches and decide with testing.
    – Ismael
    Commented Apr 10, 2021 at 3:31

1 Answer 1


We're trying to find what you're trying to develop...

Considering NFTs have finite editions, meaning you would mint 10000 editions of 5 cards in each, you would have to pre-program amount of highest value cards (out of total 50000), the mount of second most valuable (out of total 50000) and so on. Kinda like lottery scratch cards, there would be ideally only 1 1st prize, printed on one card at the start.

If you let blockchain do it upon purchase, you might never generate the card with highest value.

Not helpful, but if you make it work or find some APP or DAPP that does that, give me a shout.

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.