Home

Awesome

Aeternity Pricefeed Oracle

The ae-oracle-pricefeed is an example service that can be hosted and allows clients to query the current price of AE.

On startup of the service following tasks are being executed:

  1. The sdk-client is being initialized with the keypair provided via ./data/keypair.json (when using the command to host by hourself) or alternatively generates a new keypair if no keypair is provided
  2. The service checks if the account of the provided keypair has enough funds to run the oracle
    • if NOT it prints the respective information in the console and waits for respective funding (on testnet this can easily be done using https://faucet.aepps.com/)
  3. If the balance check is successful the service checks if the oracle is already registered
    • if NOT the oracle will be registered
  4. The service logs the oracle id to the console
    • this will be required for other contracts or services in order to query the oracle
  5. The service now periodically:
    • extends the TTL of the oracle if necessary
    • polls the node for queries that have to be answered
    • responds to queries if they exist

Host yourself

# checkout repository
git clone https://github.com/thepiwo/ae-oracle-pricefeed
cd ae-oracle-pricefeed

# build container
docker build -t ae-oracle-pricefeed .

# run, follow instructions to fund account, configure NODE_URL for other aeternity node
docker run -it --init --name pricefeed -v "$PWD/.data:/app/.data" -e NODE_URL=https://testnet.aeternity.io/ ae-oracle-pricefeed

Hosted on mainnet

There the ae-oracle-pricefeed oracle is running on mainnet:

Sample how to query the oracle using the SDK

Query the oracle in a contract