SnapEX Games:可验证公平

每一局的结果如何在下注前确定、全部六款游戏的公式,以及一个在您的浏览器中重新计算任意一局的验证工具。

工作原理

  1. 下注前,您会看到当前服务器种子的 SHA-256 哈希(64 个随机十六进制字符)。种子从此刻起固定,无法更改。
  2. 结果还取决于您的客户端种子。您可以随时更改它;下一个服务器种子的哈希会在您为其选择客户端种子之前公布。
  3. 每一局使用您种子对的下一个 nonce:0、1、2……六款游戏共用一个种子对。
  4. 更换种子对时(任意游戏的“可验证公平”标签页),服务器种子会被公开。请核对其 SHA-256 与您看到的哈希一致,然后重新计算用它玩过的任意一局——在下方或用您自己的脚本。

每个游戏页面的“我的投注”中会显示每一局的服务器种子哈希、客户端种子和 nonce。

验证一局

验证在您的浏览器中运行(Web Crypto),而不是在我们的服务器上。字段中填入的是示例种子对,并非真实玩家的游戏局。

随机数

每款游戏都从同一个数据流中取用所需数量的数字:

hash(server_seed) = SHA256(server_seed)            -- server_seed is a 64-char hex string, hashed as text

block[cursor] = HMAC_SHA256(key = server_seed (as text),
                            message = client_seed + ":" + nonce + ":" + cursor)   -- cursor = 0, 1, 2...
words = each block split into 8 big-endian uint32 values, blocks taken in order
f[i] = word[i] / 2^32                               -- 0 <= f < 1
scale(word, n) = floor(word * n / 2^32)             -- integer from 0 to n-1

扑克 · 如何保证公平

  1. 发牌前牌桌会显示承诺值——下一手服务器种子的 sha256。
  2. 牌序由 HMAC-SHA256(服务器种子, "客户端种子:手牌编号:游标") 洗牌得出;您可以随时更换客户端种子。
  3. 一手牌结束后公开服务器种子:牌局记录会在您的浏览器中重建牌序并核对承诺值。
  4. 荷官只能看到自己的牌、公共牌和下注——看不到您的牌,也看不到剩余的牌。

扑克 →

各游戏公式

骰子 1 个数字 · RTP 99%

roll = floor(word[0] * 10001 / 2^32) / 100          -- 0.00 ... 100.00
"Under X" wins if roll < X, chance = X%
"Over X"  wins if roll > X, chance = (100 - X)%
payout = bet * 99 / chance                          -- chance from 0.02% to 98%

火箭 (Crash) 1 个数字 · RTP 99%

crash = max(1.00, floor(99 * 2^32 / (2^32 - word[0])) / 100)
      = max(1.00, floor(99 / (1 - f[0])) / 100)
P(crash >= x) = 0.99 / x  ->  99% RTP for any cash-out target

一局会在 ×10,000 时自动停止(或在派彩达到您投注额对应的单局上限 $10,000 时停止)。

扫雷 24 个数字 · RTP 99%

pool = [0, 1, ..., 24]
for i = 0 ... 23:  take pool[ scale(word[i], 25 - i) ] out of the pool
the last remaining tile is the 25th
mines = the first N tiles taken
multiplier after k safe tiles = floor(0.99 * C(25, k) / C(25 - N, k) * 100) / 100

格子编号为 0–24,从左到右、从上到下。

弹珠 (Plinko) 8 / 12 / 16 个数字 · RTP 99%

for each row r:  word[r] >= 2^31  ->  right,  otherwise left
bin = number of "right" bounces (0 ... rows)
payout = bet * table[rows][risk][bin]

九张赔率表(每个槽位的倍数,从左到右):

8 · 低 5.6 2.1 1.1 1 0.5 1 1.1 2.1 5.6
8 · 中 13 3 1.3 0.7 0.4 0.7 1.3 3 13
8 · 高 29 4 1.5 0.3 0.2 0.3 1.5 4 29
12 · 低 10 3 1.6 1.4 1.1 1 0.5 1 1.1 1.4 1.6 3 10
12 · 中 33 11 4 2 1.1 0.6 0.3 0.6 1.1 2 4 11 33
12 · 高 170 24 8.1 2 0.7 0.2 0.2 0.2 0.7 2 8.1 24 170
16 · 低 16 9 2 1.4 1.4 1.2 1.1 1 0.5 1 1.1 1.2 1.4 1.4 2 9 16
16 · 中 110 41 10 5 3 1.5 1 0.5 0.3 0.5 1 1.5 3 5 10 41 110
16 · 高 1000 130 26 9 4 2 0.2 0.2 0.2 0.2 0.2 2 4 9 26 130 1000

轮盘 1 个数字 · RTP 97.3%

number = scale(word[0], 37)                         -- 0 ... 36, each 1/37
pays (stake included): number x36, dozen / column x3, red-black / even-odd / 1-18 / 19-36 x2
zero loses every bet except a bet on 0

经典老虎机 3 个数字 · RTP 96%

stop[i] = scale(word[i], 32)                        -- i = 0, 1, 2; each reel strip has 32 symbols
window of reel i = strip[i][stop-1], strip[i][stop], strip[i][stop+1]   (wrapping around)
lines: middle, top, bottom, two diagonals
payout = bet / 5 * sum of line pays

卷轴条带(停止位 = 从 0 开始的索引)及连线赔付:

卷轴 1 0:melon 1:lemon 2:bell 3:melon 4:orange 5:cherry 6:seven 7:lemon 8:orange 9:lemon 10:grapes 11:gem 12:melon 13:orange 14:melon 15:cherry 16:grapes 17:bell 18:cherry 19:bell 20:lemon 21:orange 22:grapes 23:cherry 24:orange 25:cherry 26:grapes 27:gem 28:cherry 29:lemon 30:cherry 31:lemon
卷轴 2 0:cherry 1:grapes 2:gem 3:bell 4:lemon 5:cherry 6:seven 7:cherry 8:orange 9:melon 10:grapes 11:lemon 12:grapes 13:cherry 14:lemon 15:cherry 16:bell 17:orange 18:bell 19:orange 20:melon 21:orange 22:cherry 23:lemon 24:melon 25:lemon 26:gem 27:grapes 28:cherry 29:orange 30:lemon 31:melon
卷轴 3 0:melon 1:cherry 2:lemon 3:cherry 4:lemon 5:grapes 6:cherry 7:bell 8:gem 9:orange 10:cherry 11:grapes 12:melon 13:lemon 14:melon 15:grapes 16:cherry 17:orange 18:gem 19:bell 20:lemon 21:orange 22:melon 23:orange 24:lemon 25:bell 26:lemon 27:cherry 28:seven 29:cherry 30:orange 31:grapes

连线赔付(单位;派彩 = 投注额 ÷ 5 × 各连线之和)

  • 七 × 3 — 1,000
  • 钻石 × 3 — 150
  • 铃铛 × 3 — 80
  • 西瓜 × 3 — 40
  • 葡萄 × 3 — 30
  • 橙子 × 3 — 25
  • 柠檬 × 3 — 20
  • 樱桃 × 3 — 15
  • 铃铛 / 宝石 / 七 中任意三个 — 15
  • 第 1–2 卷轴上的樱桃 + 樱桃 — 6

连线:中间、上方、下方、两条对角线。

自己动手验证(Python 3,无需任何库)

import hmac, hashlib, struct

def words(server_seed, client_seed, nonce, count):
    out, cursor = [], 0
    while len(out) < count:
        msg = f"{client_seed}:{nonce}:{cursor}".encode()
        out += struct.unpack(">8I", hmac.new(server_seed.encode(), msg, hashlib.sha256).digest())
        cursor += 1
    return out[:count]

def scale(w, n): return w * n // 2**32

def mines(w, n):
    pool, order = list(range(25)), []
    for i in range(24): order.append(pool.pop(scale(w[i], 25 - i)))
    return sorted(order[:n])

s, c, n = "7e347011f1144055ee29838050723a5663fa660519a1f039aca9ec17924bcbf7", "80ca3b044457", 329
w = words(s, c, n, 24)
print("hash    ", hashlib.sha256(s.encode()).hexdigest())
print("dice    ", scale(w[0], 10001) / 100)
print("crash   ", max(100, 99 * 2**32 // (2**32 - w[0])) / 100)
print("roulette", scale(w[0], 37))
print("plinko16", sum(x >= 2**31 for x in w[:16]))
print("mines(3)", mines(w, 3))
print("slots   ", [scale(x, 32) for x in w[:3]])

对于示例种子对,它输出的结果与上方验证工具相同。

返还率

扫雷 99%,火箭 99%,骰子 99%(精确为 9900 / 10001 = 98.99%),弹珠 98.9–99.1%(视赔率表而定),轮盘 97.3%(欧式,单零),老虎机 96.07%。