True Random Number Generator

Real time generator [0 - 255] 32 Random numbers per block

Author

TechnoL0g

Specification

The random number generator is based on SmartHoldem's truly random entropy. The SmartHoldem blockchain is used as a source of entropy.

Strong protection against time travelers!

If you discover the winning number at the end of the game, travel back in time, select that number, and the game's result will change to a different winning number.

What is SmartHoldem blockchain entropy based on?

  • The new block's hash is generated using the Merkle tree and depends on all previous blocks and operations within the SmartHoldem network carried out by participants.
  • Any random operation a network participant performs in Blockchain SmartHoldem today affects the hashes of all future blocks.
  • Random ranking of delegates in each round.
  • Operations in Blockchain SmartHoldem are unpredictable and can occur at any time, such as sending transactions, delegate registration, voting, gaming transactions, etc.
true crypto rng smartholdem

Proof of obtaining an independent random number

Every 8 seconds in BlockChain SmartHoldem, randomly ranked delegates generate a unique Hash ID block containing a numerical series of hexadecimal values, for example: d291a92dce4d774285d9d0c4e6e1cc1f765c6e30ca2733f337c80c8af932dfa0.

The resulting hexadecimal Hash of the block is converted into a decimal numeric sequence.

To calculate the current random number, values with the required number of characters are selected from the number series, for example, 2 (from 00 to 99).

The block explorer and Hex to Decimal Bytes Array Converter make it easy to verify all blocks. To do so, copy the block hash into the Hex to Decimal Bytes Array Converter.

Example of sampling a random value from 0 to 99:

  • Block Hash: d291a92dce4d774285d9d0c4e6e1cc1f765c6e30ca2733f337c80c8af932dfa0
  • 10 bytes HEX: 33  F3  37  C8  0C  8A  f9  32  DF  A0
  • Converted number series to DEC: 51243552001213824950223160
  • Two-digit random number based on blockchain entropy: 60

SmartHoldem block structure

id - Hash of the current block (calculated from all data included in the blocks)

  • version - block version
  • height - block height
  • previous - previous block hash
  • forged - information about forging (reward, fee, amount, total)
  • payload - payload, list of transaction hashes
  • generator - delegate who signed the block (username, address, publicKey)
  • signature - signature of the delegate who signed the block
  • transactions - number of transactions in the block
  • timestamp - block time

View in block explorer

Blockchain TRNG SmartHoldem

Provably random, tamper-proof, and low-cost True Random Number Generator (TRNG)

true crypto rng smartholdem

Provably fair RNG

The block data is used as input to generate each random number, confirming that the result is generated fairly and independently of the requester.

Verifiable randomness

Every random result can be verified using cryptographic proofs.

Protection against unauthorized access

You and your users receive unbiased randomization and are safeguarded from compromised third parties.

Simple visual analysis

One way to explore a random number generator is to visualize the numbers it produces. Visualization is one way to get a rough idea of the generator's performance. The images below are parts of larger images created to test the quality of the two random number generators. The picture on the left is made using Blockchain TRNG SmartHoldem, which is a True Random Number Generator (TRNG), and the image on the right is created using the rand() function from PHP in Microsoft Windows, which is a Pseudo Random Number Generator (PRNG).

true crypto rng smartholdem
Blockchain TRNG SmartHoldem
PRNG
PHP rand() in Microsoft Windows

This visual comparison clearly shows how important random numbers are, especially if your app is a game or gambling site. As you can see, the image generated by the PHP/Windows pseudo-random number generator shows clear patterns compared to the image generated by the Blockchain TRNG SmartHoldem true random number generator. True Random Number Generation - Always Random!

How it works: An example of a lottery

Let's devise simple lottery rules: ticket numbers range from 0 to 99, the draw occurs every 2880 blocks, and the winner is the player who guessed the random ticket number.

Before the lottery began, Alice bought a ticket with the number 14, while Bob purchased a ticket with the number 21

When purchasing a ticket, each lottery participant makes a transaction on the SmartHoldem blockchain. The transaction is signed with a unique crypto signature; the ticket number is indicated in the note.

When transactions are added to the block, it receives a unique hash consisting of transactions, the hash of the previous block, and other data.

Every 8 seconds, delegates create a new block. Example block hash: bd082c73...960fbda8

The draw is scheduled in 2880 blocks.

For example, a block has been reached on which the lottery draw should take place d2c6f1ab...cae17f0e

We need to calculate the winning number in decimal notation (DEC) based on the block's hexadecimal (HEX) hash.

00 to 99 is sufficient for us:

  • Block Hash: d2c6f1abc68cbd56aa809a5dc8565237cf0d21aa9537a475526d1867cae17f0e
  • HEX 10 bytes:  a4  75  52  6d  18  67  ca  e1  7f  0e
  • Convert to bytes Uint8Array: 164,117,82,109,24,103,202,225,127,14
  • Let's combine the number series: 164117821092410320222512714
  • Winning ticket number: 14

In this case, the lottery winner is Alice.

Suppose Bob has a time machine. He knows the winning number 14, so he goes back in time and buys a ticket with that number.

“The result will be a completely different hash of the block being played because all hashes of transactions and blocks will change, and the number series will have new values.”

Conclusion

Thus, we get:

  • Full transparency in real time
  • Full entropy for seed
  • Real random number
  • Random numbers are generated every 8 seconds
  • Long sequence of numbers
  • Protection from time travelers
  • Users and block producers create entropy
  • Easy-to-follow rules for working with numbers
  • You can use the RNG API for your ideas without restrictions
  • Wide range of use cases (Raffles, Lotteries, Games, Contests, etc.)

While waiting for the block to be created, other users make random transactions unrelated to the lottery, influencing the Merkle tree's final hash.

Ways to use the entropy of the SmartHoldem blockchain

Use SmartHoldem blockchain entropy to generate a number series as a true random seed.

Default decimal values are available: 0..9, 0..99, 0..255, 0..999 и т.д. до 1.15*10^77 or
115 792 089 237 316 200 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000.

- Get a new hash. If you decide to use the concatenation of the block signer's delegate name (each round delegates are assigned by crypto random) + the block hash, you will get a new hash from them.

- Add crypto functions: crypto.randomInt, crypto.randomUUID, HMAC, Lamport signatures, hashing functions, ECDH, Scrypt.

- Create your own number generation rules using the true random entropy of the SmartHoldem blockchain.