Engine RGS
The Engine RGS endpoints that EngineLgs serves.
EngineLgs mimics the Engine RGS.
It serves the wallet and bet endpoints with the request and response shapes of the wallet API, so a front end built for Engine plays against it without code changes.
Only the protocol differs: the LGS serves plain HTTP.
Money format
Every amount over HTTP is an integer with six decimals. 1000000 is 1.00 of the session's currency.
amount in a play request is the base bet. The LGS debits amount × costMultiplier of the mode from the wallet.
Endpoints
Every endpoint except the replay endpoint takes a POST with a JSON body and answers with JSON.
A body that is not valid JSON, or that misses a field, answers with status 400 and the plain text Bad Request.
POST /wallet/authenticate
Marks the session as authenticated. Every other endpoint requires this call first.
{ "sessionID": "wYv1...", "language": "en" }language is optional. When set and not empty, the LGS stores it on the session.
{
"balance": { "amount": 10000000000, "currency": "USD" },
"config": {
"minBet": 100000,
"maxBet": 1000000000,
"stepBet": 10000,
"defaultBetLevel": 1000000,
"betLevels": [100000, 200000, 400000, "..."],
"gameModes": [
{ "mode": "base", "costMultiplier": 1, "maxBet": 1000000000 },
{ "mode": "bonus", "costMultiplier": 70, "maxBet": 14280000 }
],
"user": { "id": "Qf8c..." },
"jurisdiction": {
"socialCasino": false,
"disabledFullscreen": false,
"...": false,
"minimumRoundDuration": 0
}
},
"round": null
}| Field | Description |
|---|---|
balance | Wallet balance and currency. |
config.minBet | bets.min of the configuration. |
config.maxBet | bets.max. |
config.stepBet | bets.step. |
config.defaultBetLevel | bets.default. |
config.betLevels | bets.levels. |
config.gameModes | One entry per game mode with its cost multiplier and the maximum base bet of that mode. |
config.user.id | The wallet ID. |
config.jurisdiction | The jurisdiction flags. socialCasino is true for social sessions. |
round | The open round, or null. A front end uses it to resume a round after a reload. |
POST /wallet/balance
{ "sessionID": "wYv1..." }{ "balance": { "amount": 10000000000, "currency": "USD" } }POST /wallet/play
Places a bet, draws an outcome from the game's math and opens a round.
{ "sessionID": "wYv1...", "mode": "base", "amount": 1000000 }The LGS checks, in this order: the session is authenticated, the mode exists, no round is open, the amount follows the bet rules, and the cost is within the balance. Then it draws a book, debits the cost and creates the round.
{
"balance": { "amount": 9999000000, "currency": "USD" },
"round": {
"betID": 1,
"amount": 1000000,
"payout": 1200000,
"payoutMultiplier": 1.2,
"active": true,
"mode": "base",
"state": [{ "index": 0, "type": "reveal", "...": "..." }]
}
}| Field | Description |
|---|---|
round.betID | ID of the bet. The storage assigns it. InMemoryStorage counts from 1. |
round.amount | The base bet. |
round.payout | amount × payoutMultiplier, rounded to an integer. Credited on end-round. |
round.payoutMultiplier | Payout of the drawn book as a plain multiplier. 1.2 is 1.2x. |
round.active | true while the round waits for end-round. |
round.mode | The requested mode. |
round.state | The events of the drawn book, exactly as the simulation wrote them. |
round.event | The last event recorded through /bet/event. Only present after an event was recorded. |
A round with a payout of 0 is closed as soon as it is created. Its active is false and it needs no end-round.
A round with a payout above 0 stays open until end-round.
POST /wallet/end-round
Credits the payout of the open round to the wallet and closes the round.
{ "sessionID": "wYv1..." }{ "balance": { "amount": 10000200000, "currency": "USD" } }POST /bet/event
Records a client-side progress marker on the open round. The event must be 1 to 32 bytes of UTF-8.
{ "sessionID": "wYv1...", "event": "reveal-done" }{ "event": "reveal-done" }The next authenticate returns the event in round.event, so a front end can continue a round where it left off.
GET /bet/replay/{game}/{version}/{mode}/{event}
Returns one book for bet replay. The endpoint needs no session and no authentication. A front end in replay mode calls it with the values of its replay launch parameters.
curl http://localhost:7771/bet/replay/my-game/1/bonus/812| Segment | Description |
|---|---|
game | ID of a registered game. |
version | Math version of the game. The LGS has no math versions. It accepts any value and ignores it. |
mode | Name of a mode of the game. |
event | Book ID, an integer of 0 or more. |
{
"payoutMultiplier": 8,
"costMultiplier": 70,
"state": [{ "index": 0, "type": "reveal", "...": "..." }]
}| Field | Description |
|---|---|
payoutMultiplier | Payout of the book from the lookup table, as a plain multiplier. 8 is 8x. |
costMultiplier | Cost multiplier of the mode. |
state | The events of the book. A play of the same book returns the same value as round.state. |
An unknown game, an unknown mode or an unknown book answers with status 404 and an empty body, without JSON.
An event that is not an integer of 0 or more also answers with 404.
A mode without a lookup table answers with status 500 and ERR_GEN, like a play.
Round lifecycle
/wallet/authenticateopens the session. Whenroundis notnull, continue that round./wallet/playdebits the bet and returns the outcome./bet/eventrecords progress while the client plays the outcome. Optional, repeatable./wallet/end-roundcredits the payout. Skip it whenround.activeisfalse.
A replay needs no session. A front end in replay mode calls only the replay endpoint.
Bet rules
A play request passes when the amount:
- is at least
bets.minand at mostbets.max, - is a multiple of
bets.step, - is at most the maximum of the mode.
The maximum of a mode is the largest multiple of bets.step whose cost stays within bets.max.
With the default limits, a bonus mode with a cost multiplier of 70 allows base bets up to 14.28, reported as maxBet: 14280000 in config.gameModes.
A valid amount still fails with ERR_IPB when amount × costMultiplier is above the wallet balance.
Errors
A failed request answers with { "error": "<code>", "message": "<reason>: <detail>" }.
| Code | Status | When |
|---|---|---|
ERR_VAL | 400 | Unknown session, session not authenticated, unknown mode, invalid amount, a round is open, no round is open, invalid event, unknown forced book. |
ERR_IPB | 400 | The cost of the bet is above the balance. |
ERR_GEN | 500 | The game is not registered, the lookup table or the book is missing, or an unexpected error. |
{ "error": "ERR_VAL", "message": "a round is already active: Round 3 is still active" }A missing lookup table or book means the game was not simulated. Run the simulation, then play again.
Differences from the Engine RGS
- Sessions come from
POST /lgs/sessions, not from Engine. - The LGS serves plain HTTP. Set
protocol: "http"on the official client. - Sessions do not expire, and there are no rate limits.
- The replay endpoint ignores the
versionsegment and serves the books of the last simulation. config.user.idis the wallet ID.- Wallets, sessions and rounds live only as long as the storage.
InMemoryStorageforgets them when the process exits.
Use of AI on this page: Some texts were improved with or written by AI.