oasisprotocol / oasis-sdk

Official SDK for the Oasis Network.
Apache License 2.0
73 stars 19 forks source link

Add CSPRNG to SDK #205

Open nhynes opened 3 years ago

nhynes commented 3 years ago

ChaCha20 seeded with the Header::encoded_hash should about do the trick, but with a BatchContextRng::reseed for people who have better entropy.

kostko commented 3 years ago

How often do you need entropy? If once per epoch is enough it would be better to use the consensus layer's random beacon for the epoch. Or a mix of the two.

nhynes commented 3 years ago

Me personally? I'm not using randomness. I don't know if other people need more entropy, but reseeding using the random beacon every epoch would get closer to not needing oracular entropy.

kostko commented 3 years ago

Yeah I'm just saying that if the SDK provides such an API it should by default mix in the entropy from the random beacon for the current epoch.