Skip to content
BetPlugDocs
DocsGames & fairness
View .md twin

Game catalog, live games protocol & reference casinos

BetPlug ships a continuously expanding catalog of provably-fair house games across five runtime shapes (/api/openapi.yaml, /api/asyncapi.yaml): Instant games, Stateful Session games, Originals Slots, shared Live Shows, and per-operator Live Tables. Every game below is mounted and served by the BetPlug API across sandbox and live, executing deterministic fixed-point integer arithmetic with zero floats on money or outcomes.

1. Full game catalog & runtime matrix#

Instant games (single-request settle)#

Every Instant game settles in one round-trip (POST /v1/rounds headless or POST /v1/session/rounds embedded) and ships a zero-raster SVG + TypeScript <betrail-game> client bundle (<= 150 KB gzip) as @betrail/game-<slug>:

GameSlugEngine ID & versionClient bundleRNG stream, params & availability
diceDICE v1@betrail/game-dicedice-sha512 (SHA-512(server_seed:client_seed:nonce)); DiceParams (direction, chance, payout); mounted in the BetPlug API
limboLIMBO v1@betrail/game-limbohmac-nonce (HMAC-SHA256(server_seed, client_seed:nonce), no :cursor, 12-dec bcdiv byte sum S); LimboParams (target); mounted in the BetPlug API
plinkoPLINKO v1@betrail/game-plinkoplinko-hmac (HMAC-SHA256(server_seed, client_seed:nonce:c), c = 0 for 8 pins / c = 0, 1 for 9..16 pins); 27 pinned Binomial paytables (8..16 pins x LOW/MEDIUM/HIGH); PlinkoParams; mounted in the BetPlug API
rouletteROULETTE v1@betrail/game-roulettehmac-nonce (HMAC-SHA256(server_seed, client_seed:nonce), no :cursor, 12-dec bcdiv byte sum S); single-zero 37-pocket wheel; RouletteParams (chips); mounted in the BetPlug API
diamondsDIAMONDS v1@betrail/game-diamondshmac-nonce (HMAC-SHA256(server_seed, client_seed:nonce), no :cursor, 12-dec bcdiv byte sum S); 5-gem draw across 7 hands; DiamondsParams ({}); mounted in the BetPlug API
packsPACKS v1@betrail/game-packsFairRandom; 5-card booster pack over 242-card table (RTP = 19/20); PacksParams ({}); mounted in the BetPlug API
range-diceRANGEDICE v1@betrail/game-range-diceFairRandom; configurable [low, high] interval; RangediceParams (mode, target/ranges, multiplier); mounted in the BetPlug API
wheelWHEEL v1@betrail/game-wheelFairRandom; risk-tiered segment paytables; WheelParams (risk, segments); mounted in the BetPlug API
drillDRILL v1@betrail/game-drillFairRandom; multi-target depth multiplier; DrillParams (target, pick); mounted in the BetPlug API
slideSLIDE v1@betrail/game-slideFairRandom; target crash-multiplier reel; SlideParams (target); mounted in the BetPlug API
casesCASES v1@betrail/game-casesFairRandom; weighted mystery-case paytables; CasesParams (difficulty); mounted in the BetPlug API
barsBARS v1@betrail/game-barsFairRandom; multi-bar reveal grid; BarsParams (difficulty, picks); mounted in the BetPlug API
kenoKENO v1@betrail/game-kenoFairRandom; Fisher-Yates 10-of-40 draw (1..10 picks); KenoParams (risk, picks); mounted in the BetPlug API
dartsDARTS v1@betrail/game-dartsFairRandom; radial board ring paytables; DartsParams (difficulty); mounted in the BetPlug API
tarotTAROT v1@betrail/game-tarotFairRandom; 3-arcana multiplier product; TarotParams (difficulty); mounted in the BetPlug API
baccaratBACCARAT v1@betrail/game-baccaratFairRandom; Punto Banco third-card tableau (player / banker / tie + side bets); BaccaratParams (bets); mounted in the BetPlug API
kaboomKABOOM v1@betrail/game-kaboomFairRandom; instant minefield preset sweep (cap_rule: refuse); KaboomParams (charge, spot); mounted in the BetPlug API
tiltTILT v1@betrail/game-tiltFairRandom; balance-beam multiplier (cap_rule: refuse); TiltParams (notch); mounted in the BetPlug API

Stateful session games (multi-step open -> /actions)#

Stateful games debit stake once at POST /v1/rounds (or POST /v1/session/rounds), advance deterministically via POST /v1/rounds/{id}/actions (or /v1/session/rounds/{id}/actions) with monotonic step >= 1, block seed rotation while a round is open (409 round_open), and settle on cash-out, terminal loss, or POST /v1/players/{player_ref}/force-close. Player do: "force_close" is always refused (422 invalid_action).

GameSlugEngine ID & versionAvailability statusMechanics & schemas
chickenCHICKEN v1Mounted in the BetPlug API (FairRandom)Lane-stepping survival ladder (step, cashout) — ChickenParams / ChickenAction
pumpPUMP v1Mounted in the BetPlug API (FairRandom)Balloon inflation multiplier ladder (pump, cashout) — PumpParams / PumpAction
minesMINES v1Mounted in the BetPlug API (FairRandom)5x5 grid (1..24 mines; sweep, cashout; note preset (12, 11) returns 409 not_offered) — MinesParams / MinesAction
towersTOWERS v1Mounted in the BetPlug API (FairRandom)Multi-floor climb across difficulty tiers (sweep, cashout) — TowersParams / TowersAction
blackjackBLACKJACK v1Mounted in the BetPlug API (FairRandom)Infinite shoe (hit, stand, double, split, insurance, no_insurance) — BlackjackParams / BlackjackAction
hiloHILO v1Mounted in the BetPlug API (FairRandom)Sequential card higher/lower/skip chain (guess, skip, cashout) — HiloParams / HiloAction
snakesSNAKES v1Mounted in the BetPlug API (FairRandom)Dice-driven board path with snake hazards (roll, cashout) — SnakesParams / SnakesAction
flipFLIP v1Mounted in the BetPlug API (FairRandom)Compounding coin-flip streak (flip, cashout) — FlipParams / FlipAction
rpsRPS v1Mounted in the BetPlug API (FairRandom)Multi-step rock-paper-scissors streak (throw, cashout) — RpsParams / RpsAction
molesMOLES v1Mounted in the BetPlug API (FairRandom)Whack-a-mole grid survival ladder (hit, cashout) — MolesParams / MolesAction
video-pokerVIDEOPOKER v1Mounted in the BetPlug API (FairRandom)5-card draw + hold (Jacks or Better; draw) — VideopokerParams / VideopokerAction
sky-rushSKYRUSH v1Mounted in the BetPlug API (FairRandom, cap_rule: refuse)Step-by-step altitude cash-out (fly, cashout) — SkyrushParams / SkyrushAction
dead-shotDEADSHOT v1Mounted in the BetPlug API (FairRandom, cap_rule: refuse)Chamber cylinder survival (fire, stop) — DeadshotParams / DeadshotAction
meme-kombatKOMBAT v1Mounted in the BetPlug API (FairRandom, cap_rule: refuse)Single-player fighter duel (next, live_bet) — KombatParams / KombatAction
stack-packsSTACKPACKS v1Mounted in the BetPlug API (FairRandom, cap_rule: refuse)Progressive pack-stacking session (draw, cashout) — StackpacksParams / StackpacksAction

Originals slots (single-nonce spin + bonus rounds)#

Each Originals Slot runs on OriginalsSlotEngine, consuming a single (server_seed, client_seed, nonce) commitment per paid spin (including triggered cascades and free-spin bonus rounds):

GameSlugEngine ID & versionClient packageBundle asset path
grimoire-of-gainsGRIMOIRE v1@betrail/game-grimoire-of-gains/games/grimoire-of-gains/v0.1.0/betrail-grimoire-of-gains.js
pharaoh-pumpPHARAOH v1@betrail/game-pharaoh-pump/games/pharaoh-pump/v0.1.0/betrail-pharaoh-pump.js
shogun-shibaSHOGUN v1@betrail/game-shogun-shiba/games/shogun-shiba/v0.1.0/betrail-shogun-shiba.js

All three are mounted in the BetPlug API (FairRandom): params is {} (SlotParams), and the settled view is SlotView.

Tip: New sandbox brands enable the full catalog automatically on onboarding. Existing brands can enable additional games anytime in Console or via PUT /console/brands/{brand}/games/{environment} (a disabled brand game returns 409 not_offered).

Live multiplayer shows & tables#

GameSlugEngine ID & versionTopologyMoney entry route (REST)Socket commands (receiveLiveCommand)Isolation & policy
trapdoorTRAPDOOR v1 (ShowEngine)Shared environment showPOST /v1/live/trapdoor/bets (createLiveBet)TrapdoorCommand (snapshot, pick, bank, plan)Zero cross-operator crowd figures
kombat-multiplayerKOMBATMP v1 (ShowEngine)Shared environment showPOST /v1/live/kombat-multiplayer/bets (createLiveBet)KombatmpCommand (snapshot)Zero cross-operator crowd figures
crashCRASH v1 (ShowEngine)Shared environment showPOST /v1/live/crash/bets (createLiveBet)CrashCommand (snapshot, cashout)Zero cross-operator crowd figures
meme-tradeMEME_TRADE v2 (ShowEngine)Shared environment showPOST /v1/live/meme-trade/buy-ins (createMemeTradeBuyIn)LiveCommand (snapshot, open, close, sidebet, auto_sell)Enabled in sandbox & live; position adds refused; mid-round force-close retired; OutageVoid refunds open buy-ins; zero crowd figures
stack-o-passSTACKOPASS v1 (Engine live tables)Per-operator 6-seat lobbiesPOST /v1/session/rounds (live_seat: { table, seat })StackOPassCommand (snapshot, watch, open, pass, cashout, leave)Per-operator tables; per-player FairRandom seeds

2. Live games protocol & WebSocket state machine#

Live WebSocket channels, commands, and settlement frames are specified in /api/asyncapi.yaml.

Warning: Live multiplayer games (trapdoor, kombat-multiplayer, stack-o-pass, crash, meme-trade) always require a real player session backed by a seamless wallet (mode: "real"). Demo sessions are refused on live tickets and live bets with 403.

Live WebSocket state machine#

Text
[1] POST /v1/launch (mode:"real") -> [2] POST /v1/sessions (bts_<token>)
                                              |
                                              v
[3] POST /v1/live/{game}/tickets (0-byte body, Idempotency-Key) -> 30 s single-use ticket
                                              |
                                              v
[4] WS wss://live.betrail.example/v1/live/{game}  [Sec-WebSocket-Protocol: betrail.v1, ticket.<ticket>]
                                              |
    +-----------------------------------------+-----------------------------------------+
    |                                         |                                         |
    v                                         v                                         v
SNAPSHOT (seq: 1)  --->  WAITING (lobby)  --->  ACTIVE (ticks / commands)  --->  SETTLED (LiveSettledFrame)
 (or on seq gap:         (stakes enter        (crash cashout, trapdoor          + seed revealed / skipped_link
  send snapshot cmd)      via REST POST)       pick/bank, meme-trade trades)    + round.settled webhook

Every server frame uses the LiveFrame envelope (type, game, seq, at, plus optional request_id and data). Below are schema-valid CrashFrame examples (CrashProjectedSnapshot, CrashTickFrame, CrashSettlement carrying CrashResultBeforeReveal) and a MemeTradeFrame MemeTradeSkippedLink broadcast from /api/asyncapi.yaml:

snapshot
{
  "type": "snapshot",
  "game": "crash",
  "seq": 1,
  "at": 1793238301300,
  "data": {
    "show": {
      "type": "snapshot",
      "show": {
        "type": "lobby",
        "chain": "crash-main-01",
        "index": 1042,
        "commit": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08",
        "salt": "00000000000000000001e3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2c3d4",
        "salt_source": "bitcoin:870000",
        "lobby_closes_at": 1793238300000
      },
      "phase": "ACTIVE",
      "step": 14,
      "tick": 13,
      "multiplier": "1.08",
      "elapsed_ms": 1300
    },
    "self_bets": [
      {
        "bet_id": "bet_01jbx7q2w3e4r5t6y7u8i9o0pa",
        "currency": "BTC",
        "stake": "0.00100000",
        "settled": false
      }
    ]
  }
}
tick
{
  "type": "tick",
  "game": "crash",
  "seq": 15,
  "at": 1793238311600,
  "data": {
    "type": "tick",
    "tick": 116,
    "multiplier": "2.00",
    "elapsed_ms": 11600
  }
}
settled
{
  "type": "settled",
  "game": "crash",
  "seq": 42,
  "at": 1793238311650,
  "data": {
    "bet_id": "bet_01jbx7q2w3e4r5t6y7u8i9o0pa",
    "currency": "BTC",
    "stake": "0.00100000",
    "payout": "0.00200000",
    "refund": "0.00000000",
    "settled_by": "play",
    "view": {
      "chain_id": "crash-main-01",
      "round_index": 1042,
      "ended_by": "CASHED_OUT",
      "reason": "MANUAL",
      "auto_cashout": null,
      "cap_multiplier": "1001.00",
      "settled_step": 117,
      "at_tick": 116,
      "elapsed_ms": 11600,
      "multiplier": "2.00",
      "seed_revealed_at_settle": false
    }
  }
}
skipped link
{
  "type": "skipped_link",
  "game": "meme-trade",
  "seq": 43,
  "at": 1793238320000,
  "data": {
    "type": "skipped_link",
    "link": {
      "chain": "mt-main-01",
      "index": 1042,
      "commit": "113459eb7bb31bddee85ade5230d6ad5d8b2fb52879e00a84ff6ae1067a210d3",
      "salt": "00000000000000000001e3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2c3d4",
      "salt_source": "bitcoin:870000"
    },
    "serverSeed": "5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8",
    "tick": 1842
  }
}

Step-by-step handshake, betting & settlement details#

  1. Mint a real launch credential (POST /v1/launch) and exchange it in the browser (POST /v1/sessions) for bts_<token> (kept strictly in closure memory).
  2. Mint a 30-second single-use join ticket (POST /v1/live/{game}/tickets): Send Authorization: Bearer bts_…, a fresh Idempotency-Key, and a 0-byte empty body. Returns 201 { ticket: "v1.<payload>.<mac>", url: "wss://live.betrail.example/v1/live/{game}", expires_at }. The live server verifies HMAC and Origin first (null refused 403 origin_not_allowed) and consumes jti last so rejected handshakes do not burn the ticket.
  3. Upgrade via Sec-WebSocket-Protocol (joinTicket scheme): Connect with new WebSocket(url, ["betrail.v1", "ticket." + ticket]). Access logs scrub Sec-WebSocket-Protocol so tickets never leak; the server echoes betrail.v1 only.
  4. Gap recovery: Every frame carries monotonic seq. On any gap, send { "type": "snapshot", "request_id": "req_01" } (LiveCommand requires ["type", "request_id"] with additionalProperties: false).
  5. REST money entry & outbox settlement:
    • Shared shows (trapdoor, kombat-multiplayer, crash): Stakes enter over REST via POST /v1/live/{game}/bets ({ show, stake, params }, Idempotency-Key), debiting <bet_id>:0:<attempt>:debit and crediting <bet_id>:credit on settlement.
    • MEME_TRADE v2 (meme-trade): Buy in over REST via POST /v1/live/meme-trade/buy-ins ({ round, amount }, Idempotency-Key, debiting <show_round_id>:<player_ref>:b<buyIn>:<attempt>:debit). In-round commands (open, close, sidebet, auto_sell) travel over WebSocket under the tick barrier. Position adds are refused, mid-round force-close retired (POST /v1/players/{player_ref}/force-close returns 200 {"rounds":[],"pending":0} without touching MEME_TRADE; PUT /v1/players/{player_ref}/status revokes live sessions immediately; post-rug outbox credits run unconditionally; writer outages refund open buy-ins via OutageVoid).
    • STACKOPASS (stack-o-pass): Buy into a per-operator 6-seat table via POST /v1/session/rounds ({ stake, params, live_seat: { table, seat } }), play open/pass/cashout over WebSocket, and settle per hand via <round_id>:credit.
    • Unified LiveSettlement (LiveSettledFrame): Emits { bet_id, currency, stake, payout, refund, settled_by: "play" | "force_close" | "outage", view } over the socket alongside the signed round.settled webhook.

Demo and replay in the embedded live clients#

Live games ship embedded clients: crash, kombat-multiplayer, meme-trade, trapdoor and stack-o-pass (@betrail/game-<slug>). <betrail-game mode="demo"> for one of them needs no token and no session: it runs a simulated show in the browser (a simulated table for stack-o-pass) using a local seed chain (local seeds for stack-o-pass), the verifier's own maths, and a fake balance of 1000.00000000 DEMO. It opens no socket, mints no ticket, places no bet, and sends no record anywhere.

For these clients the element asks for no demo session: each client declares that its demo needs none, so the element sends no POST /v1/demo/sessions, on any origin. Nothing is refused, so the host bridge receives no error event, and the stack-o-pass cockpit displays only the simulated table's state. This behaves identically on an operator's origin and on BetPlug's (note that POST /v1/demo/sessions accepts only BetPlug's own site origins and returns 403 origin_not_allowed on an operator's origin; Instant, Stateful, and Slot games still use it in demo mode).

The stage and phase bar display a badge, and after each simulated bet settles, the client replays it locally in the browser, never a server record:

ClientBadgeDemo verdict
crashDEMO (simulated show)DEMO: the simulated bet replays from its revealed seed (no server record)
kombat-multiplayerDEMO (simulated show)DEMO: the simulated bet replays from its revealed seed (no server record)
meme-tradeDEMO (simulated show)DEMO: the simulated round replays from its revealed seed (no server record)
trapdoorDEMO (simulated show)DEMO: the simulated bean replays from its revealed seed (no server record)
stack-o-passDEMO (simulated show)DEMO: the simulated hand replays from its revealed seed (no server record)

On an operator's origin, set mode="demo" with no token: POST /v1/launch with mode: "demo" for a live game returns 409 not_offered ("This live game has no demo play.").

<betrail-game mode="replay" token="..." round-id="..."> exchanges the launch token, reads one settled round record (GET /v1/session/rounds/{id}), and replays it without opening a socket. A live show bet becomes readable once its show reveals its seed (404 before then), displaying VERIFIED MATCH (replay) with chain anchor unanchored. A stack-o-pass hand replays once the player's seed pair rotates.

Provable fairness & zero cross-operator crowd leakage#

  • Reverse hash chains (TRAPDOOR, KOMBATMP, CRASH, MEME_TRADE): Each shared show pre-commits the terminal digest of a reverse SHA-256 hash chain (link_{k} = SHA256(link_{k+1})) combined with an external block beacon published before betting opens, disclosing unused links via skipped_link.
  • Zero cross-operator crowd figures: Shared shows emit zero round_totals, zero aggregate player counts, and zero cross-player bet frames so no operator can subtract its own share to infer competitors' volume. stack-o-pass isolates tables strictly per operator.

3. Reference casinos (examples/)#

Three end-to-end reference casinos in the repository demonstrate headless REST play, <betrail-game> / iframe embedding, WalletHandler with Ed25519 answer signing, and raw-body webhook verification:

Reference casinoStack & SDKHighlights
./examples/next-casinoNext.js + TypeScript (./sdk/ts)Server-side BetrailClient, createWalletHandler with Ed25519 answers, raw-byte verifyWebhook, <betrail-game> + betrail:v1 host bridge, strict nonce CSP, zero raster assets.
./examples/go-casinoGo 1.27 net/http + html/template (./sdk/go)Zero third-party dependencies, betrail.NewClient, betrail.NewWalletHandler (GenerateEd25519WalletKeyPair + FileBackedNonceStore), betrail.VerifyHTTPWebhook over r.RequestURI, SVG-only UI.
./examples/laravel-casinoPHP 8.2+ / Laravel-style (./sdk/php)Betrail\Sdk\Client, WalletHandler (Ed25519::generateWalletKeyPair + FileBackedWalletBook + FileBackedNonceStore), Webhooks::verify over raw php://input and $_SERVER['REQUEST_URI'], strict CSP iframe launch.

Each reference casino mounts representative games (dice, packs, wheel) and ships an end-to-end local-stack integration test suite.

4. Building join-ticket protocols & handling live frames (runnable sample)#

TypeScript
import assert from "node:assert/strict";
import crypto from "node:crypto";

function buildLiveProtocols(ticket: string): [string, string] {
  assert.match(ticket, /^v1\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/, "expected signed v1 join ticket");
  return ["betrail.v1", `ticket.${ticket}`];
}

const protocols = buildLiveProtocols("v1.eyJzaWQiOiJzZXNzXzAxIn0.c2lnbmF0dXJl");
assert.deepEqual(protocols, ["betrail.v1", "ticket.v1.eyJzaWQiOiJzZXNzXzAxIn0.c2lnbmF0dXJl"]);

// Gap recovery commands carry "request_id" and CrashFrame settlements carry LiveFrame + CrashResultBeforeReveal
const snapshotCmd = { type: "snapshot", request_id: "req_01" } as const;
assert.deepEqual(Object.keys(snapshotCmd).sort(), ["request_id", "type"]);

const settledFrame = {
  type: "settled" as const,
  game: "crash" as const,
  seq: 42,
  at: 1793238311650,
  data: {
    bet_id: "bet_01jbx7q2w3e4r5t6y7u8i9o0pa",
    currency: "BTC",
    stake: "0.00100000",
    payout: "0.00200000",
    refund: "0.00000000",
    settled_by: "play" as const,
    view: {
      chain_id: "crash-main-01",
      round_index: 1042,
      ended_by: "CASHED_OUT" as const,
      reason: "MANUAL" as const,
      auto_cashout: null,
      cap_multiplier: "1001.00",
      settled_step: 117,
      at_tick: 116,
      elapsed_ms: 11600,
      multiplier: "2.00",
      seed_revealed_at_settle: false as const,
    },
  },
};
assert.ok(["play", "force_close", "outage"].includes(settledFrame.data.settled_by));
assert.equal(settledFrame.data.view.elapsed_ms, settledFrame.data.view.at_tick * 100);
assert.equal(settledFrame.data.view.seed_revealed_at_settle, false);

// Verify MemeTradeSkippedLink commitment: sha256_hex(serverSeed) === link.commit
const skippedLink = {
  type: "skipped_link" as const,
  game: "meme-trade" as const,
  seq: 43,
  at: 1793238320000,
  data: {
    type: "skipped_link" as const,
    link: {
      chain: "mt-main-01",
      index: 1042,
      commit: "113459eb7bb31bddee85ade5230d6ad5d8b2fb52879e00a84ff6ae1067a210d3",
      salt: "00000000000000000001e3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2c3d4",
      salt_source: "bitcoin:870000",
    },
    serverSeed: "5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8",
    tick: 1842,
  },
};
const computedCommit = crypto.createHash("sha256").update(skippedLink.data.serverSeed, "utf8").digest("hex");
assert.equal(computedCommit, skippedLink.data.link.commit);
Enter to openEsc to close