Codemojex · C2.3
The secret and its commitment.
A game draws a secret of six distinct codes from its snapshotted keyboard. The secret is a server-side column, selected by no player-facing query. A blind golden game commits to it at open and discloses it at close — so a game a player must trust becomes a game a player can check.
Grounding — Codemojex.Rooms (seal_commitment/3 · commit/2 · close_sealed/2) · schemas/game.ex · the golden-blind story.
The drawn secret
rooms.ex · game.exstart_game/3 draws secret = EmojiSet.secret_from(cell_codes) — six distinct codes from the game’s snapshotted keyboard. The games row stores the secret and cell_codes; the schema moduledoc states it in plain terms: the secret is a server-side column and is never serialized to players.
No player-facing view selects it — the privacy boundary is structural, not a filter at the edge (C1.3). A classic game keeps the secret and pays live; a golden game seals it under a commitment and discloses it once, at close.
The commitment
commit/2A commitment is a promise the server cannot later alter. seal_commitment/3 draws a nonce (16 random bytes as 32 hex chars) and hashes the secret with it. Step through the preimage the hash is taken over.
XXYY codes.iex> secret = ["0305", "0904", "0801", "0610", "0007", "0213"] iex> nonce = "9f2c1ab7d4e6083f5c1904ea2b7d6c8e" iex> Codemojex.Rooms.commit(secret, nonce) "6896208bd5f4b76b7fcbf56c3d8486cba37c68366dd32d86459424961e360100"
Reveal and verify
close_sealed/2At close the sealed pass sets status: :revealing, stamps revealed_ms (the privacy gate opens), pays the top-K their split, and broadcasts one event carrying the secret, the nonce, the commitment, the final board, and the payouts. Any player recomputes SHA-256(secret ‖ nonce) and checks it against the commitment fixed at open. Because the commitment bound the server before any guess was made, the check needs no trust.
Scenario: the sealed close reveals the secret and the commitment verifies
Given a golden game with a scored guess, subscribed for the disclosure
When the game is closed (the sealed pass runs)
Then one event arrives whose secret + nonce recompute
to the published commitment
The blind mode also has an anti-abuse edge: with no per-guess signal, a feedback-driven bot cannot hill-climb toward the secret, and the all-pay fee gives blind farming a negative expected value.
References
sources · relatedSources
- Commitment schemes — commit and revealthe hiding and binding the commitment relies on
- Mastermind — the board gamethe hidden code the commitment fixes in advance
Related
- C2 — Rooms, Modes, and the Secretthe chapter hub
- C2.2 — The emoji setthe keyboard the secret is drawn from
- C1 — The Game as Branded Systemsthe structural privacy boundary