Watcher Operator Guide
Watcher nodes are decentralized sentinels that independently probe service endpoints and submit cryptographic attestations to Stellar Soroban.
Node Requirements
To operate a watcher node reliably:
- Compute: 1 vCPU, 1 GB RAM (minimal footprint).
- Runtime: Go 1.22+ or Docker.
- Network: Stable, unmetered egress connectivity to public internet and Stellar RPC.
- Stellar Account: A dedicated keypair with a modest XLM balance on Testnet to pay transaction fees.
1. Keypair Generation & Registration
- Generate a dedicated Stellar keypair for the watcher node using
stellar-clior Stellar Laboratory. - Fund the public key using Stellar Friendbot.
- Submit the public address (
G...) to the SLASettle registry administrator for inclusion viawatcher_registry.register_watcher(admin, watcher_address). - Verify registration on-chain:bash
stellar contract invoke \ --id CDRNXUPCZTVZXKPWNBQZAYI6HYFNBDHRO2KNNJSMDVTEHFOM7LCMOYMF \ --source <ANY_ACCOUNT> \ --network testnet \ -- is_watcher --watcher <WATCHER_PUBLIC_KEY>
2. Configuring the Watcher Daemon
The Go watcher daemon is located in services/watcher. Configure the daemon using environment variables or a .env file:
bash
# Network & RPC
STELLAR_NETWORK_PASSPHRASE="Test SDF Network ; September 2015"
SOROBAN_RPC_URL="https://soroban-testnet.stellar.org"
# Contract Addresses
WATCHER_REGISTRY_CONTRACT_ID="CDRNXUPCZTVZXKPWNBQZAYI6HYFNBDHRO2KNNJSMDVTEHFOM7LCMOYMF"
SLA_VAULT_CONTRACT_ID="CDBFPYHJNYSIFXSMXF3BBDWPKHRS7SJFFEKMQ5WJXYTBMD4LFAG2CHLN"
# Watcher Identity & Signing Key
WATCHER_SECRET_KEY="S..."
# Monitored Agreement Configuration
SLA_ID=2
TARGET_ENDPOINT="https://api.example.com/health"
PROBE_INTERVAL_SECONDS=60
PROBE_TIMEOUT_SECONDS=53. Running the Daemon
Compile and start the daemon:
bash
cd services/watcher
go build -o watcher-node cmd/watcher/main.go
./watcher-nodeOperational Loop
Each cycle, the daemon:
- Computes
round_id = unix_time / PROBE_INTERVAL_SECONDS. - Queries
has_watcher_votedonwatcher_registry. If already voted, it skips to the next cycle. - Performs an HTTP GET request to
TARGET_ENDPOINTwith a 5-second timeout. - If response is HTTP 200 within timeout $\to$ votes
UP(1). - If timeout, connection failure, or HTTP 5xx $\to$ votes
DOWN(2). - Constructs and signs
submit_checktransaction on Stellar. - Submits to Soroban RPC and waits for ledger confirmation.
4. Best Practices for High Availability
- Run as a System Service: Deploy using
systemdor Docker withrestart: always. - Alert on Low Balance: Ensure the watcher account retains at least 5 XLM to cover ongoing transaction submission fees.
- Log Aggregation: Monitor stdout logs for network timeouts, RPC rate limits, and confirmed transaction hashes.