Share this

Last Updated: July 2, 2020

On This Page

Roulette (Encrypted Version)


This page is about the encrypted version of roulette, often played at casinos that are based in cryptocurrency. I assume the reader is already familiar with the basic rules of conventional roulette.


In the case of the game at Crypto.Games, roulette is played on a single-zero wheel, as is usually the case with online casinos. The house edge is 1/37 = 2.70% on every bet.

Fair Gaming

The following explanation of how cryptography is used assumes the reader has some familiarity with the terminology and concept. For the basics, please see my page on Dice (encrypted version). Here is how the roulette game at Crypto.Games produces a random number from 0 to 37, which is used as the outcome of the game.

  1. As should always be the case, the game discloses the Hash of the Server Seed for the next bet and lets the player choose his own Client Seed.
  2. The player makes bets, as in conventional roulette.
  3. The game will combine the Server and Client Seeds, in that order.
  4. The game will take the SHA-512 hash of the combined seed from step 3.
  5. The game will convert two characters of the Hash, starting from the left, from step 4 from hexidecimal to decimal.
  6. Take the terminal two digits of the decimal number from step 5.
  7. If the result from step 6 is 0 to 36, then use it as the roulette outcome.
  8. If the result from step 6 is 37 or greater, then advance two positions in the Hash and go back to step 5.


roulette 1

First, I go to the Fair Gaming screen above. Then enter any Client Seed you wish, a random jumble of characters will do. Then, you should copy and paste two things to another source:

  • Your Client Seed
  • The next Server Seed Hash, which it labels the "Next server seed SHA256."

It is up to you if you want to add a Nonce, which are extra automated characters added to the end of the Client Seed. I believe if the casino had the intention to cheat, adding a Nonce wouldn't offer any protection.

In our example, this is the evidence you should preserve.

Next server seed hash = e7043dd7fe369b94518449d61162a0c960f54781a16548af63194b7fd9d6891a
Client seed = b0x6vb0v6TYUIQWF6b0sd6f0y


roulette 1

Next I made a bet, as shown above. Here I bet 10 chips, each worth 0.000001 BTC (Bitcoin) for a total bet of 0.00001 BTC (the equivalent of about 10¢) on the color red.

roulette 3

The outcome is 7 red, so I win.

roulette 4

Next, I go through the following steps, to verify the outcome. In real life, I would only fuss with this on a losing outcome. If the casino wished to cheat, I probably would have lost.

  1. I join the Server Seed and Client Seed, in that order: sMDGT5P10m071HAdTQkoYCLJ8vLXnwzq6ugfloMTb0x6vb0v6TYUIQWF6b0sd6f0y
  2. I take the SHA-512 Hash of the combined seed from step 1:
  3. I take the first two characters, which are 40.
  4. I convert the 40 in hexadecimal into decimal: 4*16 + 0*1 = 64.
  5. There are two digits in the decimial outcome from step 4, so I leave it alone. Otherwise, I would have taken the terminal two digits.
  6. 64 is greater than 36, so it won't do as a roulette outcome.
  7. I advance two characters in the Hash, which are cf.
  8. I convert cf to decimal: c*16 + f = 12*16 + 15*1 = 207.
  9. Since 207 has more than two digits, I take the right two, are are 07.
  10. Since 7<=36, that becomes the outcome of the game.
  11. Next, I check that Server Seed Hash I was given before the bet (that starts with e7043) matches with the Server Seed for the last bet. For some reason, this casino chooses to Hash that with the SHA-256 function, unlike SHA-512, which is uses to Hash the combined string.
  12. In this case, the Hash of sMDGT5P10m071HAdTQkoYCLJ8vLXnwzq6ugfloMT does indeed Hash to e7043dd7fe369b94518449d61162a0c960f54781a16548af63194b7fd9d6891a, which ensures me the casino's contribution to the last bet was predestined.

If all that sounds like a lot of hoops to jump through, I conveniently wrote a program to do it for you. To use it, following these steps:

  1. Go to the PHP Sandbox.
  2. Enter the Client Seed on line 4.
  3. Enter the Server Seed on line 5.
  4. Enter the Hash of the next Server Seed on line 6.
  5. Click "Execute Code."
  6. Verify the game outcome and whether the Hash of the Server Seed matched to that provided before the bet. If not, that would indicate you were cheated.

I also have a copy of the code you may see by clicking the button below.

php line 1
// Roulette game conversion for Crypto.Games
// Enter the Client Seed on line 4 and the Server Seed on line 5.
$client_seed = "b0x6vb0v6TYUIQWF6b0sd6f0y";
$server_seed = "sMDGT5P10m071HAdTQkoYCLJ8vLXnwzq6ugfloMT";
$next_hash = "e7043dd7fe369b94518449d61162a0c960f54781a16548af63194b7fd9d6891a";
$color_array = array(0,1,2,1,2,1,2,1,2,1,2,2,1,2,1,2,1,2,1,1,2,1,2,1,2,1,2,1,2,2,1,2,1,2,1,2,1);
$combined_seed = $server_seed.$client_seed;
echo "Combined seed = $combined_seed\n";
$combined_hash = hash('sha512', $combined_seed);
$server_hash = hash('sha256',$server_seed);
echo "Hash of combined seed = $combined_hash\n";
    if ($hex_to_dec-->36)
while ($hex_to_dec>36);
echo "Hash of Server Seed =\t $server_hash\n";
echo "Game outcome =\t$hex_to_dec ";
if ($color_array[$hex_to_dec]==0)
{ echo "Green\n"; } 
elseif ($color_array[$hex_to_dec]==1)
{ echo "Red\n"; } 
{ echo "Black\n"; } 
$server_seed_hash=hash('sha256', $server_seed);
if ($server_seed_hash==$next_hash)
{ echo "Server Seed match.\n"; }
    echo "Server seed      =\t$server_seed\n";
    echo "Server seed Hash =\t$server_seed_hash\n";
    echo "Alleged next Hash=\t$next_hash\n";

// Procedure
// 1.  Set Position equal to 0.
// 2.  Join server and client seeds and server seed, in that order. 
// 3.  Generate a SHA-512 hash of the string from step 2.
// 4.  Convert first two characters, starting at the "position" of the hash from step 3 from hexidecimal to decimal.
// 5.  If the value from step 4 to 0 to 36, then that will be the game outcome.
// 6.  Otherwise, advance the position by 2 and go to step 4. 

Written by: