Equally Unpredictable Randomness on Ethereum Virtual Machine: DAO.Casino Implementation

In the core of every successful online casino platform is its ability to maximise unpredictable randomness. The Ethereum world has particularly witnessed the advent of many casino platforms that are experimenting PRNG even at this very moment. The last time we checked, almost a quarter of all contracts on Etherscan were related to gambling. It proves how developers consider Ethereum as this pretty awesome protocol to support gambling games. But does it actually translate into the strengthening of our PRNG systems? Let’s discuss.

Pseudorandomness or PRNG in layman terms means generating the outcomes that cannot be predicted beforehand. In a more practical sense, PRNG signifies the deployment of True Random Number Generation (TRNG) to treat unpredictable physical means — like nuclear decay or atmospheric noise — as the means to generate randomness. Just in the case of Ethereum, these randomness is generated via mathematical algorithms.

Ethereum Virtual Machine (EVM), however, is deterministic. And that is where the challenge of creating an actual random output lies. Now this is obvious to all Ethereum enthusiasts, that its decentralised system deploy applications that run exactly as they are programmed to do so. It makes PRNG a challenge, indicating that we cannot have any randomness in the processing of smart contracts. And if we do manage to get such randomness heedlessly, the network would never get into consensus as to their results.

You can claim that your number is random, but how do you prove it to other players and make sure that you don’t know the algorithm to get the random number before them?

Implementing PRNG on EVM: Is its Possible?

At DAO.Casino, we have been researching and testing PRNG on Ethereum from over an year. Our quest has taken us to many bright minds in the industry — even “mad scientists” — who suggested algorithms and their practical implementation in the world of Ethereum-powered gambling. Down the road, we realise that any great PRNG method must have these two basic features to begin with: decentralisation and speed.

Over the time, these features have become the centrepiece of our gambling protocol, which proposes to create a fair and decentralised socio-economic system for the gambling world. A strong PRNG system is what gives credibility to our project. And implementing such a system on EVM has been nowhere near simple.

Why Decentralisation?

Because it would be more resilient than any other traditional PRNG method. After spending so many times drawing the structure of a decentralised PRNG system on napkins and slides, we finally found a solution that is decentralised and doesn’t use servers — physical and cloud — and implemented it. The solution provides pseudorandomness in seconds, faster than ethereum new block mining, and is ready to be a part of our MVP, though it is still applicable to only two-party games.

Our next stop is to implement a similar method on multiplayer games. And there are few reasons why this task doesn’t scare us. Please read:

  • Crypto-economic systems: Despite its limitations as a deterministic system, EVM offers one thing that could be pretty amazing for generating high-quality pseudorandomness, which is crypto-economic systems. If you add a layer of incentives and counter-incentives to the PRNG method, such that the participating nodes are not economically interested in cheating (they will lose more than they win), then you add a layer of security. Economic incentives and counter-incentives is what makes all the existing decentralised consensus systems tick — notable examples are Bitcoin and Ethereum itself.
  • Make use of fellow Ethereum projects: Ecosystem around Ethereum is evolving at a tremendous pace. Just recently many of the components such as Whisper and Raiden were in the planning stage. Raiden enables state channels — that removes the need to throw all the transactions into blocks. These components are still early days, so we are now focusing on Ethereum-only solutions such as the one we have implemented. But as the time goes by, we will be open towards adding more methods to DAO.Casino protocol. True decentralised and fair gambling industry should have a lot of them, some are better for some games some are better for other games.
  • Making Cheating Irrational: PRNGs can be protected by lowcost bankrolling. Imagine a scenario in which a game takes random values from some economically incentivised actors, who are called bankroll backers in context of the DAO.Casino protocol. The game also imposes strict guidelines — even a ban — for backers who cheat. The game can be programmed in such a manner that its bankroll never becomes big enough to attract cheaters, ultimately branding cheating as some irrational thing to begin with. The beauty of Ethereum is that DAO.Casino can express any logic, and make contracts that do not run “out of gas”, or have weird exploits. We are hell-bent on delivering this feature for a broader adoption.

Have any questions related to DAO.Casino protocol? Feel free to contact us at team@dao.casino or join our Slack channel and drop a Hi.