Baking Randomness into The Mix

DAPP Network
The DAPP Network Blog
4 min readMay 27, 2019

--

Why On-Chain Random Number Generation is So Hard — and So Essential

Humanity has been searching for reliable sources of randomness since the Chinese first formalized the use of yarrow stalks as a means of divining a person’s fate. Nowadays, random numbers are generated programmatically, either by measuring natural sources of randomness or by mathematical algorithms which yield pseudo-random numbers. Despite coming a long way from the primitive techniques of our ancestors, a random number generation still has one more leap forward to make. Blockchain applications such as simulation techniques, gambling dApps and the encryption of sensitive data demand a random number generator (RNG) that is both efficient and decentralized.

TRNGs and PRNGs

When Alan Turing designed a randomness feature for the Ferranti Mark 1 in 1951, he harnessed electrical noise to deliver a 20-bit long random number. An example of a true random number generator (TRNG), the output of the Mark 1’s built-in randomness generator could have been achieved by measuring other physical phenomena such as atmospheric noise, thermal noise or radioactive decay. However, programmers who wished to reproduce results reached by their peers required a system that would behave in a consistently repeatable way. Enter the pseudo-random number generator (PRNG), a system based on deterministic math functions that deliver a series of random numbers but returns the same results when running under the same initial conditions, or “seed.” Programmers could now reproduce simulations with a high degree of consistency.

The Need for Randomness is A Certainty

Although ancient cultures related chance to the fate of individuals and nations, modern applications of random number generators extend beyond clairvoyance. RNGs are essential in areas such as digital gambling applications, data encryption and computer simulations, among others.

Gambling: Digital games of chance such as blackjack, poker and roulette depend on robust sources of randomness to ensure that the outcome of each spin or hand is fair and that no player can gain an unfair advantage by predicting the results in advance.

Encryption: Sensitive data such as medical and financial records cannot live on a transparent blockchain without being encrypted first. Successful encryption methods require a secure source of randomness in order to generate a key with which data can be initially encrypted and later decrypted by users with the correct permissions.

Computer Simulations: Today’s scientists make use of simulation methods to reach statistical conclusions regarding the set of all possible outcomes. Monte Carlo experiments, a broad set of methods that rely on a repeated random sampling of data points, are used, to model financial derivatives, forecast weather and predict the energy output of wind farms.

On-Chain Randomness — Why Is It So Hard?

Whether it is used to encrypt patient data within a healthcare application or as the cornerstone of a gambling dApp, an effective random number must have certain desirable properties that ensure the quality of the generation process. For starters, the generated number must be unpredictable and must contain uncorrelated sequences such that one cannot take a given stretch of numbers and use them to predict any subsequent numbers. Additionally, blockchain-based RNGs should not compromise the decentralized characteristics of the applications they power. Centralized RNGs, whether they’re true RNGs relying on natural phenomena or pseudo RNGs that utilize mathematical algorithms, are dependant upon a single entity, introducing an element of trust into an otherwise trustless system. A multi-participatory RNG which includes a variety of entities in the generation process is essential to upholding the properties of decentralized applications.

The oldest pair of dice were discovered in a Middle Eastern cave and date back to the 24th century B.C. Since then, the sophistication of our randomness-generating methods has grown in leaps and bounds. Computers enabled us to capture the unpredictability inherent in the natural process to derive true random numbers and simulate randomness by seeding mathematical algorithms to generate pseudo-random numbers.

Yet, for RNGs to progress into the blockchain era, current techniques must be enhanced with decentralization in order to ensure that the integrity of dApps is not compromised. Incorporating trustless qualities into the random numbers generated by both TRNG and PRNGs will grow trust in games, power trustless computer simulations and enable private, encrypted data to exist on chain for the very first time.

The DAPP Network harnesses a distributed ecosystem of DAPP Service Providers to provide critical utilities for developers building EOS applications. Join LiquidApps’ Telegram group to find out exactly how DSPs are powering the next-generation of RNGs.

--

--

DAPP Network
The DAPP Network Blog

DAPP Network aims to optimize development on the blockchain by equipping developers with a range of products for building and scaling dApps.