Game transparency
How it works
The protocol separates the public commitment from the seed disclosure. This prevents a result from being chosen after participation.
1. Commitment
A hash is published before the result. It works like a sealed digital envelope.
2. Draw
The result is derived from data already committed through a deterministic function.
3. Disclosure
After the result, the seed and required parameters become available for inspection.
4. Reproduction
The browser repeats the hashes and draw. The proof passes only when everything matches the record.
Wheel proof
How the result is calculated
The Wheel combines a seed chain with the catalog and weights preserved at spin time.
- Items are ordered by key. Every key and weight enters the canonical catalog used by the calculation.
- The spin commitment is sha-256 of the protocol domain, server seed and canonical catalog.
- The chain commitment binds the initial hash, catalog and size; the position proves the seed belongs to the published chain.
- The result hash becomes a number modulo the sum of weights. That ticket determines the selected item.
Verification code
Paste it into the browser console, or save it as an .mjs file and run it with Node. The code recomputes the hashes and the draw from the proof data and shows whether each part matches.
Verify a commitment above to fill the code with the proof data.
const proof = {
"serverSeed": "SERVER_SEED",
"commitmentHash": "COMMITMENT_HASH",
"chainCommitment": "CHAIN_COMMITMENT",
"headHash": "HEAD_HASH",
"index": 0,
"size": 1,
"items": [
{
"key": "ITEM_KEY",
"weight": 1
}
]
}
async function sha256(text) {
const digest = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(text))
return [...new Uint8Array(digest)].map((byte) => byte.toString(16).padStart(2, '0')).join('')
}
async function verifyReward(proof) {
const items = [...proof.items]
.sort((left, right) => (left.key < right.key ? -1 : left.key > right.key ? 1 : 0))
.map(({ key, weight }) => ({ key, weight }))
const commitment = await sha256(
JSON.stringify(['tgrtslj:reward:commitment:v1', proof.serverSeed, items]),
)
const chain = await sha256(
JSON.stringify(['tgrtslj:reward:commitment-chain:v1', proof.headHash, items, proof.size]),
)
let link = proof.serverSeed
for (let step = 0; step <= proof.index; step += 1) link = await sha256(link)
const resultHash = await sha256(
JSON.stringify(['tgrtslj:reward:weighted-draw:v1', proof.serverSeed, items]),
)
const totalWeight = items.reduce((sum, item) => sum + item.weight, 0)
const ticket = Number(BigInt('0x' + resultHash) % BigInt(totalWeight))
let upperBound = 0
const selected = items.find((item) => ticket < (upperBound += item.weight))
return {
commitmentMatches: commitment === proof.commitmentHash,
chainMatches: chain === proof.chainCommitment,
positionMatches: proof.index < proof.size && link === proof.headHash,
resultHash,
ticket,
item: selected.key,
}
}
console.log(await verifyReward(proof))
Scratchcard proof
How the result is calculated
The proof becomes available only after reveal, when the seed can be disclosed safely.
- The catalog and weights are frozen when the scratchcard is granted, even if configuration changes later.
- The commitment uses the same cryptographic domain and weighted draw as the Wheel.
- The seed position is checked against the initial hash and the previously published chain commitment.
- The item, result hash and disclosed seed must reproduce the recorded prize exactly.
Verification code
Paste it into the browser console, or save it as an .mjs file and run it with Node. The code recomputes the hashes and the draw from the proof data and shows whether each part matches.
Verify a commitment above to fill the code with the proof data.
const proof = {
"serverSeed": "SERVER_SEED",
"commitmentHash": "COMMITMENT_HASH",
"chainCommitment": "CHAIN_COMMITMENT",
"headHash": "HEAD_HASH",
"index": 0,
"size": 1,
"items": [
{
"key": "ITEM_KEY",
"weight": 1
}
]
}
async function sha256(text) {
const digest = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(text))
return [...new Uint8Array(digest)].map((byte) => byte.toString(16).padStart(2, '0')).join('')
}
async function verifyReward(proof) {
const items = [...proof.items]
.sort((left, right) => (left.key < right.key ? -1 : left.key > right.key ? 1 : 0))
.map(({ key, weight }) => ({ key, weight }))
const commitment = await sha256(
JSON.stringify(['tgrtslj:reward:commitment:v1', proof.serverSeed, items]),
)
const chain = await sha256(
JSON.stringify(['tgrtslj:reward:commitment-chain:v1', proof.headHash, items, proof.size]),
)
let link = proof.serverSeed
for (let step = 0; step <= proof.index; step += 1) link = await sha256(link)
const resultHash = await sha256(
JSON.stringify(['tgrtslj:reward:weighted-draw:v1', proof.serverSeed, items]),
)
const totalWeight = items.reduce((sum, item) => sum + item.weight, 0)
const ticket = Number(BigInt('0x' + resultHash) % BigInt(totalWeight))
let upperBound = 0
const selected = items.find((item) => ticket < (upperBound += item.weight))
return {
commitmentMatches: commitment === proof.commitmentHash,
chainMatches: chain === proof.chainCommitment,
positionMatches: proof.index < proof.size && link === proof.headHash,
resultHash,
ticket,
item: selected.key,
}
}
console.log(await verifyReward(proof))

