Open justjoolz opened 1 year ago
Hi @justjoolz - thanks again for your proposal! We're reviewing and will follow up shortly.
Hi @justjoolz - thanks for your patience! Just wanted to let you know that we've accepted this submission and will be following up directly with next steps. Thanks!
Hi @chrisackermann - thanks for the great news!
PRNG - Pseudo Random Number Generator
Grant category
Please select one:
Description
A fully on-chain pseudo-random number generator written in Cadence and an off-chain Javascript equivalent that uses the exact same seeding mechanism (blockHash mixed with resourceID) and hence replicates the same stream of random data.
Problem statement
Using randomness is a big part of many NFT drops (randomized traits) and it's usually always done off-chain. This means it's harder to achieve transparency (most projects don't even attempt to). Also, it's prone to manipulation as has happened to several of Dapper's products.
Developers + creators who value transparency.
15 posts on the forum mentioning randomness: https://forum.onflow.org/search?q=random and plenty in discord too, a very common question with no solutions
Off-chain randomness exploits:
https://blog.nbatopshot.com/posts/elite-pack-distribution-audit https://blog.nflallday.com/posts/update-rams-team-nft-drop https://nftevening.com/dapper-labs-hand-out-free-nfts-after-their-ufc-drop-is-a-total-disaster/
Proposed solution
A resource-based PRNG that lives in its own contract and can supply a stream of randomness from a provided initial seed.
Including helper functions for picking numbers in more useful and dev-friendly ways than unsafeRandom provides.
ie.
pickFrom(["sandwich","noodles", [1,9] )
one in ten chance I get a sandwich, 9/10 noodlesrange(10,15)
returns a random number between 10 and 15Impact
This will allow developers to use randomness in their contracts in a far safer and more versatile way than is currently offered.
Milestones and funding
Total funding proposed: 25k
Team