1 min read

Random dApps 🎲

The real world is unpredictable. You can roll a pair of dice and trust the results are sufficiently random. Sure, you could predict the outcome if you had perfect knowledge of how the dice were positioned in your hand, the exact amount of force applied to throw them, their specific trajectory, and the properties of the table. But that's just not realistic.

Computers can easily predict outcomes. Given the same starting conditions, a computer will always produce the exact same result. So how is it that we can play games of chance on a computer? Even games like Solitaire and Minesweeper wouldn't work without randomness.

Computers generate seemingly random numbers. Without getting too technical, as long as the input is even slightly different, the result can be wildly different. But if someone knows what that input was, they can figure out what the result is before it's been revealed. This can make it easy to cheat sometimes.

Blockchains need randomness to be secure since rewards are given to the randomly selected winner every time a block is produced. For Bitcoin, this randomness is based on real world work. Every computer tries to come up with an input that produces a highly unlikely random output. It's Jeopardy (the game show) where each contestant flips open an encyclopedia and randomly picks words until someone finds the answer. That's the consensus algorithm: Proof of Work.

For other consensus algorithms and any dApp that runs on a blockchain, randomness has to be simulated. However, as we said before, computers can only produce seemingly random numbers. For blockchain in particular, the inputs are publicly visible which can make it easy to cheat if you don't design your inputs correctly. The trick is ensuring that users don't have full control over the inputs.

​

-Luke

​

P.S. Fully on-chain games have to carefully design their inputs so the game can remain fair and fun for all.