Skip to content

Storage model

The gateway stores jobs, receipts, batches, and checkpoints in SQLite. It uses write-ahead logging (WAL) and embedded, forward-only migrations. Keep the database on persistent local storage, not a network filesystem. Run one gateway process per database.

Table What it stores
attestations One record per hash: network, key epoch, timestamp, sequence, job state, lease, and retry fields.
signatures Individual signer signatures with their signed_at.
sequences Next sequence numbers per network.
batches Batch records, including their Merkle roots.
batch_attestations Receipt membership and position within a batch.
checkpoints Published C2SP signed notes, indexed by network and tree size, with root, verified key epoch, and freshness time.
log_tips, log_positions, log_nodes Closed size and last batch, receipt positions, and complete subtree hashes for tiles and proofs.

The gateway allocates a sequence and saves the job in one transaction. A worker claims the job with an expiring lease. Completion requires the current lease and matching record, and the gateway only exposes receipt signatures after confirmation. The log commits to the full receipt record, not just the submitted hash. Subtree hashes and receipt positions are indexed when the batch closes.

Each signer keeps separate state on its own disk: the last tree size and root it accepted for its log origin, along with the signed note. Preserve that file across restarts and key changes. The gateway serves key history from its configured file; back it up separately from SQLite.

SQLite is operational state, not tamper-evident evidence. See Backups and the v0.11 migration guide before moving existing data.