Yolodice is Provablyfair. All roll results are generated using a deterministic, pseudo-random algorithm which:

yields high entropy results – which means the results cannot be predicted without knowing the state of the generator,

all subsequent results are determined by the initial state of the generator (“seed”).

The paradigm that is proven to be fair comes directly from the above:

For players, the results cannot be distinguished from random numbers.

At any time the player can “check” if the game is not cheating. This game reveals a random number seed generator so the player can verify whether all the results are OK.

The number generator is seeded not only by random values generated on the server, but also by input from players. In this way the game cannot use previously generated seeds which will produce skewed results.

HMAC with the SHA512 hash function is used to produce roll results. It proves to produce results like random and is well suited to the “Proven fair” paradigm.

In detail – algorithm.

Each player has one active seed at a certain time. The seed determines all results returned by the number generator. Seed consists of a random KK generated by the server and the phrase provided by K_2 users. Phrases created by K_2K users

2

Can only be added to new seeds.

Each roll results are generated according to the following algorithm:

First, the results from the HMACHMAC function are being calculated:

s = \ textit {HMAC} _ {\ rm SHA512} (K, m) s = HMAC

SHA512

(K, m)

where KK is a random 1024-bit key (per-seed) generated by the server and mm is the message that is generated as follows:

m = K_2 \ Vert. \ Vert nm = K

2

∥.∥n

where is K_2K

2

Is a phrase given by a player and nn is a bet bet, i.e. a sequential bet number generated using the given seed. n = 1,2,3 \ ldotsn = 1,2,3 … If the user phrase is “foo bar” and 41 numbers have been generated with seed so far, then the nonce is 42 and the message to be signed is “foo bar.42”.

ss is a 512-bit size value. To map it to the range [0,999 \, 999] [0,999999] converted to hexadecimal format s_ {16} s

16

And the first 5 digits are taken (20 bits). If these numbers form integers in the required range, it is returned. If integers are greater than 999 \, 999999999, the next set of 5 digits (20 bits) is taken. Note that the maximum 5 digit number written in hex is \ mathrm {FFFFF} _ {16} = 1048575_ {10} FFFFF

16

= 1048575

10

. This procedure is repeated until the results are found.

s_ {16} s

16

Consists of 128 digits. In the unlikely event when no valid results are found in the first 25 sets, the last set of digits is taken consisting of 3 hex digits (12 bits) only. The probability of such an event is \ 1,447 \ mathrm {e} {- 33} ≈1,447e – 33.

In the following example s_ {16} s

16

Generated such that the first bit set produces integers outside the range. The second set of 5 digits (20 bits) must be used.

\ underbrace {\ mathrm {F564C}} _ {1 \, 005 \, 132} \ underbrace {\ mathrm {D853D}} _ {886 \, 077} \ mathrm {01A8F} \ ldots

1005132

F564C

886077

D853D

01A8F …

The above algorithm explains the generator function used in YOLOdice and maps:

G (K, K_2, n) \ rightarrow r \ in [0, 999 \, 999] G (K, K

2

, N) → r∈ [0.999999]

This Ruby code sample contains a reference implementation.

KK is always hidden for active seed, but H _ {\ rm SHA256} (K) H

SHA256

(K) is displayed. After the player generates new active seeds, the KK is revealed and the player can verify all bets generated using KK and K_2K

2

.