How ZKasino will handle randomness on StarkNet

Motivation

Getting a random number on a blockchain, such as StarkNet, is a tricky feat. The deterministic and public nature of a blockchain inherently removes the possibility of randomness. In order for a distributed network of nodes to verify the transactions in a block, these transactions have to be exactly the same. These transactions also have to be available to each node at all times. This makes any potential random generating algorithm transparent and thus predictable.

What is verifiable randomness and why is it important?

A Verifiable Random Function (VRF) is an algorithm that provides a pseudorandom number and a signature that can be used to prove that the given number was computed in a fair manner. VRFs are a popular method to provide random numbers in smart contracts as they leverage an existing random number generator from outside the blockchain and the results can be verified on a smart contract.

Using Drand as a VRF in our casino

With Drand providing publicly verifiable randomness, we constructed the following architecture for a casino game:

A dApp using our VRF

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
ZKasino

ZKasino

246 Followers

Decentralized Casino Built on Layer-2 ZK Rollup StarkNet.