Skip to content
Docs
Request access

Anchor the ledger to Git

Anchoring lets someone check a ledger against history kept outside its database. See The ledger and anchors for the idea.

  • A team with at least one run in its ledger, for example after the Quickstart.
  • Git, and a clone of a repository you own that is used only for anchors. Its remote must be an SSH address.
  • A deploy key (SSH) for that repository if you want the export to push. Without --push the anchors are committed in the clone only.
  • A place outside every repository for the two key files.
Key Job Where it lives
Signing key (Ed25519) Signs each anchor. Verifiers hold the public half. A file outside Git and the database, mode 0600
Deploy key (SSH) Lets the exporter push to the anchor repository. It signs nothing. A file outside every repository; its path comes from NURAMESH_ANCHOR_SSH_KEY

Never put either key in the repository, a flag value or a log.

Terminal window
# 1. Create the signing key pair. The private key is written with mode 0600.
nuramesh anchor keygen --private /path/to/signing-key --public /path/to/signing.pub
# 2. Export the current heads to an anchor repository (a clone you own)
export NURAMESH_ANCHOR_SSH_KEY=/path/to/deploy-key
nuramesh anchor export --team my-team --repo ../anchors-clone --key /path/to/signing-key --push
# 3. Or export at the end of a run
nuramesh try my-team --fake --anchor-repo ../anchors-clone --anchor-key /path/to/signing-key --anchor-push
# 4. Verify against the anchors
nuramesh ledger verify --team my-team --anchors ../anchors-clone --pubkey /path/to/signing.pub --require-anchors

Check the exact options in the CLI reference.

  • It makes ledger-anchors the checked-out branch on first use, commits the new anchors and pushes exactly refs/heads/ledger-anchors.
  • It never pushes main, never forces and never sends tags. If the remote branch moved on, the push is refused and the anchors stay committed locally.
  • The remote must be an SSH address. SSH runs with that key only, no ssh config file, a host key that is already known and no prompts.
  • A run with nothing new commits nothing. Running the export hourly from cron is fine.

Deploy keys on GitHub are per repository, not per branch, so “only ledger-anchors” is enforced by this code. Someone who holds the deploy key can force-push the branch and erase anchors. A rule on the anchor repository that blocks force-push, and a verifier that keeps its own clone and fetches with --ff-only, close that gap. Both are listed in the security overview.

Run the fourth command of the steps:

Terminal window
nuramesh ledger verify --team my-team --anchors ../anchors-clone --pubkey /path/to/signing.pub --require-anchors

It exits 0 when every stream’s chain is intact and matches its signed anchor. With --require-anchors a stream that has no anchor is a failure, not a pass. In the clone, git log ledger-anchors shows one commit for each export that had something new.

You see Do this
The push is refused The remote branch moved on. The anchors stay committed in your clone: fetch, look at what changed on ledger-anchors, then export again. The exporter never forces
SSH fails without asking anything SSH runs with the deploy key only, no ssh config file and no prompts. The host key must already be known on this machine, and NURAMESH_ANCHOR_SSH_KEY must point at the key file
The export commits nothing Nothing is new since the last export. That is normal
Verification fails with --require-anchors A stream has no anchor yet. Export first, then verify

Was this page helpful?