On-Chaining Data: Decentralized Oracles on Fantom

On-Chaining Data: Decentralized Oracles on Fantom

Smart contract platforms such as Fantom are innovative forces that aim to change many aspects of the world by enabling secure, transparent, and decentralized applications.

However, the main challenge these applications face is external data access. For example, how would a lending protocol access the average price of a token on major exchanges to determine liquidation thresholds? How would an NFT that changes its image based on the weather access weather data?

Blockchain oracles solve this issue by providing smart contracts with external data. They act as intermediaries between the blockchain and many data sources, ensuring that decentralized applications can access any data feed.

Let’s explore some of the oracles available on Fantom that developers can integrate into their applications.

Pyth Network

Pyth Network is an oracle that publishes financial market data to multiple blockchains. Our market data is contributed by over 80 first-party publishers, including some of the biggest exchanges and market making firms in the world.”

Pythnet Price Feeds offers all dApps on EVM chains, including Fantom, access to low-latency financial market data.  Unlike most oracles, Pyth does not use a push model in which prices are updated automatically on-chain. Instead, Pyth updates prices once per second off-chain, and when users require an update to use in a dApp, they send a transaction to bring the price data on-chain.

This on-demand model allows for greater gas efficiency as prices are updated only when needed, higher update frequency as prices are updated off-chain and ready to be delivered at any time, and more reliable in volatile conditions as users can submit prioritized transactions to fetch prices during high-gas periods.

Integrate Pyth in your Fantom dApp by reading its documentation.

API3

API3 is a collaborative project to deliver traditional API services to smart contract platforms in a decentralized and trust-minimized way.”

dAPIs are on-chain data feeds run by the API providers themselves. Unlike oracles such as Chainlink that offer decentralized oracles that fetch and verify data from multiple sources, dAPIs are off-chain, first-party oracles that provide data directly from the source. For example, a weather station would run its own dAPI to provide weather data to dApps.

The first-party model is aimed at facilitating more reliable feeds as they come directly from the source, lower costs as fewer parties are involved, and inherent privacy as third parties cannot observe the raw data the API is processing.

API3 also offers QRNG, which is a random number generator. Just like its dAPIS, this generator is hosted by a first-party provider, the Australian National University. QRNG boasts greater randomness as the generator is run off-chain and the numbers are generated by a “lab by measuring the quantum fluctuations of [a] vacuum.”

Integrate API3 in your Fantom dApp by reading its documentation.

Chainlink connects smart contracts with external data using its decentralized oracle network. Chainlink API requests are handled 1:1 by an oracle.”

As the most widely-used oracle service, Chainlink offers a network of decentralized oracles. Unlike API3, Chainlink uses multiple decentralized nodes to provide data to dApps, which is aimed at eliminating the possibility of a single point of failure and ensuring that the data is accurate and tamper-proof. Its Chainlink Data Feeds offers feeds such as asset prices, reserve balances, NFT floor prices, and layer 2 sequencer health.

Chainlink VRF is a generator that enables dApps to access verifiable random numbers. Oracles use a cryptographic algorithm to generate a random number that is then verified using a publicly available proof. This proof can be verified by anyone on the blockchain network, ensuring that the random number was generated fairly and without any bias or manipulation.

Chainlink Automation allows dApps to set specific conditions under which their functions will execute and leverages Chainlink’s decentralized network of oracles to make this process reliable and secure. Chainlink Functions allows dApps to request data from oracles and have them perform computations on it before delivering, such as calculating the best-performing assets on a decentralized exchange.

Integrate Chainlink in your Fantom dApp by reading its documentation.

Band Protocol

“Band Protocol is a cross-chain data oracle platform that aggregates and connects real-world data and APIs to smart contracts.”

Band Protocol uses its own Cosmos-SDK-based blockchain called BandChain to run its oracles. The network of validators that run this blockchain aggregate and validate off-chain data before feeding into the dApps on the various chains that support Band Protocol.

Unlike oracles on other chains, BandChain is its own blockchain and designed explicitly for oracle data requests and computation. This design allows for increased scalability and flexibility as it offloads heavy or resource-intensive tasks from the dApps’ smart contract platforms onto itself. BandChain can plug into many chains to provide dApps with price feeds with the Band Standard Dataset.

Integrate Band Protocol in your Fantom dApp by reading its documentation.

RedStone

RedStone is an oracle that delivers frequently updated, reliable, and diverse data feeds for your dApp and smart contracts on multiple L1s & L2s.”

RedStone offers oracles focused mainly on price feeds and designed to be modular. There are three main ways in which their oracles can deliver data to dApps.

RedStone Core is its on-demand model in which prices are fetched only when users submit transactions that include price update requests. Similarly to Pyth, this is the lowest latency and most gas-efficient option as prices on-chain are updated only as needed.

RedStone Classic is its classic model in which prices are pushed to the blockchain automatically at intervals determined by several factors.

RedStone X is it deferred model in which prices are updated only after a user submits a transaction. For example, a user opens an FTM long position on a dApp. Once that transaction is recorded on-chain, the oracle updates the price, and only then will the dApp open the long position. This eliminates the risk of arbitraging protocols by front-running oracle price updates.

Integrate RedStone in your Fantom dApp by reading its documentation.