> For the complete documentation index, see [llms.txt](https://docs.fast.poker/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fast.poker/architecture/on-chain-program.md).

# On-chain program

The Fast Poker on-chain program owns table rules, vault movement, reward accounting, and settlement.

## Major instruction groups

| Group                | Examples                                                                                                                                                        |
| -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Player and SNG setup | Register player, initialize SNG tables, seats, and vaults.                                                                                                      |
| Legacy cash recovery | Cash out, refund, settle rewards, and close retired cash tables.                                                                                                |
| SNG joining          | Join pool, seat from pool, cancel stale queue state.                                                                                                            |
| Gameplay             | Start hand, deal, player action, reveal, settle hand, timeout.                                                                                                  |
| Fairness             | Deck commitment, reveal proofs, hand report output.                                                                                                             |
| Rewards              | Settle historical cash rake, sync dealer rewards, and claim rewards.                                                                                            |
| SNG completion       | Finalize a per-game settlement record, credit claimable SOL/Raw $FP, close jackpot entries, finalize rewards, assert clean state, reset, then close the record. |
| Flat Bounty          | Conserve 6/9 points across side-pot-eligible knockouts and split SOL/$FP by final point weights.                                                                |
| Emission governance  | Snapshot format/tier/supply emission through `EmissionCtrl` and the matching `PoolIdle`.                                                                        |

Record-enabled and duel-mode tables fail closed when their mandatory sidecar or record is missing, invalid, stale, unpaid, or still active. The program does not silently fall back to legacy prize logic for those modes. | Admin recovery | Timelocked recovery and repair paths. |

## Retired cash tables

New cash tables, deposits, seats, top-ups, tips, and hands are rejected. The legacy account and instruction surface remains only so existing balances can be cashed out or refunded, rewards can settle, and empty tables can close without stranding funds.

## SNGs

SNGs are pool-based. Players join a tier/format pool. When enough players are queued, the table activates, plays, settles, and resets for reuse.

## Source of truth

The on-chain program is the source of truth for:

* Who owns a seat.
* How much is in a table vault.
* Whether a hand reached the flop.
* How rake and fees split.
* Who won a pot or tournament.
* Which rewards are claimable.

Docs and frontends describe the protocol. The code enforces it.
