Slot Reward Algorithm

This explains how the reward outcome for a randomly picked slot request is generated in a provably fair way. Anyone can reproduce the random value from the disclosed seeds and verify whether the reward was legitimately won.

Algorithm Overview

  1. A server_seed is generated using a cryptographically secure RNG (hex 64 chars).
  2. A client_seed is constructed: kick_username:id:slot_call.
  3. A nonce is set to the numeric slot request id.
  4. The three values are concatenated with colons: server_seed:client_seed:nonce.
  5. SHA-256 hash of that string is computed.
  6. The first 8 hex characters of the hash are converted to an integer (0–4294967295).
  7. The integer is reduced: (value % 10000) / 100 producing a number in 0.00–99.99.
  8. If this value is strictly less than the configured win chance percent, the reward is awarded.

Verifying A Result

After a pick, the API returns a JSON structure containing server_seed, client_seed, nonce, proof_hash, the numeric chance, and the derived random_value. You can recompute the hash and random value as follows:

import hashlib

server_seed = "<server_seed_from_api>"
client_seed = "<client_seed_from_api>"  # format: username:id:slot_call
nonce = "<nonce_from_api>"
combined = f"{server_seed}:{client_seed}:{nonce}"

hash_result = hashlib.sha256(combined.encode()).hexdigest()
assert hash_result == "<proof_hash_from_api>"  # must match

random_int = int(hash_result[:8], 16)          # first 8 hex chars
random_value = (random_int % 10000) / 100       # 0.00 - 99.99
chance_percent = <chance_from_api>
won = random_value < chance_percent
print(random_value, chance_percent, won)

Security Notes

  • The server_seed is freshly generated each pick to prevent prediction.
  • The client_seed binds the randomness to the specific request context.
  • Using only the first 8 hex characters balances transparency with simplicity; full hash remains available via proof_hash.
  • All comparisons use floating point values derived deterministically from the hash; no additional randomness is introduced.

Example JSON

{
  "reward": {
    "won": true,
    "type": "tip",
    "amount": "5.00",
    "chance": 10.0,
    "random_value": 3.27,
    "proof_hash": "2b7f8c...",
    "server_seed": "f9d1...",
    "client_seed": "exampleUser:123:DogHouse",
    "nonce": "123"
  }
}

If you discover any discrepancy between a provided random_value and a recomputed value from the seeds, please report it immediately.