Validator
The Validator is a continuous service that tests relay candidates with a live WebSocket handshake and promotes successful ones to the relay table.
Purpose
Section titled “Purpose”Not every URL discovered by the Seeder or Finder is an active Nostr relay. URLs may be stale, point to non-Nostr services, or be unreachable. The Validator filters candidates by attempting a real WebSocket connection and verifying that the endpoint speaks the Nostr protocol.
How It Works
Section titled “How It Works”- Fetches a batch of unvalidated candidate URLs from the database.
- For each candidate, grouped by network type (clearnet, Tor, I2P, Lokinet):
- Opens a WebSocket connection (with appropriate proxy for overlay networks).
- Sends a Nostr protocol handshake.
- Verifies the response indicates a valid Nostr relay.
- Promotes successful candidates to the
relaytable. - Marks failed candidates for retry with exponential backoff.
- Sleeps, then repeats.
Configuration
Section titled “Configuration”interval: 120 # seconds between cycles
processing: chunk_size: 100 # candidates per cycle
networks: clearnet: timeout: 15 max_tasks: 50 tor: enabled: true timeout: 45 max_tasks: 10 proxy_url: socks5://tor:9050 i2p: enabled: true timeout: 60 max_tasks: 5 proxy_url: socks5://i2p:4447 loki: enabled: true timeout: 45 max_tasks: 5 proxy_url: socks5://lokinet:1080
cleanup: enabled: false max_failures: 100# Run continuouslypython -m bigbrotr validator
# Run a single validation cyclepython -m bigbrotr validator --onceMetrics
Section titled “Metrics”The Validator exposes Prometheus metrics on port 8002:
service_counter{name="validated"}— total relays successfully validatedservice_counter{name="failed"}— total validation failuresservice_gauge{name="candidates_pending"}— current unvalidated candidatescycle_duration_seconds— time per validation cycle