Skip to content

Getting Started

1. Start the services

cd src/oracle
../support/deploy/scripts/up.sh
deploy/scripts/up.sh

The first script starts witnesses, watchers and notaries. The second creates an oracle tenant on each, starts a committee of four members, and the oracle service on port 7700.

2. Create an oracle

. deploy/.state/secrets.env
curl -s -X POST http://127.0.0.1:7700/oracles -H "Authorization: Bearer $ADMIN_TOKEN" -H "Content-Type: application/json" \
  -d '{"schema": "BTC/USD", "method": "median", "quorum_threshold": 3}'
{"aid": "E...", "policy": {"d": "E...", "kind": "oracle", "schema": "BTC/USD"}, "ready": true}

The policy is shortened here. Note the identifier and the digest d of the policy. If ready is false, the service completes the inception in the background.

3. Look at it

curl -s http://127.0.0.1:7700/oracles
curl -s http://127.0.0.1:7700/oracles/<aid>
curl -s http://127.0.0.1:7700/oracles/<aid>/kel

4. Add observers

Each observer is an identity of its own. It signs an engagement, the administrator accepts it, and the observer then submits observations. See Python Client.

5. Publish a value

Once at least quorum_threshold observations are pending:

curl -s -X POST http://127.0.0.1:7700/oracles/<aid>/aggregate -H "Authorization: Bearer $ADMIN_TOKEN" -H "Content-Type: application/json" -d '{}'
curl -s http://127.0.0.1:7700/oracles/<aid>/latest

Set AGGREGATE_SECONDS before starting to aggregate automatically.

6. Stop

deploy/scripts/down.sh
../support/deploy/scripts/down.sh