Quick start
This walkthrough runs the repository's standard local network: three witness
nodes, a gateway on port 8080, and a threshold of two witnesses. It is a
development/demo setup, not a production deployment.
1. Build the binaries
From a machine with Rust and SQLite available:
git clone https://git.carpocratian.org/sibyl/witness.git
cd witness
cargo build --release
The CLI binary is target/release/witness.
2. Start the example network
Run these commands from the repository root:
./examples/setup.sh
./examples/start.sh
setup.sh generates local signer keys and a separate log key, then writes the
example configuration. It refuses to replace an existing network.
start.sh launches witnesses on ports 3001–3003 and the gateway on
http://localhost:8080, setting the required
WITNESS_JOB_SIGNING_WINDOW_SECS to 300 seconds unless you override it.
3. Submit and poll a job
Submit a file. The CLI computes its SHA-256 hash locally and sends only that hash to the gateway:
target/release/witness attest --file README.md
The response includes the hash and a job status. Job creation is asynchronous:
the first response may be Pending or Retryable, and it may not contain a
signed attestation yet. Poll the same hash until the status is Confirmed:
HASH="$(shasum -a 256 README.md | awk '{print $1}')"
target/release/witness status "$HASH"
Run status again after a short wait if the job is still pending. A confirmed
response reports the verified signature count. Failed is terminal and may
include the last worker error.
You can also submit a known 64-character, hex-encoded SHA-256 hash directly:
target/release/witness attest --hash "$HASH"
4. Save and verify the signed attestation
Once the job is confirmed, save its response. verify accepts the confirmed
job snapshot directly; extracting the nested signed_attestation object is
also supported:
target/release/witness attest --hash "$HASH" --save /tmp/attestation.json
jq -r '.signed_attestation' /tmp/attestation.json > /tmp/attestation-signed.json
# Demo only: get the public keys from your own local gateway
curl -fsS http://localhost:8080/v1/network > /tmp/pinned-network.json
target/release/witness verify /tmp/attestation-signed.json \
--network-config /tmp/pinned-network.json --hash "$HASH"
# Equivalently, using the saved job snapshot:
# target/release/witness verify /tmp/attestation.json --network-config /tmp/pinned-network.json --hash "$HASH"
verify checks the signatures locally against the key file you pass with
--network-config and rejects a receipt for any hash other than --hash (or
the SHA-256 of --data). For a real deployment, obtain the public-key file
independently of the gateway. --trust-gateway explicitly lets the gateway
choose the keys and threshold. A valid result prints VALID and "existed
no later than," using the latest counted signer clock reading; an
invalid result prints INVALID and exits non-zero in text mode or reports
"valid": false and exits non-zero in JSON mode. Nonconfirmed or malformed job
snapshots are rejected. To also require that the receipt appears in a
signed log checkpoint, wait for a covering checkpoint (the default batch
interval is 60 seconds), then run:
target/release/witness verify-proof --hash "$HASH" \
--network-config /tmp/pinned-network.json --require-log-inclusion
5. Run the bundled demo
The repository includes the same end-to-end flow, including polling and verification:
./examples/demo.sh
When finished, stop all local processes:
./examples/stop.sh
The scripts leave generated configuration, logs, and the example SQLite
database under examples/, along with signer checkpoint state after signing.
Do not reuse the generated local keys or tokens
for a real deployment.