# Registry checkpoints

The event registry can show that its own files form one intact chain. On its
own, however, it cannot tell a returning visitor that the service has shown
them an older copy or a different branch.

A checkpoint gives the visitor something small to remember. It contains:

- the number of events observed;
- the digest of the last event in that prefix;
- the digest of the previous checkpoint;
- the issuer and signing key;
- an integrity digest and issuer signature.

The first checkpoint is a trust anchor. Each later checkpoint extends the one
before it. A verifier that keeps the last trusted checkpoint can reject a
shorter registry, a changed event at the anchored position, or a second
checkpoint branch with the same predecessor.

## Creating a checkpoint

```ts
const checkpoint = await createV1RegistryCheckpoint(registry, {
  id: "checkpoint:gallery-example:2026-07-29",
  signing,
  registryIssuers: [artistIssuer],
  previousCheckpoint,
});
```

Creation checks every registry event and its issuer signature first. The
checkpoint signing key must be active. A retired key may verify an older
checkpoint but cannot create a new one.

## Verifying a checkpoint

```ts
const report = await verifyV1RegistryCheckpoint(checkpoint, {
  issuer: checkpointIssuer,
  registry,
  registryIssuers,
  observedCheckpoint: checkpointSavedEarlier,
});
```

`valid` covers the checkpoint digest, registry anchor, and relationship to the
earlier observation. `trusted` means the checkpoint signature matches a
trusted key in the supplied issuer record.

The command-line equivalent is:

```bash
open-print-verify-checkpoint \
  checkpoint.json issuer.json registry.json observed-checkpoint.json
```

## What checkpoints do not do

A checkpoint is not a global ledger and does not require a network. It only
helps when a verifier keeps an earlier checkpoint or receives one through
another trusted route. Two first-time visitors shown two different histories
cannot detect that split until they compare their observations.

Git, an institutional archive, removable media, or a preservation mirror can
all carry checkpoint files. Open Print does not require any particular host.
