🧙xOracle

The xOracle is a decentralized pricing data solution for Blockchain Ecosystems.

Overview

An Oracle Price Feed is a decentralized mechanism for providing real-time, accurate pricing data within a blockchain ecosystem. By utilizing a network of independent data providers, known as "oracles," an Oracle Pricefeed ensures that the pricing data is accurate and tamper-proof. Smart contracts are used to define the rules and incentives for data providers, and handle the distribution of rewards for accurate and timely data submissions.

Architecture

The architecture of an Oracle Price Feed consists of several key components

  • Data providers: These are independent entities that collect and report pricing data to the network. They may be individuals, organizations, or even other smart contracts.

  • Smart contracts: These are the backbone of the Oracle Price Feed, and handle the following tasks

    • Defining the rules and incentives for data providers

    • Collecting and validating pricing data

    • Determining which data is considered valid

    • Distributing rewards to data providers for accurate and timely submissions

  • Token: A token is used to incentivize data providers to submit accurate and timely data. Tokens can be earned by data providers for each valid submission and used for various purposes within the ecosystem, such as paying transaction fees or accessing premium features.

  • Oracle network: The oracle network is the network of all the data providers and smart contracts that together form the Oracle Price Feed.

Features

  • Decentralized: The Oracle Price Feed utilizes a network of independent data providers, ensuring that the pricing data is accurate and tamper-proof.

  • Real-time: Data providers are incentivized to submit pricing data in real-time, ensuring that the data is always up-to-date.

  • Customizable: The smart contracts used in the Oracle Price Feed can be customized to suit the specific needs of the ecosystem.

  • Token-based incentives: Data providers are incentivized to submit accurate and timely data through the use of a token, which can be earned and used within the ecosystem.

Use Case

Oracle Price Feeds can be used in a variety of decentralized finance (DeFi) and prediction market applications where accurate pricing data is crucial these include

  • Decentralized exchanges: An Oracle Price Feed can be used to provide real-time pricing data for assets traded on a decentralized exchange.

  • Collateralized lending: An Oracle Price Feed can be used to determine the value of collateral for lending platforms.

  • Prediction markets: An Oracle Price Feed can be used to determine the outcome of predictions based on market data.

The xOracle's Architecture

xOracle System Diagram

Data Layer

The first component of xOracle - xOracle chain A.K.A the data layer - is accountable for timely updates of fresh data from multiple reliable data sources to obtain up-to-date price data. This is where xOracle’s price feed nodes are fed with raw price data from off-chain centralized exchanges (Eg. Binance, Kucoin) and on-chain decentralized exchanges (Eg. Pancakeswap)

As price feeds are employed by smart contracts to execute crucial on-chain events, our xOracle price feed guarantees maximum data integrity through the use of timestamps.

Additionally, both the timestamp and the price data are signed whenever it is fed into the price feed nodes, thus ensuring that the data used by the relay nodes are not compromised.

The price feeds are set to update at 4-second intervals, also known as the heartbeat interval, using the formula:

timestamp = block.timestamp - (block.timestamp % 4)

This guarantees that every single price feed node will have refined price data for the relay nodes every 4 seconds. The more price feed nodes there are, the more accurate, sustainable and secure the price data becomes.

Execution Layer

The second component of xOracle, known as the execution layer - is responsible for addressing support requests from the application site. On this layer, relay nodes monitor the requested event from the application site on all chains. Upon submission of a request, our xOracle price feed uses timestamps to retrieve the price and respond back to the requester.

Moreover, the fulfillRequest requires proof of signature for the dataset. Verifying whether the signature is legitimately signed by the signer (price feed node).

The entire procedure, from request to fulfillRequest takes only 6-9 seconds then the xOracle will respond to the requester with real-time price.

Application Layer

The final component of xOracle - the application layer - is responsible for interfacing with xOracle. This layer is a part of the smart contract application which can interface with the xOracle contract.

As our xOracle offers a low-price API (under development), the cost of running xOracle will be charged through the transaction gas. xOracle simplifies the implementation process for developers to manage the costs whether to charge with users or charge with the team.

By designing xOracle chain as a center for price feed, we can install plug-ins to add more relay nodes to support more EVM chains that are in service without incurring additional operating costs. This allows us to scale xOracle to support any chains rapidly and effectively in the long run.

In the future roadmap, we plan to allocate our revenue from xOracle according to governance votes such as buy-back and burn (TEM), rewards distribution (Community Staking), etc.

Price Feed Tokens

Token Index
Token Symbol

0

BTC BTC

1

ETH ETH

2

BNB

3

USDT USDT

4

BUSD BUSD

5

USDC USDC

6

DAI

10

XRP

11

DOGE DOGE

12

TRX

20

ADA

21

MATIC

22

SOL

23

DOT

24

USDC AVAX

25

FTM

26

NEAR

27

ATOM

28

OP

29

ARB

Example: Request Prices

view full code: https://github.com/Crown-Labs/xoracle-contracts/blob/main/contracts/example/RequestPrices.sol

    // Request oracle prices
    function requestPrices() external {
        // allowance req fee 
        // (require deposit WETH on this contract)
        IERC20(weth).approve(xOracle, type(uint256).max);

        // make payload and call
        bytes memory payload = ""; // no payload
        uint256 expiration = 0; // no expired
        uint256 callbackMaxGasLimit = 5000000; // 5M
        IXOracle(xOracle).requestPrices(payload, expired, maxGasPrice, callbackMaxGasLimit);
    }
    
    // Implementable callback
    function xOracleCall(
        uint256 _reqId, 
        bool _priceUpdate, 
        bytes memory _payload
    ) external onlyXOracle {
        // do thing
        // ...
    }

    // Get the last price by Token Index
    function getPrice(uint256 _tokenIndex) external view returns (uint256) {
        (, uint256 price, , ) = IXOracle(xOracle).getLastPrice(_tokenIndex);
        return price;
    }

xOracle Contract

Linea Testnet

xOracle API

xOracle Chain Infomation

Chain ID

1123581321

Symbol

XOR

Nodes

RelayNode: Sentinel

0x9642955e650f8f380e9e5f978c910d684b7a0805

RelayNode: 0xGuardian

0xE49EE57521a4eDF93Cb62013CF5B263660b3dD79

Pricefeed: XORNode

0x866739f5308D27B091445f6A0E10b29539aB6123

Pricefeed: CommunityNode

0xa2694632465dffEb3194ad919Ac7E6366b7A67E9

Pricefeed: Authentic

0x78a3421C4f2755CBaFe54d65856F9Dc223c3D42b

Pricefeed: TrustNode

0x3018A56c5cD12281C7E1C544Dba26492daE06601

Validator 1

0x91E1B08019d80319aC0Af7048d07e8FDC88bE326

Validator 2

0x3688f1eA10B2544414BF3898412987b0b9Be2319

Validator 3

0x1085d563e356482eB9d5C6b6Fa59B0123056BFe7

Last updated