> ## Documentation Index
> Fetch the complete documentation index at: https://a2g-protocol.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Fairness Proof Messages

> Optional provably fair seed commitment and reveal mechanism.

<Note>
  A2G is a communication protocol. It does not prescribe how game servers implement RNG or determine outcomes. The operator's certified systems are authoritative for game outcomes. These messages provide an **optional transport mechanism** for exposing fairness data to clients.
</Note>

Servers that set `capabilities.provablyFair: true` in their `hello` message MAY include fairness proof messages in the game flow. Servers that do not support provably fair verification set `capabilities.provablyFair: false` and MUST NOT send these messages.

| Type              | Direction | Description                                 |
| ----------------- | --------- | ------------------------------------------- |
| `seed_commitment` | S → All   | Hash of server seed, broadcast before round |
| `seed_reveal`     | S → All   | Actual seed revealed after round completion |

## seed\_commitment

**Direction:** Server → All clients (before the round begins)

```typescript theme={null}
{
  type: "seed_commitment",
  gameType: string,
  tableId: string,
  handId: string,
  seedHash: string,             // SHA-256(serverSeed)
  messageId: string,
  timestamp: number
}
```

The server publishes a hash of the seed that will be used for this round. Since clients see the hash before playing, the server cannot change the seed after the round begins.

## seed\_reveal

**Direction:** Server → All clients (after the round completes)

```typescript theme={null}
{
  type: "seed_reveal",
  gameType: string,
  tableId: string,
  handId: string,
  seed: string,                 // The actual seed value
  algorithm: "sha256",
  messageId: string,
  timestamp: number
}
```

## Client Verification

After receiving `seed_reveal`, clients can verify that:

```
SHA-256(seed) === seedHash
```

If the hash matches the earlier commitment, the seed was not changed after the round began. Clients can then replay the game's RNG using the revealed seed and the algorithm described in the game specification to verify all random outcomes.

## Scope

These messages provide a **transport layer** for fairness data. They do not replace or override the operator's certified RNG systems. For operators using lab-certified RNG, the fairness proof mechanism is additive — it provides an additional transparency layer without affecting how outcomes are determined.

Servers that implement provably fair games MUST:

* Broadcast `seed_commitment` BEFORE any outcome-determining action (dealing, spinning)
* Reveal seeds ONLY after the round completes
* Use a deterministic algorithm described in the game specification
* Allow clients to verify outcomes using only the revealed seed and algorithm
