Towers

Towers is a single-player game where players climb a tower of 8 layers. Each layer contains multiple buttons — some safe, some bombs. Players reveal one button per layer and can cash out any time after passing at least one layer.


Difficulty Reference

Difficulty
Buttons per layer
Bombs per layer
Safe probability

easy

3

1

2/3 (~66.7%)

medium

4

2

2/4 (50%)

hard

3

2

1/3 (~33.3%)

Button indices are 0-based. Valid range: 0 to buttons - 1 (e.g. 0–2 for easy/hard, 0–3 for medium).

Multiplier formula: ((1 - 0.10) / probability) ** layer (10% house edge)


Events

Client → Server

towers:start

Starts a new game.

{
    "amount": 10.5,
    "difficulty": "easy",
    "clientSeed": "user-provided-seed"
}
  • amount: number, min 0.01, max 50

  • difficulty: "easy" | "medium" | "hard"

  • clientSeed: non-empty string (used for Provably Fair)


towers:reveal

Reveals a button on the current layer.

  • button: integer index, 0 to buttons - 1 for the current difficulty


towers:cashout

Cashes out at the current multiplier. Requires at least one layer to have been successfully revealed.

  • Payload: (none)


Server → Client

towers:start (Response)

Success:

Failure:

Possible failure messages: "Bets are currently disabled", "Invalid difficulty", "clientSeed is required", "Invalid bet amount", "Max bet is $50", "Invalid user", "You have an active game", "Insufficient balance", "An error occurred".


towers:reveal (Response)

Safe tile — game continues:

Bomb hit — game over:

pattern is the full 8-layer board revealed. 0 = bomb, 1 = safe. proof is present only if the server seed is still held in memory (normal flow). Always verify serverSeed by hashing it and comparing to serverSeedCommitment.

All 8 layers cleared — auto cashout:

Error:


towers:cashout (Response)

Success:

proof is present under normal conditions. Always verify by hashing serverSeed → compare to serverSeedCommitment.

Failure:

Possible failure messages: "No active game", "You must reveal at least one layer", "An error occurred".


Provably Fair

The outcome of every layer is determined before the game starts using:

  • serverSeed — random 32-byte hex, generated by the server. Kept secret until game end.

  • serverSeedCommitmentSHA-256(serverSeed). Sent to the client at game start so they can verify fairness after the game.

  • clientSeed — provided by the player. Included in the outcome derivation, giving the player control.

  • nonce — a per-user incrementing counter.

Verification (after receiving serverSeed):

  1. Compute SHA-256(serverSeed) and confirm it matches the serverSeedCommitment you received at game start.

  2. For each layer l (0-indexed, 0 = bottom), the button layout is determined by a Fisher-Yates shuffle seeded with HMAC-SHA256(serverSeed, "${clientSeed}:${nonce}:i:layer_${l}").


Disconnect Behaviour

  • If the player disconnects before revealing any layer, the bet is fully refunded.

  • If the player disconnects after revealing at least one layer, an automatic cashout is performed at the current multiplier.

Last updated