Oracle Service

Oracle Service Architecture

The Bifrost Network uses relayers to gather external oracle reports, which are validated and provided to the Bifrost ecosystem by oracle manager contracts. The process of collecting and distributing data through the Bifrost oracle service is illustrated in Figure 1.

Data Collection

Relayers on the Bifrost Network are responsible for collecting readings from various sources, both on-chain and off-chain, based on the configuration of the oracle. They then submit this data to the oracle manager contract for validation and distribution within the Bifrost ecosystem.

Two Types of Data

The Bifrost oracle service supports two types of data: exact data, such as the block hash of the latest Bitcoin block, and aggregatable data, such as token prices. For exact data, the oracle manager contract verifies that a quorum of relayers has submitted the same report. For aggregatable data, the oracle manager calculates the average of the submitted reports after eliminating outliers.

Data Feed

An oracle manager is a smart contract that serves as a data feed in the Bifrost Network. It verifies and processes data from multiple sources, then provides the final results along with metadata, such as the collection round number, to ensure the timeliness and reliability of the report.

Features

Source-specific Collection

Relayers may be configured to follow different approaches in the data collection process, including the triggers for collection and post-processing procedures, depending on the specific data sources being utilized.

Token prices are regularly collected from both centralized and decentralized exchanges, and outliers are removed through price deviation verification during post-processing. The collection of Bitcoin block hashes, on the other hand, is triggered by new block notifications. In the event of an unexpected chain reorganization in Bitcoin, relayers can correct obsolete block hashes during the post-processing step.

Price Aggregation and Correction

Relayers combine prices from centralized and decentralized exchanges and adjust them to reflect market conditions more accurately. A volume-weighted average is calculated for prices from centralized exchanges, as the daily trading volume is known. Prices from decentralized exchanges are averaged without considering trading volume but are used to improve the volume-weighted average by taking the median between the two average values.

Reorg-aware Bitcoin Post-processing

In Bitcoin, there is a risk of unexpected large-scale block reorganization events occurring. To address this, we designed the committed value storage in the oracle manager contract to be adjustable when relayers resubmit the updated hash values of reorganized blocks.

Easy DApp Integration

Chainlink is the most widely-used blockchain oracle service. To minimize the learning curve for using Bifrost's oracle service, it offers an interface compatible with that of Chainlink. As a result, DApp developers can utilize our oracle service without the need to acquire additional knowledge.

Last updated