> For the complete documentation index, see [llms.txt](https://trident-cas.sabn.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://trident-cas.sabn.xyz/games/mines.md).

# Mines

### Events

#### Client -> Server

**`mines:start`**

Starts a new game.

* **Payload**:

  ```json
  {
      "betAmount": 10.5,
      "mineCount": 3, // 1 to 24
      "clientSeed": "user-provided-seed"
  }
  ```
* **Response**: `mines:start` (Confirmation)

**`mines:reveal`**

Reveals a tile on the grid.

* **Payload**:

  ```json
  {
      "index": 12 // 0-24
  }
  ```
* **Response**: `mines:reveal` (Result)

**`mines:cashout`**

Cashes out the current winnings.

* **Payload**: None
* **Response**: `mines:cashout` (Success/Failure)

**`mines:active`**

Fetches the currently active game state. Use this to restore the game on refresh.

* **Payload**: None
* **Response**: `mines:active` (Game state or false)

#### Server -> Client

**`mines:start` (Response)**

* **Payload (Success)**:

  ```json
  {
      "status": true,
      "nextMultiplier": 1.12,
      "pf": {
          "serverSeedCommitment": "hash", // hash of server seed, can be shown to users on frontend before game end
          "clientSeed": "seed", // provided by client themslves
          "nonce": 1, // random nonce
          "publicSeed": "block-id"
      }
  }
  ```

**`mines:reveal` (Response)**

* **Payload (Safe tile)**:

  ```json
  {
      "status": true,
      "index": 12,
      "nextMultiplier": 1.25
  }
  ```
* **Payload (Bomb/Loss)**:

  ```json
  {
    "status": true,
    "mineRevealed": true,
    "index": 12,
    "mines": [0, 1, 0, "...", 2] // 0 unrevealed, 1 mine/bomb, 2 revealed safe
  }
  ```
* **Payload (Win – all safe tiles revealed)**:

  ```json
  {
    "status": true,
    "index": 12,
    "mines": [2, 1, 2, "..."] // Full board; game auto-cashouts at next multiplier
  }
  ```
* **Payload (Error)**:

  ```json
  {
    "status": false,
    "message": "You don't have an ongoing game"
  }
  ```

> **Note:** `index` is included in every success response so clients do not need to correlate responses back to the originating click via closure state. The server rate-limits this event to one request per **250 ms** per user.

**`mines:cashout` (Response)**

* **Payload (Success)**:

  ```json
  {
    "status": true,
    "winningAmount": 150.00,
    "mines": [...] // Full board revealed
  }
  ```

**`mines:active` (Response)**

* **Payload (Active game found)**:

  ```json
  {
      "status": true,
      "active": true,
      "game": {
          "mines": [0, 0, 0, 2, 0, "...", 2], // 1s (mines) are hidden as 0s to prevent cheating
          "betAmount": 10.5,
          "mineCount": 3,
          "currentMultiplier": 1.25,
          "nextMultiplier": 1.50,
          "pf": {
              "serverSeedCommitment": "hash",
              "clientSeed": "user-provided-seed",
              "nonce": 1
          }
      }
  }
  ```
* **Payload (No active game)**:

  ```json
  {
      "status": true,
      "active": false
  }
  ```

**`mines:proof`**

Emitted after game end (Cashout or Loss) to reveal secrets.

* **Payload**:

  ```json
  {
      "serverSeed": "original-secret-hex",
      "serverSeedCommitment": "hash",
      "clientSeed": "seed",
      "nonce": 1
  }
  ```

***

### Game Logic Details

1. **Provably Fair**:
   * Uses `serverSeed`, `clientSeed`, `nonce`.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://trident-cas.sabn.xyz/games/mines.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
