SkinTrain provably fair

Standalone verifier for older games

Check a game played on the older scheme from its values, with nothing but this file. It runs offline, makes no request and loads nothing from elsewhere: save it, open it from your disk without a connection, and it still works. Cryptography uses your browser's own Web Crypto.

Running Reproducing the known answers this file carries.
See every known answer

Each line is a fixed set of inputs and the answer SkinTrain publishes for it. If every line passes, the algorithm in this file is the one that decided real games.

Played on the current scheme, or checking a battle or giveaway with an EOS block? Use the standalone verifier for current games.

Check a game

  1. On SkinTrain's provably fair page, enter the game id and press Check. An older game opens labelled Older scheme.
  2. Press Copy data under its result.
  3. Paste the data below and press Check.
Runs in this page. Nothing is sent.

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

Enter values by hand

Recompute a roll

Filled with a known example; Check above fills it with your game.

The server seed text, used as it is as the HMAC key (not hex-decoded).

Lowercase hex. Several seeds (a battle's mode draws) are sorted and hashed together.

The round values are {"roundNumber": N}.

A case uses {}; a battle seat uses {"SeatNumber":"<n>","TeamNumber":"<n>"}.

Check the published hash

A separate check from the roll. With each game the server publishes HMAC-SHA256(salt, serverSeed) (a battle publishes it when the battle starts). Once the salt rotates it is published too, so you can recompute that hash here: a match shows the seed was not changed after the hash was published. Here the salt, hex-decoded to bytes, is the key; the roll above keys on the server seed text.

The same server seed text. Here it is the HMAC data, not the key.

Lowercase hex, decoded to raw bytes and used as the HMAC key.

The hash published with the game, sometimes labelled the server seed hash.

The full method

How the roll is made

  1. Combine the client seeds. Drop empty ones, sort the rest with an ordinal (code-unit) comparison, join them with | and take SHA-256. The result is a lowercase-hex aggregatedSeed.
  2. Build the message. Join aggregatedSeed, the round-values JSON and the game-values JSON with colons. Each JSON object is compact, keys ordinal-sorted, strings quoted, numbers bare, byte for byte as on the server.
  3. Sign it. HMAC-SHA256(key = serverSeed, message) gives 32 bytes. The server published this seed's hash with the game.
  4. Reduce to a ticket. Read little-endian uint32 windows at offsets 0, 4, ..., 24 and take the first below 4,294,900,000; if all seven are too high, use offset 28. Then value mod 100000 gives a ticket from 0 to 99,999.

How the published hash is checked

  1. Hex-decode the salt. The salt is published as hex; decode it to raw bytes. These bytes, not the text, are the HMAC key. This is the one place the roll and the hash differ: the roll keys on the server seed text, the hash keys on the decoded salt bytes.
  2. Sign the seed. HMAC-SHA256(key = decoded salt, data = server seed) gives 32 bytes. Take their lowercase hex.
  3. Compare. If that hex equals the published hash, the seed was not changed after the hash was published. Letter case is ignored.