RouletteBot
Search
K
Comment on page

Provably Fair

How to Verify Provably Fair on RouletteBot

Introduction

RouletteBot uses a Provably Fair system, leveraging the SHA-256 cryptographic algorithm to ensure that all game outcomes are entirely random and not manipulated. This guide will walk you through the steps to verify the fairness of a game round.

What You'll Need

  • The client_seed used in the game round
  • The server_seed used in the game round
  • The result_num (the outcome of the game round)

Steps to Verify Fairness

1. Obtain the Client Seed and the Server Seed Hash.
At the start of each round, you'll have access to both the client seed and the server seed hash.
2. Take the Server seed and the round result number.
Once the round concludes, the unhashed server seed will be disclosed, allowing you to confirm that it hasn't been altered. To verify its integrity, you can use this link. Simply input the unhashed server seed into the first field, and you'll see that it matches the hash initially provided by the bot. This ensures that the game outcome wasn't manipulated after bets were placed.
3. Check the result.
To verify that the two hashes really gave the number that came out. Do the steps below.
Combine the server_seed and client_seed into a single string. The server_seed should come first, followed by the client_seed.
Take the first 13 characters of the hash and convert them to an integer using hexadecimal conversion.
game_int = int(game_hash[:13], 16)
Use a SHA-256 hash generator to hash the combined string. You can use any online SHA-256 generator for this step, such as this online tool.
Use the integer obtained game_int and calculate the result number (result_num) using the formula.
result_num = game_int % 38
⚠️ IMPORTANT: After the announcement of the Bet Competition made on September 6th, we changed the module to 38 to place options as 00 on the roulette wheel(American Roulette). Provably fair ones made before that date must be made with module 37 as below: result_num = game_int % 37
Here is an example of how to do this with complete code:
def spin_roulette(client_seed, server_seed):
# Define the numbers and their corresponding colors for an American roulette
red_numbers = [1, 3, 5, 7, 9, 12, 14, 16, 18, 19, 21, 23, 25, 27, 30, 32, 34, 36]
black_numbers = [2, 4, 6, 8, 10, 11, 13, 15, 17, 20, 22, 24, 26, 28, 29, 31, 33, 35]
green_numbers = [0, 37] # 37 will represent "00"
combined_seed = server_seed + client_seed
game_hash = hashlib.sha256(combined_seed.encode()).hexdigest()
game_int = int(game_hash[:13], 16)
result_num = game_int % 38
return result_num
4. Compare the Results
Finally, compare the calculated result_num with the result_num provided at the end of the game round. If they match, the game round is proven to be fair.