Skip to content

Run a witness

witness-node is the signing service for one witness. It holds one Ed25519 private key and answers gateway signing requests. It is pre-1.0 and unaudited; run it only on a host and network path you control.

Build and generate a key

Build the binary from the workspace root:

cargo build --release -p witness-node

Generate an Ed25519 keypair with the repository's key generator:

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

Keep the private key secret. Give the public key and witness ID to the network coordinator; do not give the private key to the gateway or publish the witness.json file.

Configuration

The default configuration path is witness.json. The node configuration has these operational fields:

{
  "id": "witness-1",
  "signature_scheme": "ed25519",
  "private_key": "<32-byte-hex-private-key>",
  "host": "127.0.0.1",
  "port": 3000,
  "network_id": "my-network",
  "key_epoch": 1,
  "log_origin": "example.org/witness/my-network",
  "log_public_key": "<32-byte-hex-log-public-key>",
  "checkpoint_state_path": "/var/lib/witness/checkpoint.json",
  "signing_auth_token": "<high-entropy-secret>",
  "max_clock_skew": 300,
  "require_clock_sync": false,
  "clock_recovery_secs": 60
}

private_key is a 32-byte Ed25519 seed. signing_auth_token is required and must be non-empty. previous_signing_auth_token allows temporary overlap while rotating that token. The network_id and key_epoch must match the gateway's config. Set max_clock_skew (default 300 seconds) no higher than the network's time_policy.max_skew_secs. Set log_origin and log_public_key to the gateway's log.origin and log.public_key. The signer ID becomes its C2SP name; see the naming rules.

checkpoint_state_path is required. A relative path is resolved next to the config. Create its parent directory, writable by the service account, on persistent storage. Run one process per signing identity and state file. Keep the state across restarts and key changes; without it the signer cannot check new checkpoints against the previous tree.

The node validates the key and token at startup. Keep the configuration file access-controlled: the private key and bearer tokens are operational secrets, even though the process zeroizes those string fields when its configuration is dropped.

Start and bind

Start with the config defaults:

target/release/witness-node --config /etc/witness/witness.json

Override the bind host or port only when the network design requires it:

target/release/witness-node \
  --config /etc/witness/witness.json \
  --host 127.0.0.1 \
  --port 3000

The node speaks plain HTTP and defaults to loopback. Restrict /v1/sign and /add-checkpoint to trusted gateways.

Endpoints and checks

  • GET /health reports clock: "ok" or "unhealthy"; an unhealthy clock returns 503 and the signer refuses signing requests.
  • GET /v1/info reports the node ID, public key, and network ID.
  • POST /v1/sign signs a receipt and requires Authorization: Bearer <signing_auth_token>.
  • POST /add-checkpoint checks the log signature, then checks and signs the checkpoint. It does not take a bearer token.
  • GET /<origin hash>/checkpoint returns the latest note this signer signed. The origin hash is the lowercase hex SHA-256 of log_origin.

Each of these routes has its own 60 requests/minute/IP limit. Receipt signing checks the network, epoch, and max_clock_skew.

After detecting a wall-clock jump the signer pauses for clock_recovery_secs (default 60). On Linux you can set require_clock_sync: true to also refuse while the kernel clock is unsynchronized; this setting is rejected on other platforms. Use independent time sources: a healthy clock probe cannot detect a consistently wrong source.