I would like to create a gambling Dapp and for this I need a provably fair RNG. What are the best solutions for provably fair randomness in Cardano
Will Cardano add Chainlink VRF in the future?
I would like to create a gambling Dapp and for this I need a provably fair RNG. What are the best solutions for provably fair randomness in Cardano
Will Cardano add Chainlink VRF in the future?
Have you checked genSeed
function from Cardano.Crypto.VRF.Praos
module?
This module is the Haskell implementation of libsodium
, the library used by Algorand and Cardano to generate Verifiable Random Functions (VRF), which are key at the time of randomly choosing validators in both chains.
For The Open Source Cardano Lottery, I have created a pseudo random number onchain validator that uses parts of a tx id for the source of a random number. I am open to any feedback on this approach, but from what I have tested, I can't guess what the winner lotto ticket number will be in advance :)
It depends on the use case, but nut.link has been submitting the League of Entropy randomness beacon.
Getting randomness into smart contracts is a bit difficult on Cardano due to it's deterministic nature. In some cases, committment schemes can be used: https://www.youtube.com/watch?v=JXKf1JwVAOE which rely on the one-way property of hash functions. In this example, it's applied to a game between two parties, which are real competitors, so neither of them wants to reveal their secret information to the other and the outcome is indeed random. This doesn't work when the different parties might have some incentive to cooperate (e.g. against the operator)
One can also "collect entropy" from multiple parties as it was done here: https://github.com/input-output-hk/lobster-challenge
One can use a RNG oracle, but still has to deal with the determinism. So even if it's a perfectly fair random number, the gambler might just decide not to play (=submit their tx) in case they would loose. Maybe one can overcome it with validity intervals for tx and penalties for not submitting a tx, but it has some obvious drawbacks.