Every postMessage type, parameter, and response field in one place. All messages use id-based request/response matching.
Global Messages (All Primitives)
gameReady
Send once when your game loads. Required — the platform won't send data until it receives this.
| Field | Type | Description |
|---|
| type | 'gameReady' | Message type |
1parent.postMessage({ type: 'gameReady' }, '*');
balanceReveal
Optional — supported by all primitives. Post this when you want the player's balance to visually update — typically at the dramatic reveal moment (e.g. when a ball lands, a card flips, a winner is shown, or a cashout animation completes).
The platform always settles the bet in the backend immediately when the API responds. This message only controls when the player sees the new balance. If you never send it, the balance updates automatically after 30 seconds as a fallback.
The deferred moment differs by primitive:
| Primitive | Recommended reveal moment |
|---|
| one-shot | When the outcome animation completes (ball lands, wheel stops, card flips) |
| path | When the cashout payout animation completes (pathCashout or auto-cashout via pathReveal) |
| multiplier | When the cashout celebration animation completes (multiplierCashout) |
| state-machine | When the terminal-state outcome animation completes (final stateMachineAction with gameOver) |
| pvp | When the winner reveal animation completes (pvpResult / pvpCancelled / pvpResolve) |
| Field | Type | Description |
|---|
| type | 'balanceReveal' | Message type |
1
2parent.postMessage({ type: 'balanceReveal' }, '*');
For multi-ball or concurrent bets, send one balanceReveal per outcome — the platform processes them in FIFO order (first bet placed = first balance update applied).
stakeUpdate (incoming)
Platform pushes this when the player changes their bet amount in the UI.
| Field | Type | Description |
|---|
| type | 'stakeUpdate' | Message type |
| stake | number | New bet amount in crypto |
| stakeUsd | number | New bet amount in USD |
| currency | string | 'ETH' | 'SOL' | 'USDT' |
sessionResume (incoming)
Platform sends this on load if there's an active session for a stateful primitive (path, multiplier, state-machine).
| Field | Type | Description |
|---|
| type | 'sessionResume' | Message type |
| primitive | string | 'path' | 'multiplier' | 'state-machine' |
| session | object | Session data (sessionId, currentState, etc.) |
Error Codes
These errors can appear in any response. Check r.error (one-shot) or d.error (other primitives) before processing results.
| Error String | Cause |
|---|
| 'Insufficient balance' | Player can't cover the bet |
| 'Rate limited' | Messages sent faster than 1 per 25ms |
| 'Invalid stake' | Stake is zero, negative, or NaN |
| 'Invalid currency' | Currency not recognized |
| 'Game not found' | GAME_CONFIG missing or game not uploaded |
| 'Session expired' | Game session timed out (long inactivity) |
| 'Session not found' | Invalid or already-ended sessionId |
| 'Invalid action' | Action not in allowedActions (state machine) |
| 'Invalid position' | Position out of range (path) |
| 'Match not found' | Invalid matchId (PVP) |
| 'Already committed' | Player already committed an action (PVP) |
| 'Round crashed - too late!' | Cashout after crash point (multiplier) |
One Shot
bet → betResult
bet (outgoing)
| Field | Type | Required | Description |
|---|
| type | 'bet' | Yes | Message type |
| id | number | Yes | Unique request ID (use Date.now()) |
| stake | number | Yes | window.GAME_STAKE |
| currency | string | Yes | window.GAME_CURRENCY |
| targetMultiplier | number | Continuous only | Player's chosen target (continuous mode) |
| variant | string | Variants only | Selects which multiplier set to use (for games with multiple configurations) |
betResult (incoming)
Matched by id. Result fields are inside e.data.result.
| Field | Type | Description |
|---|
| result.multiplier | number | Winning multiplier (e.g. 5) |
| result.result | string | 'WIN' | 'LOSS' | 'PUSH' |
| result.payout | number | Crypto payout |
| result.payoutUsd | number | USD payout |
| result.profit | number | Crypto profit (can be negative) |
| result.profitUsd | number | USD profit |
| result.balance | number | New balance after bet |
| result.error | string? | Error string if bet failed |
Path
pathStart → (get sessionId) → pathReveal × N → pathCashout (or hit hazard)
pathStart (outgoing)
| Field | Type | Required | Description |
|---|
| type | 'pathStart' | Yes | Message type |
| id | number | Yes | Unique request ID |
| stake | number | Yes | window.GAME_STAKE |
| currency | string | Yes | window.GAME_CURRENCY |
pathStart response
| Field | Type | Description |
|---|
| sessionId | string | Use for subsequent reveal/cashout |
| positionHash | string | Provably fair commitment hash |
| gridSize | number | Total positions |
| mines | number | Number of hazards |
| maxSteps | number | Max safe picks allowed |
| replacement | boolean | Replacement mode |
| multipliers | array | Full payout table [{step, multiplier, survivalProb}] |
| stake / stakeUsd / currency | number / string | Bet details |
pathReveal (outgoing)
| Field | Type | Required | Description |
|---|
| type | 'pathReveal' | Yes | Message type |
| id | number | Yes | Unique request ID |
| sessionId | string | Yes | From pathStart response |
| position | number | Yes | 0-indexed tile position |
pathReveal response (safe)
| Field | Type | Description |
|---|
| survived | true | Player is safe |
| step | number | Current step number |
| multiplier | number | Current multiplier |
| potentialPayout / potentialPayoutUsd | number | What cashout would pay |
| nextMultiplier | number | Next step's multiplier |
| nextSurvivalProb | number | Chance of surviving next step |
| revealedTiles | number[] | All safe tiles revealed so far |
| canCashout / canContinue | boolean | Available actions |
| gameOver | false | Game continues |
pathReveal response (hazard)
| Field | Type | Description |
|---|
| survived | false | Player hit a mine |
| hitMine | true | Confirms hazard hit |
| multiplier | 0 | Zero payout |
| payout | 0 | Zero payout |
| minePositions | number[] | number[][] | Flat (no replacement) or 2D (replacement) |
| serverSeed | string | For verification |
| gameOver | true | Game ended |
pathCashout (outgoing)
| Field | Type | Required | Description |
|---|
| type | 'pathCashout' | Yes | Message type |
| id | number | Yes | Unique request ID |
| sessionId | string | Yes | From pathStart response |
pathCashout response
| Field | Type | Description |
|---|
| success | true | Cashout succeeded |
| step / multiplier | number | Final step and multiplier |
| payout / payoutUsd | number | Crypto and USD payout |
| profit / profitUsd | number | Crypto and USD profit |
| minePositions | number[] | number[][] | Revealed mine positions |
| serverSeed | string | For verification |
| gameOver | true | Game ended |
Multiplier
multiplierStart → (animate locally) → multiplierCashout or serverCrash
multiplierStart (outgoing)
| Field | Type | Required | Description |
|---|
| type | 'multiplierStart' | Yes | Message type |
| id | number | Yes | Unique request ID |
| stake | number | Yes | window.GAME_STAKE |
| currency | string | Yes | window.GAME_CURRENCY |
multiplierStart response
| Field | Type | Description |
|---|
| sessionId | string | Use for cashout |
| commitHash | string | Provably fair commitment |
| serverSeedHash | string | Hash of server seed |
| curve | string | 'exponential' | 'linear' |
| growthRate | number | Growth speed |
| maxMultiplier | number | Cap |
| startTime | number | Server timestamp (ms) |
| stake / stakeUsd | number | Bet details |
multiplierCashout (outgoing)
| Field | Type | Required | Description |
|---|
| type | 'multiplierCashout' | Yes | Message type |
| id | number | Yes | Unique request ID |
| sessionId | string | Yes | From multiplierStart response |
multiplierCashout response (success)
| Field | Type | Description |
|---|
| success | true | Cashed out before crash |
| multiplier | number | Cashout multiplier |
| payout / payoutUsd | number | Crypto and USD payout |
| profit / profitUsd | number | Crypto and USD profit |
| crashPoint | number | The actual crash point (revealed) |
| serverSeed / commitHash | string | For verification |
| gameOver | true | Round ended |
multiplierCashout response (too late)
| Field | Type | Description |
|---|
| error | string | 'Round crashed - too late!' |
| crashed | true | Round already crashed |
| crashPoint | number | The crash point |
| payout / payoutUsd | 0 | No payout |
| serverSeed / commitHash | string | For verification |
| gameOver | true | Round ended |
serverSync (push event)
| Field | Type | Description |
|---|
| type | 'serverSync' | Message type |
| serverNowMs | number | Server's current timestamp (ms) |
serverCrash (push event)
| Field | Type | Description |
|---|
| type | 'serverCrash' | Message type |
| crashMultiplier | number | The crash point |
| serverSeed / commitHash | string | For verification |
PVP Escrow
pvpCreate → (wait for opponent) → pvpCommit → (wait for resolve) → pvpResult
pvpCreate (outgoing)
| Field | Type | Required | Description |
|---|
| type | 'pvpCreate' | Yes | Message type |
| id | number | Yes | Unique request ID |
| stake | number | Yes | window.GAME_STAKE |
| currency | string | Yes | window.GAME_CURRENCY |
| resolver | string | Yes | Must match GAME_CONFIG resolver |
pvpCreate response
| Field | Type | Description |
|---|
| matchId | string | Use for commit/cancel |
| status | string | 'waiting' or 'ready' |
| pot | number | Total pot amount |
| fee | number | House fee rate |
| matched | boolean | true if opponent found immediately |
| opponentUsername | string? | Present if matched |
| players | array | [{id, stakeUsd}] — your ID is last |
| stakeUsd | number | Your stake in USD |
| resolver | string | Resolver type |
pvpCommit (outgoing)
| Field | Type | Required | Description |
|---|
| type | 'pvpCommit' | Yes | Message type |
| id | number | Yes | Unique request ID |
| matchId | string | Yes | From pvpCreate response |
| action | string | Yes | e.g. 'rock', 'heads', or a number |
pvpCommit response
| Field | Type | Description |
|---|
| success | true | Action committed |
| committed | true | Confirms commitment |
pvpCancel (outgoing)
| Field | Type | Required | Description |
|---|
| type | 'pvpCancel' | Yes | Message type |
| id | number | Yes | Unique request ID |
| matchId | string | Yes | From pvpCreate response |
pvpCancel response
| Field | Type | Description |
|---|
| success | true | Match cancelled, funds returned |
pvpOpponentJoined (push event)
| Field | Type | Description |
|---|
| type | 'pvpOpponentJoined' | Message type |
| matchId | string | Match ID |
| opponentUsername | string | Opponent's username |
| pot | number | Total pot |
| status | 'ready' | Match is ready for commits |
pvpOpponentCommitted (push event)
| Field | Type | Description |
|---|
| type | 'pvpOpponentCommitted' | Message type |
| matchId | string | Match ID |
| playerId | string | Who committed |
| allCommitted | boolean | true if both players committed |
| status | 'playing' | Match status |
pvpResult (push event)
| Field | Type | Description |
|---|
| type | 'pvpResult' | Message type |
| matchId | string | Match ID |
| status | 'resolved' | Match resolved |
| outcome | string | 'player1_wins' | 'player2_wins' | 'draw' |
| winner | string? | Winner's player ID (null for draw) |
| pot | number | Total pot |
| houseFee | number | Fee taken |
| prizePool | number | Pot minus fee |
| payouts | array | [{playerId, amount}] |
| players | array | [{id, action}] — reveals both actions |
| serverSeed | string | For verification |
pvpCancelled (push event)
| Field | Type | Description |
|---|
| type | 'pvpCancelled' | Message type |
| matchId | string | Match ID |
| status | 'cancelled' | Match was cancelled |
State Machine
stateMachineStart → (get sessionId + state) → stateMachineAction × N → terminal state
stateMachineStart (outgoing)
| Field | Type | Required | Description |
|---|
| type | 'stateMachineStart' | Yes | Message type |
| id | number | Yes | Unique request ID |
| stake | number | Yes | window.GAME_STAKE |
| currency | string | Yes | window.GAME_CURRENCY |
stateMachineStart response
| Field | Type | Description |
|---|
| sessionId | string | Use for subsequent actions |
| currentState | [string, any] | Current state [key, data] |
| allowedActions | string[] | Available actions |
| totalWager | number | Total wagered so far |
| status | 'playing' | Session status |
| commitHash | string | Provably fair commitment |
| stake / stakeUsd | number | Bet details |
stateMachineAction (outgoing)
| Field | Type | Required | Description |
|---|
| type | 'stateMachineAction' | Yes | Message type |
| id | number | Yes | Unique request ID |
| sessionId | string | Yes | From start response |
| action | string | Yes | Must be in allowedActions |
stateMachineAction response (non-terminal)
| Field | Type | Description |
|---|
| currentState | [string, any] | New state |
| allowedActions | string[] | Next available actions |
| totalWager | number | Total wagered |
| totalPayout | 0 | No payout yet |
| gameOver | false | Game continues |
| status | 'playing' | Session status |
stateMachineAction response (terminal)
| Field | Type | Description |
|---|
| currentState | [string, any] | Final state |
| allowedActions | [] | No actions (game over) |
| totalWager | number | Total wagered |
| totalPayout | number | Final payout multiplier |
| payoutMultiplier | number | Same as totalPayout |
| payoutUsd | number | USD payout amount |
| serverSeed | string | For verification |
| gameOver | true | Game ended |
| status | 'finished' | Session status |
✓Bookmark this page — it covers every message type across all five primitives. For detailed explanations and complete templates, see each primitive's dedicated page.