Skip to content

CadenaWizard/oracle

Repository files navigation

Oracle Server

Oracle used to produce prices / results for bets. Check out our basic demo page under:

Setup, local development

Set up a Python virtual environment (optional)

python3 -m venv ./venv

Install dependencies:

pip install -r ./requirements.txt

Build the internal Rust library, requires Rust/Cargo, install it as a Python module:

cd dlcplazacryptlib && maturin develop && cd ..

(or with venv:)

cd dlcplazacryptlib && VIRTUAL_ENV='../venv' ../venv/bin/maturin develop && cd ..

Set up the secret key used:

python3 ./dlcplazacryptlib/save_secret.py --set --file secret.sec

Enter your securely generated secret mnemonic, be sure to back it up!

Prepare .env file; copy sample and change settings as needed:

cp env-sample .env

Create the empty initial DB:

python3 ./server/__setup_db.py

then, if all fine:

mv ./ora.db ./oda.BAK.db
mv ./_new_ora.db ./ora.db

Start the server:

./start_oracle_server_dev.sh

(or: )

fastapi run server/main.py

See status

curl http://localhost:8000/api/v0/oracle/oracle_status

Run more sample calls:

python3 ./server/test_api.py

See demo web page: http://localhost:8000/demo/

Run some tests:

python ./server/test_oracle.py

High-level API Description

Oracle info

  • General info, such as the oracle public key

  • Oracle status, inc. number of event, future events, server, time, etc.

Events

  • Get events, with various filters — time range, symbol.

  • Events also include nonces

  • For (past) events with outcome, outcome is also included, including the attestation signatures

  • Same but get only event IDs

  • Get one event by ID

Price

  • Get current price, price info for a symbol, or all.

Testing

  • [Removed] Get forced premature test outcome for a future event (using dummy price)

About

Oracle used to produce prices / results for bets

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •