Witnesses¶
A witness receives key events of identifiers that designate it, verifies them, stores them in an append-only log, and signs receipts. An event with receipts from enough witnesses is witnessed: its controller cannot later present a different event at the same position to others without being caught.
How an event is processed¶
- The event is parsed and checked: canonical encoding, digest, field layout.
- Whether the event concerns an identifier that designates this witness is determined. If it does, access and quota are checked.
- Signatures, sequence, prior digest, thresholds and delegation are verified.
- The event is stored, and a receipt is signed and stored.
| Outcome | HTTP | Meaning |
|---|---|---|
accepted |
200 | Stored. receipt is included if this witness is designated |
duplicate |
200 | Already stored. The receipt is returned again |
escrowed |
202 | Waiting for an earlier event, a delegation or receipts. Retried automatically for an hour |
denied |
403 | The identifier is not enrolled |
duplicity |
409 | A different event is stored at this position |
rejected |
422 | Invalid |
limited |
429 | Daily quota exhausted |
API¶
| Method and path | Purpose |
|---|---|
POST /v1/events |
Submit {"event", "sigs", "receipts"} |
GET /v1/kel/{aid}?nonce=&from=&to= |
Signed proof: key state, entries with signatures and receipts |
POST /v1/receipts |
Submit up to 64 receipts of other witnesses |
GET /oobi/{aid} |
Introduction: identifier, witness and address |
GET /v1/info |
Identifier of this witness |
GET /healthz |
503 if an integrity check failed |
GET /metrics |
Prometheus metrics |
A proof is an envelope {"payload", "aid", "sig"}. The payload contains your nonce, so it cannot be replayed.
Configuration¶
| Variable | Default | Meaning |
|---|---|---|
ADMIN_TOKEN |
required | At least 16 characters |
ACCESS |
registered |
registered or open |
RELAY_URL |
none | Relay to receive events from and publish receipts to. Without it, the HTTP API is used |
PUBLIC_URL |
none | Address in introductions |
INTEGRITY_SECONDS |
60 |
Interval of the integrity check |
SEED_FILE |
/data/seed |
Signing seed |
GENERATE_SEED |
true |
Create the seed if missing |
DATA_FILE |
/data/witness.db |
Database |
RATE_PER_SECOND |
50 |
Requests per second and address, with a burst of four times as many |
METRICS_TOKEN |
none | Token for /metrics |
TLS_CERT, TLS_KEY |
none | Serve HTTPS |
LISTEN |
:8080 |
Listen address |
Choosing witnesses¶
Designate several witnesses that are operated independently. With four witnesses and a threshold of three, one may fail or be dishonest. The seed is the witness's identity: back it up, and never run two witnesses with the same seed.