Run Oracle as HTTP Server
Instead of using the CLI, you can run the oracle as an HTTP server that accepts observation requests via API:
felidae oracle server \
--homedir /persistent/keys \
--node http://localhost:26657 \
--bind 127.0.0.1:8081
The server exposes three endpoints:
GET /pow-challenge?domain=<domain>- Request a Proof of Work (PoW) challenge for a domain. Returns JSON:{"challenge": "<hex>", "timestamp": <unix_secs>, "difficulty": <bits>}. The client must find anoncesuch thatSHA256(challenge + nonce)has at leastdifficultyleading zero bits, then submit that in the observe request.POST /observe- Submit an observation request. Requires a valid PoW token (see below). JSON body:{"domain": "example.com.", "pow_token": {"challenge": "<from /pow-challenge>", "nonce": <u64>, "timestamp": <from /pow-challenge>}}.GET /health- Health check endpoint.
Client-side PoW flow:
GET /pow-challenge?domain=example.com.to receivechallenge,timestamp,difficulty.- Find a
nonce(e.g. by incrementing from 0) such that the SHA256 hash ofchallenge + noncehas at leastdifficultyleading zero bits. POST /observewith{"domain": "example.com.", "pow_token": {"challenge": "...", "nonce": <found>, "timestamp": <same>}}.
Tokens are valid for 5 minutes. PoW difficulty can be tuned with the POW_DIFFICULTY environment variable (default 19, minimum 8).
Example (after computing a valid nonce for the challenge):
curl -X POST http://localhost:8081/observe \
-H "Content-Type: application/json" \
-d '{"domain": "example.com.", "pow_token": {"challenge": "<from /pow-challenge>", "nonce": 12345, "timestamp": 1700000000}}'