A 100% fair Ethereum-based mechanism for generating sets of random numbers for online gambling

FireLotto
3 min readOct 1, 2018
Firechain 3.0

How it works

At the beginning of a game session, the server generates a private 256-bit key to the game session by generating private keys to the Ethereum wallet, which ensures the key’s strength and its unpredictability for the client. After that, a public key is created as a hash of the server private key and sent to the client. At the end of the session, after receiving the server private key, the client can check its authenticity by using the public key. In order to get a new random number from the server, the client generates its own random number which is unknown to the server (the client seed) and sends it to the server along with the minimum and maximum values of the random number being requested. While client seeds are generated and sent automatically, the player can see the random number being sent and change it if desired. Next, the server sends the random number received from the client, the range of the number being requested, and its own private key to the Ethereum smart contract, where a new random number is generated from the server secret key, the random number range, and the client’s random number using the following equation:

PublicRandomResult[i] = Hash(ServerSecretHash[i-1], ClientRandomSeed[i]) % (Max[i] — Min[i] + 1) + Min[i];

The value obtained is sent to the client. This value is the pseudo-randomly drawn number for this step of the game. Unpredictability and the big length of the hash (256 bits) ensure that random numbers are normally distributed. The server secret key to the next request is generated by the Ethereum smart contract as a hash of the previous private key and the current result:

ServerSecretHash[i] = Hash(ServerSecretHash[i-1], PublicRandomResult[i])

This is the way in which a chain of blocks is made where each secret hash is influenced by the initial server key, client random numbers, random number ranges, and results. In such a mechanism, both the initial server key and the sequence of client random numbers and their ranges determine game results. The inclusion of random number ranges into input data ensures that random numbers drawn are interpreted definitively. At the end of the game session, the client receives the private key to the game session and the entire game history. The player can send the history to the smart contract and the smart contract will confirm that the random numbers were generated according to the rules described above and the code of the smart contract itself, which means that the server could not tamper with the results and the client could not predict them either.

Transparency

The server affects game results only by generating a secret key at the beginning of the game session. The server does not know in advance what random numbers the client will send, so it cannot tamper with the results. The audited open-source smart contract acts as a pseudo-random number generator using the server key and client seeds, and it also acts as a decentralized auditor which ensures that the sequence or game results is calculated according to the rules and the smart contract code. After the end of the game session, all the server secret keys become available to players in the server statistics. The player can check if the game was fair. The player in their turn cannot predict the outcomes of the game because he or she does not know the server secret hashes and receives only the resulting hashes after sending the data to the server. It is impossible to calculate the initial data using the result of the hash function.

Advantages

This mechanism allows users to play instant win games without delays or commissions. The smart contract generates random numbers and server secret hashes and audits game sessions without adding entries to the blockchain, which means that no gas is required and there are no charges for the game. The mechanism is perfect for any type of gambling games as it can generate a chain of random numbers for an almost infinite game session.

Patented mechanism! Will use it:

Blockchain lottery Fire Lotto

Blockchain poker room Cash Poker Pro

--

--