vechain.energy
Oracles
Self Hosting

How to Host Your Own Oracle Service

Here are the steps to host your own Oracle service:

How to Deploy Contracts

How to Deploy Reporter

How to Set Up the Backend

Choose your Data Sources and find the JSON-Document-Path. Set up your feed configuration accordingly.

Here's an example for VET-USD from public sources:

{
    "id":"vet-usd",
    "sources": [
        {
            "url": "https://api.coincap.io/v2/assets/vechain",
            "path": ".data.priceUsd"
        }
    ],
    "heartbeat": 3600,
    "deviationPoints": 100,
    "interval": 60,
    "contracts": [
        {
            "nodeUrl": "https://node-testnet.vechain.energy",
            "address": "<0x_Deployed_Oracle_Contract_Address>"
        }
    ]
}

Save it as feed-config.json and POST it to your backend.

Here's how to do it:

curl -XPOST http://localhost:8787/unique-id \
-H "X-API-Key: ${API_KEY}" \
--data-binary "@feed-config.json"

How To Set Up Aggregation

How to Test

You can check if your service is working by visiting your deployed backend's status URL. Append the unique-id of your feed.

Here's an example using the public setup:

This will confirm that everything is running with the configuration and the last value:

{
    "id": "vet-usd",
    "nextUpdate": 1702637786436,
    "healthy": true,
    "config": {
        "interval": 300,
        "heartbeat": 3600,
        "deviationPoints": 100
    },
    "latestValue": {
        "id": "vet-usd",
        "updatedAt": 1702637485,
        "value": "29912757636",
        "formattedValue": "0.029912757636"
    }
}