Mines game server. Handles RNG, game logic, and serves the game UI. Communicates with the casino platform server for all wallet operations.
npm install
npm run dev # development with auto-reload
npm start # productionRuns on http://localhost:3000
Platform server must be running on http://localhost:3001
- Platform generates a session token and opens this game in an iframe:
http://localhost:3000?token=<session-token> - Game reads token from URL, player places bet
- Game server validates token with platform, calls
/wallet/debit - RNG runs — mine positions generated using
crypto.randomBytes, stored server-side only - Player clicks tiles — each reveal checked against stored positions
- On cashout → game server calls
/wallet/creditwith payout - On mine hit → round ends, no credit call (platform already has the bet)
Start a new round. Validates token, debits bet, runs RNG.
Request:
{ "token": "session-token", "betAmount": 5.00, "mineCount": 5 }Response:
{
"ok": true,
"roundId": "round_abc123",
"gridSize": 25,
"mineCount": 5,
"newBalance": 95.00
}Mine positions are NOT returned — stored server-side only.
Reveal a tile.
Request:
{ "roundId": "round_abc123", "tileIndex": 12 }Response (safe):
{
"ok": true,
"result": "safe",
"tileIndex": 12,
"multiplier": 1.24,
"potentialPayout": 6.20,
"safeRevealed": 2,
"totalSafe": 20
}Response (mine):
{
"ok": true,
"result": "mine",
"tileIndex": 12,
"minePositions": [3, 7, 12, 18, 22],
"roundId": "round_abc123"
}Cash out current winnings.
Request:
{ "roundId": "round_abc123" }Response:
{
"ok": true,
"payout": 8.75,
"multiplier": 1.75,
"newBalance": 103.75,
"xp": 5
}Get current round state (reconnect support).
Uses probability-based calculation with 3% house edge:
multiplier = 0.97 / P(surviving N reveals with M mines on 25 tiles)
More mines = faster multiplier growth = higher risk/reward.
| Variable | Default | Description |
|---|---|---|
| PORT | 3000 | Game server port |
| PLATFORM_URL | http://localhost:3001 | Casino platform URL |