⚡Fast Pricefeed
Last updated
Last updated
xOracle Fast Pricefeed is an advanced decentralized price feed service designed to provide real-time, accurate price data to smart contracts on various blockchain networks. By leveraging both centralized and decentralized data sources, xOracle ensures high data integrity and security through a robust architecture involving multiple layers. This document provides a detailed overview of the components and processes involved in the xOracle Fast Pricefeed service.
The service is divided into three main layer components:
1. DAPP
DAPP Contract: This is the smart contract deployed on the blockchain. It interacts with the xOracle Contract to request price data and received price from xOracleCall is callback from xOracle.
2. Pricefeed Core
Pricefeed Signers: This 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.
The signed price data along with the timestamp is stored in the Pricefeed Contract on xOracle chain.
Relayer: A component that listens for price requests from a DAPP contract and retrieves the signed price data from the xOracle API corresponding to the requested timestamp. It then fulfills the request back to the xOracle contract with proof signatures, updating prices, and providing a callback to the DAPP contract.
xOracle Contract: The contract that handles requests for price data and verifies the proof signatures.
requestPrices with block.timestamp: This function call is made by the DAPP Contract to request price data at a specific block timestamp.
fulfillRequest and proof signatures: The xOracle contract verifies the signatures to ensure data validity and fulfills the price data request and .
3. xOracle Chain
Pricefeed Contract: This contract stores the price data and signatures, ensuring they are available for verification.
This design ensures that DApps can access up-to-date and verified price data efficiently, leveraging a combination of on-chain smart contracts and off-chain data providers and signers.
For more examples using a Fast Pricefeed: Request Fast Pricefeed.