SkinTrain provably fair

Standalone verifier for current games

Paste the values of a game, a battle or a giveaway and check it here. The check runs in this page from the values you paste, so it works offline: save the file and open it without a connection if you like. For a battle or a giveaway, an optional chain check asks the EOS endpoints you list for the one block the game used. Nothing else is sent.

Running the self-test against the known answers.

Played on the older scheme? Use the standalone verifier for older games.

Check a game

  1. On SkinTrain's provably fair page, enter the game id and press Check.
  2. Open Try changing an input under the steps and press Copy values. Battles and giveaways have the same button.
  3. Paste the values below and press Check.

A battle's or a giveaway's fairness data from our API works too, pasted as it is served: /Battles/by-reveal/{game id}/provably-fair or /giveaways/{giveaway id}/provably-fair.

For a game you played with a passphrase: this page makes your input again from the fingerprint and compares it with the input in the values. It stays on this page.

Runs in this page. Nothing is sent.

The verdict and how the game was decided appear here once you paste a game's values and press Check.

The full method

The exact formulas, so you can rebuild every value with any SHA-256 and HMAC tool. All hex is lowercase.

fingerprint  = hex(SHA256(UTF8(serverSeedHex)))
clickEntropy = hex(HMAC_SHA256(key = UTF8(passphrase or browserSecret), msg = UTF8(fingerprint)))
rollBytes    = HMAC_SHA256(key = UTF8(serverSeedHex), msg = UTF8(clientSeed + ":" + clickEntropy + ":" + canonicalJson(roundValues)))
ticket       = first of the 4-byte little-endian windows 0..6 below 4294900000, else window 7, mod 100000
tableHash    = hex(SHA256(UTF8(canonicalJson(prizeList))))
prize        = cases, packs: first range with min <= ticket <= max
               upgrade: landing = (ticket + arrowStart) mod 100000, first band with start <= landing < end

Battles and giveaways

A battle's seed and its fingerprint exist before anyone joins; a giveaway's exist when it opens. When the lobby is full, or when the giveaway ends, we fix a future EOS block by its number. Its id, which nobody can predict or choose, goes into every roll together with every seat's client seed (every entrant's, in a giveaway). The seed is revealed when the battle ends or is cancelled, and when the giveaway completes. In a giveaway every entrant holds the same number of tickets; a ticket in the rejected band above them is re-rolled.

fingerprint = hex(SHA256(UTF8(seedHex)))
rosterHash  = hex(SHA256(UTF8(canonicalJson(roster))))
              roster = [{seat, clientSeed}] by seat, or [{entry, clientSeed}] in entry order
setupHash   = hex(SHA256(UTF8(canonicalJson(setup))))      battles: cases, prize lists, mode, seats
blockId     = the id of EOS block N; its first 8 hex digits are N
rollBytes   = HMAC_SHA256(key = UTF8(seedHex), msg = UTF8(rosterHash + ":" + blockId + ":" + purpose + ":" + index))
ticket      = as above
drop        = the round's prize list in the setup: first range with min <= ticket <= max
giveaway    = q = floor(100000 / entrants) tickets each; entry e (from 0, in entry order) holds e*q to e*q + q - 1
              draw d rolls index "d", then "d:1" ... "d:63" while its ticket is in the rejected band q*entrants..99999
              at "d:63" a ticket in the band goes to entry ticket mod entrants; at most 100000 entrants
clutch      = W = the seats' (or teams') total weight; value = UniformBelow(rollBytes of clutch_winner "0", W)
              UniformBelow(bytes, B) = the first 64-bit little-endian window at bytes 0, 8, 16 below 2^64 - (2^64 mod B),
              else the window at byte 24; mod B. Winner: the first bucket whose running total exceeds value
              W = 0: no value, the bucket at UniformBelow(rollBytes, buckets)
our record  = blockNum = headRead + leadBlocks, with leadBlocks at least 4