#Random number generator

1 messages · Page 1 of 1 (latest)

toxic beacon
#

I need random numbers in smart contract. Previously I saw @zealous loom were suggesting
"As to your concrete question, you can safely rely on the entropy of the epoch seeds (see Mina.getNetworkState), which are protected by consensus and seed the VRF used for slot leader selection (can’t get any more secure than this)."
#1210200684922798090 message

I see this.network.stakingEpochData.seed field, but as I can understand it is updated once on epoche start.
Is there some random values per slot?

prisma lynx
#

I guess you want something that is not predictable before that block exists?

#

Otherwise just hash the staking epoch data plus the slot number

toxic beacon
#

We can't use block hash for that because it can be easily manipulated. But I saw the response with "entropy of the epoch seeds" and was interested if we can use that.

zealous loom
#

@toxic beacon combine them

toxic beacon
zealous loom
#

Block ashes in mina are unpredictable due to the combination of the market activity, recorded inside of the block, as well as the epoch seed recorded for the entire epoch

zealous loom
#

Source any additional entropy thru interaction with the contract

toxic beacon
zealous loom
toxic beacon
zealous loom
toxic beacon
valid trail
#

Tagging @tall pasture as well, there is a team who will be focusing on this one - any input would be helpful.

zealous loom
tall pasture
#

Hey, as @valid trail stated, there is another team who will get randomnes fromm Drand- Distributed Randomness Beacon. Regarding your question - Using the epoch and an additional 'random' number can work as well right ? I haven't thought about mathematical analysis of it but if you get get the data from epoch and also add somethings from user (not a manual input necessarily, but a signature that is again somehow created by user with a random message in the process) can work as increasing the entropy.

toxic beacon
zealous loom
#

Yep, the other teams in the space need all the luck they can get.

#

If you haven’t thought about the mathematical analysis, keep your hands out of the code, and don’t ever ever ever put your money into a Mina smart contract.

toxic beacon
tall pasture
crystal swan
#

is there a way to generate a random number but restricting it to a set of Field? e.g Field(1) .... Field(20)

prisma lynx
crystal swan