Skip to content

Watchdogs

A watchdog builds its own copy of the truth from the relays, probes indexers at random, and publishes signed reports.

Audit

Every AUDIT_SECONDS, for each known indexer:

  1. Up to PROBES registries are chosen at random. Registries with events seen less than GRACE_SECONDS ago are skipped, so propagation delay is not counted as a fault.
  2. The indexer is asked for each, with a fresh nonce.
  3. The answer is verified and compared with the truth.
Verdict Meaning
consistent The answer verifies and nothing is missing
omission Events are missing
invalid The answer does not verify

The signed answer is stored as evidence. Answers are also compared with earlier ones: the same sequence number with different content is equivocation, and both transcripts are included in the report as proof.

Score

100 * (answered - omissions) / probes, minus 10 if the average latency exceeds two seconds. Invalid answers and equivocation give 0.

Relay coverage

Every minute the watchdog reconciles with each relay and records how many known events it is missing.

Configuration

Variable Default Meaning
RELAYS none Relays to follow, audit and publish to
GRACE_SECONDS 120 Age an event must have before it counts
AUDIT_SECONDS 300 Interval
PROBES 20 Registries probed for each indexer
ALLOW_PRIVATE false Allow private addresses
DATA_FILE, KEY_FILE /data/watchdog.db, /data/watchdog.key Storage

API

Method and path Content
GET /v1/info Key and role
GET /v1/reports Reports of this watchdog
GET /v1/evidence/{id} Verdict and signed transcript
GET /v1/coverage Missing events for each relay

Readers choose whom to believe with -watchdog or WATCHDOGS. Use several watchdogs operated by different parties.