Skip to content

Introduction

gammonchain is an open-source, browser-based backgammon server. The public instance runs at gammonchain.com. You can play there without signing up: your browser makes a key on first visit, and that key is your identity.

What makes it different: every game can be checked. The dice come from a protocol that neither the server nor either player can predict or steer. Every event in a match is hashed into a chain and signed. When a match ends, anyone can download the record and re-check it offline with a verifier they run themselves. They do not have to trust the server.

Why it exists

Distrust of the dice is the most common complaint in online backgammon. Players lose to a run of doubles and conclude the site is rigged. Without a way to check, the only answers are "trust us" or a forum argument.

gammonchain turns that complaint into a question you can answer with maths:

  • Were the dice predetermined or steered? Re-derive every roll from the secrets revealed at the end of the match. Each roll is HMAC-SHA256 over inputs that were committed before the first die. See Dice fairness.
  • Was the record edited afterwards? Recompute the hash chain and check the signatures. See Signed records & the hash chain.
  • Were the plays legal, and does the score follow from them? Replay the match through the open rules engine. See Verification.
  • Did I lose because I played badly or because the dice were bad? Analysis splits each player's result into equity lost through mistakes and luck from the rolls. See Analysis & PR.

The README states the aim this way: no other platform combines open source, free analysis and verifiable fairness.

What is in the box

piecewhat it does
rules engine (src/core/)backgammon rules, the dice protocol and the hash chain. The same modules run on the server, in the browser and in the verifier, so there is only one implementation
verifier (src/verify/)re-checks a downloaded record from scratch, in the browser or on the command line
server (src/server/)HTTP routes and WebSockets, one actor per live match, the lobby, SQLite storage, ratings, mail, backups
analysis (src/analysis/)match equity table, engine adapters (built-in, gnubg, BGBlitz), the queue that volunteer workers pull from
client (public/)plain ES modules with no build step: SVG board, identity, settings
deploy (deploy/)scripts for a single VPS: provisioning, firewall, Caddy, push-to-deploy

Licences

The licence depends on the component (LICENSE):

pathlicence
src/core/**, src/verify/**, src/analysis/**, bridge/**, bin/**MIT
everything else (server, client, tests)AGPL-3.0-or-later

The reason: anyone should be able to embed the parts needed to check a game, with no obligations attached. A verifier nobody can use is not a verifier. The server is AGPL so that hosted forks stay open.

Run it locally

bash
npm install
npm start                       # http://localhost:8080

Open two browser tabs to play yourself, or start a bot game. For a strong hard bot and engine-grade analysis, install GNU Backgammon first (brew install gnubg on macOS). The server finds it automatically. Without gnubg everything still runs, but the hard bot falls back to the built-in evaluator. /healthz reports which engine was selected.

Docker runs the server plus an analysis worker, with gnubg already in the image:

bash
docker compose up --build       # http://localhost:8080

To self-host in public, start with Architecture.

What is deliberately not here yet

According to the README, these are not built yet: tournaments, rollouts, a public Merkle root over daily record hashes, a cubeful match equity table, and a neural-net evaluator. The built-in engine is a heuristic. For real strength, install gnubg.

Rules engine, fairness protocol, verifier, analysis and worker: MIT. Server and client: AGPL-3.0-or-later.