Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PRNG - Pseudo Random Number Generator #104

Closed
justjoolz opened this issue Oct 13, 2022 · 4 comments
Closed

PRNG - Pseudo Random Number Generator #104

justjoolz opened this issue Oct 13, 2022 · 4 comments

Comments

@justjoolz
Copy link

justjoolz commented Oct 13, 2022

PRNG - Pseudo Random Number Generator

Grant category

Please select one:

  • Developer tools/services
  • Educational material

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.

  • Target audience

Developers + creators who value transparency.

  • Evidence for the need

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 noodles
range(10,15) returns a random number between 10 and 15

Impact

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

Milestone Deliverables Timeline Risks USD proposal
1 - MVP Implementation with detailed documentation in git repo including usage examples 1 month - 5k
X - Expansion Write a series of in-depth articles showcasing and detailing a variety of possible implementation patterns with their pros+cons 2 months - 10k
X - Maintenance + Adoption Resolving users' issues and providing hands-on support to developers who wish to safely and securely use randomization in their Dapps. At least 3 projects using PRNG on mainnet 3 months - 10k

Total funding proposed: 25k

Team

Name Role Bio Contact
Julian Developer Flow community representative + FlipFest winner [email protected]
@chrisackermann
Copy link

Hi @justjoolz - thanks again for your proposal! We're reviewing and will follow up shortly.

@chrisackermann
Copy link

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!

@justjoolz
Copy link
Author

Hi @chrisackermann - thanks for the great news!

@chrisackermann chrisackermann reopened this Apr 5, 2023
@chrisackermann chrisackermann removed their assignment Jul 3, 2023
@Aliserag
Copy link
Collaborator

Hey Joolz, I have in my database that only the first milestone was completed, given that this was quite a long time ago and changes made with the randomness beacon, I don't think this is relevant anymore. I'm going to close this, please let me know if this is a mistake [email protected].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants