Games
Using the node12.5.13+

Games

BetBet and the games module: how the four modes pay, what a node indexes, the pages, the routes and the Lotus bot tag.

A game on Lotus is a set of scripts. The stakes sit in contract outputs whose scripts fix who can be paid; the node holds no pot and no key. Nothing about games is a consensus rule: a node indexes the games and serves them, read only.

BetBet is the first game: a bet in XPI on Yes or No. It is played from the web wallet (Play, Games). The wallet rebuilds every script from the record on chain and compares before it shows or signs.

The modes of BetBet #

ModeHow the result is made
1 vs 1The creator locks a stake and a hidden choice; the other player adds the same stake and a guess; the creator reveals
Creator vs allThe creator locks a stake for each of up to N seats and one hidden choice; each seat is a game against the creator only
Crowd pot1 to 15 seats, each with a hidden secret and a bond; the result is made from all the secrets
Big potMany players and no secret; the result is a bit of the hash of a block mined after the betting is closed

In each mode 2% of a winning payout goes to the author of the game, and the network fees are paid by the transactions. In 1 vs 1 and Creator vs all, the odds are 50/50 for a creator who picks at random, so the expected value of a bet is minus 2% of one's own stake, and the fees. In the pots a winner also depends on how much was bet on each side.

  • 1 vs 1: if the creator does not reveal within the delay, the other player is paid. If nobody joins, the creator takes the stake back after the delay.
  • Creator vs all: if the creator does not reveal by the deadline, every player is paid.
  • Crowd pot: a seat that does not reveal loses its stake to the others, and its bond is destroyed. If nobody reveals, everyone is refunded.
  • Big pot: randomness from a block. The miner who finds that block could throw it away and mine another one to draw again, giving up its reward to do so. The wallet shows that sentence before every signature in this mode. If nobody draws, every stake is refunded.

All four modes need a network where the contracts upgrade is active.

On your node #

The games module runs by default (games=0 turns it off) and needs the eMPP index. On a chain that is already there, the first start builds its index from the block files.

The web UI shows the games under Protocols, Games (/dashboard/protocols/games): the open games, the recent ones, a leaderboard, and one game with its players and steps. An address page has a "Games played" card, and a transaction page says what a transaction did in a game. With the module off, the page says so.

Routes #

Route under /api/v1Content
gamesThe games this node knows, with counts
games/records?game=&type=&limit=&cursor=The GAME records, decoded or not
games/BETB/bubbles?status=&address=&author=&limit=&cursor=The games of BetBet
games/BETB/bubble/<txid>One game
games/BETB/events, leaderboard, player/<address>, statsSteps, ranking, one player, totals
games/tx/<txid> (12.5.13)What one transaction did: its steps, the player it added, the state after it, its records

Lists are newest first, 200 rows at most; the leaderboard is ordered by won, wins or streak. The same views are read over P2P (P2P integration). A row names the author it pays; the node applies no list of accepted authors.

The "Lotus bot" tag #

Automated players may play like anyone else: same scripts, same odds, same fees. A bot marks itself on the chain with its own key, and the wallet and the explorer show a "Lotus bot" tag next to it. A mark is a claim a key makes about itself: nobody can mark somebody else. The tag changes no rule, no order of a list and no amount.

Source share/www/docs/games.md in the lotusd repository
Checked against doc/games/README.md doc/games/betbet.md doc/games/node.md src/modules/games/games_module.cpp