vechain.energy
Oracles
What are Oracles?

What is an Oracle?

An Oracle is a source of trusted information, often used to provide token prices.

You can check the data and status provided by vechain.energy's Oracles at https://status.oracle.vechain.energy (opens in a new tab)

If you choose to use the public deployment, we encourage you to run a reporter to enhance the oracle's decentralization. If this interests you, please open an issue (opens in a new tab) or send us an email at [email protected].

Data Evaluation

  • Each Oracle setup can manage multiple data feeds, each with its own settings.
  • Every URL in a feed is checked regularly, based on a configure interval.
  • We extract the median value from the results.
  • If the data on the blockchain is too old (based on a set 'heartbeat') or if it's too different from the current value (beyond a set percentage), we update the data on the blockchain.
  • You can always get the most recent value from an API, which allows for quicker access.

Contract Interface

The contract interface for all oracles is:

interface IVechainEnergyOracleV1 {
    // emitted when data changes
    event ValueUpdate(bytes32 id, uint128 value, uint128 updatedAt);
 
    // access value for a given feed id
    function getLatestValue(bytes32 id) external view returns (uint128 value, uint128 updatedAt);
 
    // allows everyone to update values using a verified & signed responses from the public API
    function updateValueWithProof(bytes memory message, bytes memory extraData, address signedFor) external;
}
  • id is a byte32 encoded version of the feed identifier (for example vet-usd)
  • value is the value provided by the oracle
  • updatedAt is the unix timestamp when the value was last determined

API Interface

A REST-API is publicly available for accessing the latest determined value and for administration purpose.

The OpenAPI definition can be found in the projects repository:

Source Code

The components needed to run the oracle are open-sourced. This helps developers build and manage oracle services on Vechain.

The project includes smart contracts for storing data on-chain and a backend that updates this on-chain data. The oracle service can be customized to support various data sources and multiple feeds. It also offers a public API to get the most recent data from sources, even if it hasn't been stored on-chain yet.

GitHub Link: https://github.com/vechain-energy/oracle.vechain.energy (opens in a new tab)