paint-brush
Provable Random Numbers in Blockchainby@hpbglobal
784 reads
784 reads

Provable Random Numbers in Blockchain

by High Performance BlockchainApril 12th, 2022
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

2022 is shaping up to be recognized as the year of “GameFi” where players can earn cryptocurrency and NFT rewards by competing against other players, progressing through game levels and challenges. Gaming-related projects such as Decentraland, The Sandbox, Axie Infinity, Gala, Enjin, and Illuvium are enjoying massive successes in terms of crypto market share and increasing market cap valuations. Random numbers provide the required “randomness”, allowing developers to make their games and DApps less deterministic, more varied, and reduce repetitive game patterns.

People Mentioned

Mention Thumbnail
Mention Thumbnail

Companies Mentioned

Mention Thumbnail
Mention Thumbnail

Coins Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - Provable Random Numbers in Blockchain
High Performance Blockchain HackerNoon profile picture


“Random number generation in blockchain should be provable and use a verifiably random seed to extract randomness from physical phenomena. In addition to this, RNG should be simple, fast and cheap to implement into blockchain projects”



Blockchain futurists are predicting that 2022 is shaping up to be recognized as the year of “GameFi”, where players can earn cryptocurrency and NFT rewards by competing against other players, progressing through game levels and challenges, and completing various tasks.


Gaming-related projects such as Decentraland, The Sandbox, Axie Infinity, Gala, Enjin, and Illuvium to name just a few, are enjoying massive successes in terms of crypto market share and increasing market cap valuations.


One of the core elements of GameFi are random numbers, and any blockchain gaming project’s ability to generate them for their platforms and applications is critical to their success. Quite simply, random numbers provide the required “randomness”, allowing developers to make their games and DApps less deterministic, more varied, and reduce repetitive game patterns.


Not only this, but Random Number Generators (RNG) can be used for in-game statistics and character traits. For example, a game character may have randomly generated values for speed, strength, defence, damage, weaponry, etc. Random numbers can be used to generate game maps, allowing worlds to appear different each time you play a game. Random numbers can also be used for AI (artificial intelligence) where in-game enemies may take less-predictable actions to make it more difficult for players to progress.


You would not only find the use of random numbers in blockchain-based “GameFi” offerings. They can also be found in mainstream gaming. For example, the globally popular MMORPG game World of Warcraft, uses random numbers to allow the game creators to provide random loot drops which can influence the outcome of a game.


The use-case for random numbers isn’t limited to gaming. Online casinos and lotteries also take advantage of RNG. They can be used for data simulation and modeling, generating encryption keys, random sample selection from large data sets, and much more.


If it is easy to understand the benefits and usefulness of random numbers, then it should also be equally easy to recognize the importance of provable, non-deterministic random number generation methods.


There are generally two main approaches to generating random numbers using a computer: Pseudo-Random Number Generators (PRNGs) and True Random Number Generators (TRNGs).

A PRNG (pseudo-random number generator) is a computer's way of generating numbers that appear to be random but are based on what “seed” was used to generate them. In many ways, a computational seed is a bit like a real plant seed. Everything grows from or is derived from the seed. From the perspective of a PRNG, several mathematical functions and algorithms can be used to generate the seed, and the more complex the functions and algorithms are, the more “random” the seed appears to be.


Unfortunately, PRNG’s nave never be considered truly random. If the seed is derived from a set of mathematical calculations, then by understanding those calculations, you should be able to pre-determine the seed. Admittedly this can prove to be a difficult, or in some instances computationally intensive task, but ultimately a PRNG will never be truly random. There is also the potential for financial risk if a random number generator isn’t truly random. Imagine if an individual or group of hackers were able to pre-determine the random number that would be generated for an online casino or lottery? The consequences could be disastrous.


Therefore, true random number generators (TRNG) are preferred in almost every conceivable scenario. TRNG’s use a verifiably random seed to extract randomness from physical phenomena. Examples of physical phenomena which can be used to extract randomness, are the optical noise found in lasers, or the radioactive decay in atoms. From the perspective of an entirely software-based blockchain, the ability to generate true random numbers has proven to be a challenging task.


There have been solutions available to blockchain developers such as the Chainlink VRF (Verifiable Random Function) solution, which is a working implementation of Sharon Goldberg’s paper on Verifiable Random Function for NSEC5, based on elliptic curve cryptography (ECC). Whilst this is arguably as close to true random number generation as a software-based solution can deliver, it is still noted by Chainlink’s very own admission, that VRF could, at least theoretically, be pre-determined if you have access to the secret key/s from which the seed itself is derived.


The “random” in “verifiable random function” means “entirely unpredictable (uniformly distributed) to anyone who doesn’t know the seed or secret key.”

https://blog.chain.link/chainlink-vrf-on-chain-verifiable-randomness/


From a blockchain developers’ perspective, another challenge faced with using the VRF model is the fees associated with “pulling” a random number from an off-chain source, using an off-chain server (oracle). Requests from an off-chain source require gas fees to be paid for the blockchain on which the random number requesting application exists. In addition to this, there are fees to be paid to Chainlink themselves for providing the VRF service, which are paid in LINK tokens.


Costs of using the Chainlink VRF service vary depending on the blockchain requesting the random number but calling a single random number from Chainlink VRF to the Binance Smart Chain (BSC) currently costs 0.2 LINK, which would equate to approximately $5 USD as of January 2022.


Fortunately, blockchain developers now have a viable alternative for obtaining low-cost, on-chain, provable random numbers, using the High-Performance Blockchain (HPB) solution – “Hardware Random Number Generator” (HRNG) – The solution is based on deriving a seed value from High-Performance Blockchain’s unique Blockchain Offload Engine (BOE) accelerator card.


The BOE card can be thought of as a GPU graphics card, specifically designed for blockchain.


High Performance Blockchain (HPB) - Photo of Blockchain Offload Engine (BOE) accelerator card


Rather than processing computer graphics, the BOE card computes and produces the blocks which form the HPB blockchain. This is the only blockchain in the world which fuses hardware with software to deliver a layer 1, main-net fully Ethereum Virtual Machine (EVM) compatible blockchain.


By processing blocks at the hardware level on the BOE card, the servers (nodes) which form the blockchain have the power to run at lightning-fast speeds (5000tps) at low-cost ($0.0001 per transaction) with high security.


Aside from these advantages, there is also the inclusion of hardware-based encryption and reduced electricity consumption for a server node to mine blocks by “offloading” the block-mining processes from the server (CPU/GPU), to the dedicated hardware chips on the BOE developed specifically for this task.


However, one of the core advantages of the BOE card, is that a random-number seed can be derived from its actual hardware. HRNG senses tiny variances in voltage (as small as 0.00001 volts) utilizing an Analog-to-Digital Converter on the BOE. This ever-changing figure is used to help generate the truly random string of 256 digits and letters added to each new block on the chain.

All nodes that form the structure of High-Performance Blockchain (currently 194 active nodes) are equipped with HPB BOE accelerator cards.


Developers wishing to create DApp’s on the High-Performance Blockchain can retrieve provable random numbers for their crypto projects, completely free of charge.


You are able to see the random numbers being generated on the HPB block explorer HSCAN and you can also find details of generating and incorporating random numbers into blockchain projects on the HPB Gitbook