Skip to content

Key management

Key material and bearer credentials are the most important operational assets in a Witness deployment. The project is pre-1.0 and unaudited; use protected hosts, access-controlled files, and a credential process appropriate to the deployment. Do not commit keys, tokens, or secret-bearing network.json or witness.json files.

Signing keys

Each signer has one Ed25519 private key. Generate it on the signer's own host with a secure operating-system random source:

target/release/witness-node --generate-key

The private key belongs in that signer's protected witness.json (mode 0600). Share only the public key with whoever maintains network.json. The gateway never needs a signer's private key.

The gateway holds a separate Ed25519 log key. Keep the seed in a protected file and give signers only the public key and log origin. External witnesses need the log's C2SP verifier key, not the seed.

Each signer also keeps a checkpoint state file (checkpoint_state_path) that records the last log checkpoint it signed. Back it up with the same care as the key: a signer that loses this file will accept the next checkpoint it is shown as a fresh start, which weakens protection against a gateway showing different log histories to different people. Never copy one signer's state file to another.

Choosing signers and the threshold

  • The threshold must be a majority of signers (for example 2 of 3, 3 of 5, 4 of 7). Configurations that allow two disjoint signer groups to each reach the threshold are rejected.
  • A majority only guarantees the two groups overlap in 2m - N signers. For 2 of 3 that is one signer, so a single dishonest signer can help the gateway get two different log histories signed. A higher threshold (for example 4 of 5, overlap 3) raises that bar at the cost of tolerating fewer offline signers.
  • Signers only add security if they fail independently: different administrators, credentials, hosts, backups, and time sources.

Bearer credentials

Protect all of these separately and use high-entropy, deployment-specific values:

  • each signer's signing_auth_token in witness.json and matching gateway auth_token in network.json;
  • WITNESS_ADMIN_API_KEY;
  • WITNESS_METRICS_TOKEN and WITNESS_WS_AUTH_TOKEN.

The gateway validates that every signer auth_token is present and non-empty at startup. Verification responses omit these tokens; do not assume a raw configuration file is safe to publish.

The node accepts previous_signing_auth_token as well as the current token, giving an overlap window for bearer-token rotation. That is not signing-key rotation.

Rotating signing keys (key epochs)

Each receipt names the key set (key_epoch) that signed it. A checkpoint's key set is identified by checking its signatures. A key change moves the network to the next epoch through a signed key transition that clients can verify starting from any key file they pinned earlier. See Protocol v2 for the exact rules.

  1. Drain. Stop accepting submissions (or wait until no jobs are pending); signers reject requests for any epoch but their own.
  2. Draft the transition body (KeyTransitionBody): network_id, from_epoch, from_key_set_digest (print it with witness keys digest --network-config current-network.json), the new key set (to: epoch + 1, signers, threshold, log_public_key), effective_at, reason (routine or compromise), and for a compromise the final_checkpoint (tree size and root of the last checkpoint you trust).
  3. Collect signatures. Each current signer and each new signer runs:
witness-node --config witness.json sign-key-transition --body body.json

and returns the printed signature. You need the minimum count from both the old and the new key sets. 4. Publish. Append the assembled KeyTransition to the key-history file the gateway serves (--key-history / WITNESS_KEY_HISTORY), set key_epoch and the new signers in network.json and each signer config, and restart. If rotating the log key, also update log.public_key, the gateway seed file, each signer's log_public_key, and the log verifier key at each external witness. Keep the same origin and tree. Arrange these changes with the external witness operators before switching keys. 5. Distribute. Give clients the new public key file. Clients holding the old file can follow the history automatically after a routine change.

After a compromise

Whoever holds enough of the compromised keys can also sign a transition to keys of their choosing, so clients must re-pin the new key file through a channel other than the gateway. Receipts from the compromised epoch are then accepted only if they are in the log at the transition's final_checkpoint; use witness verify-proof --require-log-inclusion to check them.

Keep keys and tokens out of logs, backups that lack access control, shell history, and incident reports. The node zeroizes configured key and token strings when its configuration is dropped, but this does not protect source files, the running host, or previously exposed copies.