This guide is designed for external developers who need to retrieve and use prices provided through the Pull Model of the Entangle Universal Data Feeds protocol on the Solana blockchain.
Pull model is based on the same price feed sources as the push model. The former one is provided by the Entangle facility know as price-publisher that publishes last prices and pays transaction fees on the Solana block-chain. There is a variety of assets provided by the certified Price Providers, each update is verified and signed by them. What the Entangle Price Publisher does it's getting price feeds from the pricefeed.entangle.fi and publishing them on the Solana Price Oracle Smart Contract.
It is important to note that all assets on the list are provided, but not all of them are published in Solana. Some of them have to be published in a chain like Solana on demand. This means that an external developer interested in the latest update must independently retrieve it from pricefeed.entangle.fi and perform a transaction on Solana to ensure that, first, the price update belongs to and is a valid part of the Merkle tree, and second, the Merkle root is signed by a certified price provider.
Updates can be obtained directly from the Entangle Oracle blockchain or taken from the pricefeed.entangle.fi web service with signatures and Merkle proofs proving that they belong to the signed root.
The code below illustrates what pricefeeds received at pricefeed.entangle.fi might look like.
This example contains the merkleRoot that is derived within the predefined set of assets e.g.: "NGL/USD", "BTC/USD", "ETH/USD" etc. This merkleRoot is signed by the Certified Price Provider and signatures are supposed to be checked within the Price Oracle Contract. For the broad and comprehensive understanding important to highlight the Price Oracle invokes the Photon Messaging layer to retrieve actual list of Certified Price Providers.
feeds provides latest price updates. Each update has key, base64 encoded value, timestamp and merkleProofs that ensures this certain feed belongs to the Merkle tree and corresponds to the merkleRoot . For this certain case AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPG26yIcIVk= is the 0.068036590393106777 * 18 at Sep 20 2024 01:32:41.
Client application is supposed to deserialize this json data and send a transaction to Solana. Important to know as far as the price is verified it's started to be available on-chain and could be retrieved like it was pictured under the Fetch Data via Push model header.
The code above requires the following dependencies:
With this guide, you can now integrate Solana's Entangle Universal Data Feeds price data into your decentralized applications. This system efficiently retrieves price and timestamp information, ensuring that your program can access accurate on-chain data with minimal latency.