BNB Chain Report: The State of Oracles

2022.11.30  •  16 min read
Blog post image.

TL;DR

  • There are a few leading oracles in the space: Chainlink, Binance Oracle, Pyth Network, Band Protocol, and Uniswap (time-weighted average price) TWAP oracle for the special cases.
  • Frequency and latency are important but come with a price.
  • Mixing the best of both worlds and having a multi-oracle setup can help mitigate most of the risks associated with oracles.
  • The most used strategy to mitigate these risks is to use primary and secondary (fallback) oracles.
  • TWAP oracles are a special case and have to be handled with care.
  • The use of a privacy-preserving oracle to bridge the gap between privacy-enabled dApps and third-party data providers may be a new trend.
  • ZK Proofs using oracles may be the next big thing for cross-chain communication.

INTRODUCTION

As Web3 becomes more and more popular, the industry is seeing an increase in interest from both retail users and institutions. The trustless nature of blockchain technology allows multiple parties involved in a transaction to execute with 100% guarantees for each side once conditions are met. That creates enormous opportunities for new business cases to be developed. At the time of writing, decentralized finance’s (DeFi) total value locked (TVL) is $41 billion, according to DefiLlama,

Decentralized finance (DeFi) total value locked (TVL) (Source).

Blockchain oracles have been in the Web3 space since 2015, bridging the gap between deterministic siloed blockchains and probabilistic real-world data, allowing multiple use cases on the blockchain that could not have been possible otherwise. By design dApps are supposed to be trustless, always running in the way they were designed. Oracles are a critical piece of the infrastructure ensuring that data can be trusted before it reaches the blockchain. For the smart contracts that rely on external data, execution oracles have to be fast, reliable, decentralized, and resistant to any type of attack.

The purpose of this report is to dive deeper into oracles’ value, identify bottlenecks, explore innovations in the space, and provide recommendations on designing the best oracle setup to ensure optimal protocol performance with the most accurate data feeds in the shortest time.

What Is a Blockchain Oracle?

First, let’s do a quick recap on blockchain oracles. Oracles are decentralized applications that gather, validate, and deliver off-chain data to smart contracts on the blockchain. Similarly, they can do the same for delivering on-chain data to off-chain systems. Oracles are middleware connecting smart contracts on blockchains to off-chain data providers, sources and systems. Without oracles, smart contract applications would be limited to executing using only on-chain data.

If an oracle is corrupted, the correctness of the result of the execution of the smart contract will be compromised, potentially causing enormous losses. Blockchain oracles are a crucial part of the ecosystem.

Flash loan attacks, orchestrated oracle manipulation, and lengthy latency during extremely volatile times add up to the complexity of the infrastructure a dApp has to monitor when building its protocols.

Latency and Frequency

Latency and frequency are two key parameters that determine the performance of an oracle, and a formula can be more complex taking multiple parameters into consideration.

Latency is the time taken for an off-chain data feed to be available to use for a smart contract on-chain after triggering a condition that requires off-chain data with a transaction. Latency can also be used in the context of data freshness, i.e., how old the last data feed is prior to being published on-chain. The latency formula depends on multiple factors.

  • Block Time, which varies for different networks. ETH’s block time is 10-15 seconds, BNB Chain’s block time is 3 seconds, and SOL’s block time (via a Wormhole bridge) is 3-5 seconds;
  • Deviation Threshold or Heartbeat Threshold, whichever whatever happens first. For the most common cryptocurrency pairs such as BTC, ETH, and BNB the following parameters are set:
  • BTC: 0.1% / 1 min
  • ETH: 0.1% / 1 min
  • BNB: 1% / 1 min

Latency depends on both the underlying blockchain and oracle settings.

Frequency is how often the price is updated on a blockchain. In other words, how often the price update triggers (Deviation Threshold, Heartbeat Threshold or requester contract) publishing a new price. In a highly volatile market, the frequency of updates might be bigger because the triggering parameter such as the Deviation Threshold moves more often. The more frequent, almost real-time updates, especially during times of high volatility might contribute to network congestion if the blockchain throughput is low.

Oracle Relayers

A relayer is a general term for a third party that relays some information from one party to another. In the context of blockchain, a relayer submits a user’s transaction to the blockchain network on their behalf and pays the associated gas fee. Oracles usually operate across multiple blockchains and one option for oracle architecture to achieve cross-chain interoperability is to use a third-party relayer design to transmit data across blockchains.

Relayers in oracle design can be used to bridge reported data to other blockchains (Source).

Some potential drawbacks to using relayer architecture are increased latency (users must wait for data to first be delivered to the primary blockchain, then they must wait for it to be bridged to a secondary blockchain or Layer2 network) and responsiveness, as the the relay model requires a set of highly available and incentivized third-party relayers to bridge oracle data from one chain to another.

Data Sources/Publishers

Data sources are third parties that have access to the information in real-time, and can be divided into various categories

  • CEXs and DEXs
  • OTC desks
  • Derivatives exchanges
  • Liquidity providers
  • Quantitative trading companies
  • Weather data collectors
  • Geolocation data collectors
  • Digital credential data providers

METHODOLOGY

A qualitative data collection approach has been used to further deep dive into the existing oracle landscape. A semi-structured interview for the case study was selected to gather information about oracle use by the ten largest DeFi protocols in the market accounting for hundreds of millions of TVL.

All Chainlink, Binance Oracle, Pyth Network and Band Protocol documentation in service of the above-mentioned protocols has been reviewed and analyzed as a part of the case study.

DATA COLLECTION

A semi-structured interview was selected to gather information about oracle use by various DeFi protocols in the market. Participants were selected based on their TVL and trading volume.

The purpose of this paper is to identify and analyze the bottlenecks in the industry, as well as discover new options and provide recommendations on oracle use.

The limitations of the case study: CTOs and lead engineers of the largest subset of DeFi protocols were selected to interview. Smaller DeFi lending and borrowing protocols and small DEXs were not included. The list of questions for the interview is provided below.

  1. What type of project do you have?
  2. Which data feeds do you use?
  3. Do you use data oracles? Which oracle partner have you selected?
  4. How do you use data feeds? How often do you request the data feed? How fast is your data feed? How many API calls do you make per month/per feed?
  5. Why have you selected this oracle / built your own? How long have you been working with them? What do you like the most about working with your oracle? What don’t you like about it? What would you like to improve?
  6. Have you ever experienced any problems with the oracles? How did you deal with it?

VALIDATION THROUGH CASE STUDIES

The results from the survey using keywords analysis and transcribed data provided insights on how DeFi protocols are using oracles, what the limitations and challenges are, and sheds the light on how DeFi protocols mitigate risks relative to the industry.

Key Findings:

  • Both low frequency and latency are named as main concerns for the oracles use by two thirds of the protocol interviews. Contrary to popular belief, protocols do not need the data available immediately, but they do want it fast. A lot indicated that price deviation and heartbeat were more important than frequent price updates.
  • Frequency has a direct relationship with the price deviation. The more often the price is updated the less deviation there is.
  • Push oracle latency comes with a price: the more frequently the price is updated on a chain the higher the gas fee. Most monetization models divide the price feed fee among dApps using it. Pull oracles also come with a price tag: whichever dApp requests the data update first has to pay the gas fee. The data is free for the rest of the protocols using that update.
  • Oracle reliability is the second most important factor.
  • The majority of protocols rely on multiple oracle setup, having two on average with three being the maximum. We might see more double oracle setups in the future as a risk mitigation strategy.
  • Some protocols have chosen to build their TWAP oracle by adding different modifications and maintaining more control and “having skin in the game.”

ORACLE TYPES

The very first blockchain oracle was centralized and served the industry well by supplying the necessary data to the blockchain. But as the industry matured, different oracle designs emerged to solve myriad issues with the centralized model. Analysis of documentation from a variety of oracle providers indicate that their designs vary depending on multiple parameters (eth source):

1. Number of Data Sources. Oracles that are connected to multiple sources and generate the average price from different sources are called aggregated price oracles. For example, Chainlink, Binance Oracle, Pyth Network, Band Protocol are all aggregated price feed oracles as compared to Uniswap which is a single source oracle.

2. Location of Data Source. Data sources for oracles can be on-chain or off-chain. Some of the largest off-chain data providers are the largest CEXsconnected through APIs to oracles nodes where data is pulled, validated, signed, and published on-chain. The largest on-chain data sources are DEXs such as PancakeSwap for BNB chain and Uniswap for Ethereum. DEXs provide prices based on the invariant curve exchange rate for cryptocurrency pairs.

3. Centralized or Decentralized. Oracles are classified as centralized or decentralized depending on their trust model and consensus mechanism. One of the very first oracles in the space on Ethereum called Provable (formerly Oraclize) is a centralized oracle provider but now most are decentralized. .

4. Push or Pull. Oracles that automatically update cryptocurrency prices on chain are called push oracles and oracles that need an active request to update cryptocurrency prices are called pull oracles. Push oracles publish prices on-chain when triggered by one of two indicators:

Deviation Threshold: If the cryptocurrency price is different from the previous price by more than 0.1% -1% (varies for different pairs) then the push oracle is activated to update the price on-chain.

Heartbeat Threshold: If the cryptocurrency price doesn’t change within 1-10 minutes (depending on the parameters set) then the push oracle is activated to update the price on-chain.

5. Type of Data Source. Oracles can specialize in many types of data including cryptocurrency prices, commodities prices, FX prices, trade, weather, sports outcomes and statistics, identity, DNS lookups, and more.

TWAP ORACLES

While most of the oracles in the space are off-chain and decentralized, time-weighted average price (TWAP) oracles are different. TWAP oracles give the average price of a token for a determined period of time versus oracles that provide mean or weighted average prices aggregated from multiple data sources at a given moment. TWAP oracles are based on DEX prices and use the exchange rate of token A to token B as the price-determining factor. DEXs are the only source of truth for the price of the tokens that are not listed and traded on larger exchanges and there are no other providers available. For example, Uniswap TWAP V2.

The time-weighted average price (TWAP) calculation methodology supported by the Uniswap V2 automatic market maker (AMM) (Source).

A TWAP oracle has several limitations. It is a lagging indicator, so if a cryptocurrency price is volatile, the TWAP will not accurately reflect the price, which results in a higher risk of under-collateralization. TWAP oracles pull their price data from a single source only, making it more likely that low-cap asset prices off of a particular DEX are not representative of the broader market price. TWAP oracles do not provide data about off-chain trading pairs and they are not a scalable solution that mirrors the design of the underlying protocols that they service.

That said, TWAP oracles do have an unspoken benefit: they are the only source of price feeds for high-risk, low-cap tokens. Protocols that are built around isolated trading low cap tokens benefit from having access to a TWAP oracle but, as mentioned previously, the data in question is subject to natural (or malicious) market manipulation and must be used with caution.

At the time of the writing, Uniswap TWAP oracle team was working on researching on other improvements such as Time Weight Median Price (TWMP), wide-range liquidity, and limit orders to be introduced to Uniswap TWAP v.3.

Uniswap time weighted average price (TWAP) oracle total value secured (TVS) November 2022 (Source).

ORACLES OVERVIEW

Currently, there are four major market participants in the oracle space:

Oracle

Type

Features

Key Highlights

Chainlink

Decentralized off-chain. Push and pull.

Price feeds.200+ real estate, sports, crypto prices, equities, identity, Proof of reserve. VRF RNG


1500 dApps across 15 blockchains with more than 360M price updates per month. A set of features that expands beyond standard price feeds

Binance Oracle 

Decentralized off-chain. Push.

40+ crypto prices. VRF RNG planned (gas).

Ten new projects joined closed beta testnet since launch including a few largest on-chain TVL. Increased security MPC, the private keyshare to sign a transaction. Optimized for speed using white labels off-chain data sources only. Space ID integration, the largest domain name provider on BNB Chain.

Pyth Network

Decentralized off-chain.

Pull.

Over 90 cryptocurrencies, equities, FX, and metal. 

70+ projects are using Pyth after a few months from the mainnet. 80+ data publishers are working with Pyth Access to exclusive data feeds.

Band Protocol

Decentralized off-chain. Push.

175+ cryptocurrencies.40 FX and commodities. VRF/RNG.

Runs on its own network on Cosmos, 

cross-chain through Cosmos IBC relayers. Has the infrastructure to add a new symbol quickly. Can work with custom requests. 


Chainlink total value secured (TVS) (Source).

Chainlink is one of the largest oracle solutions in the market. It was established in 2017 and has been a source of truth for over 1500 dApps across 15 blockchains. At the time of this writing, the Total Value Secured by Chainlink was approximately $9.4 billion.

Chainlink is an off-chain decentralized oracle network that serves over 200 pairs on Ethereum and more than 100 pairs on the BNB chain. Chainlink data expands far outside of crypto pricing offerings and includes weather data, sports data, FX and commodities.

Chainlink has additional features such as data automation, VRF/RNG, Proof of Reserve, NFT price feeds, and Cross-chain interoperability protocol. Also, dApps can access any external data through AnyAPI adaptors.

Pyth Network

Pyth Network total value secured (TVS) (Source).

Pyth Network was launched in 2021 and is the first oracle to popularize the pull mechanism for price feed updates. Currently, more than 70 projects are deployed to use Pyth Network which uses its own network to make sure the underlying blockchain does not affect the reliability of the oracle and that it is always running.

Pyth Network is a decentralized off-chain aggregate price oracle that publishes data off-chain 2-3 times per second for everyone to read it. That data is published on-chain only after the request for a price contract has been made. The gas fee is paid by whoever first called the price update and it is available for the rest to use cost-free once on-chain. End-users of Pyth data can elect to pay data fees to gain protection against a potential oracle failure.

Pyth Network uses a weighted average aggregate price coming from multiple sources, some of them exclusive. Pyth Data Providers are fully transparent and available to read.

Binance Oracle

Binance Oracle was launched in October 2022 after being in design and production for more than nine months. Binance Oracle has implemented a few modifications to create more resilient and faster push oracles. At the time of this writing, Binance Oracle is deployed to the beta testnet and has onboarded its first customers.

A few significant improvements to Binance’s oracle design were added to make the price feeds faster and more secure:

  • Multi-Party Computation Threshold Signature Scheme. Used by institutional custodians Binance Oracle uses the most secure cryptography for data correctness. Multiple distributed nodes participate in the data signing process, ensuring the safety of the private key.
  • Whitelabeled and Hand-Selected Data Providers. By highly curating data providers, Binance oracle aims to ensure the quality and consistency of data, positioning itself somewhere between Chainlink’s on-chain and off-chain providers and Pyth’s 70 off-chain sources.
  • Customized and Open Providers. Based on rapid development efficiency and quick development turnaround, customized data support is available upon request. Binance Oracle aims to enable more projects to use stable oracle services.

Band Protocol

Band Protocol’s total value secured (TVS) (Source).

Band Protocol is a Cosmos-based oracle supporting 20 blockchains through the inter-blockchain protocol (IBC), a scalable oracle that has its own network to process all data. Band Protocol is also a decentralized off-chain aggregator oracle supporting more than 90 crypto symbols and 12 forex trading pairs.

Band Protocol has built its own relayer network and is able to ensure fast cross-chain communication to publish data to the different blockchains using the IBC bridge.

Other Oracle Designs: API3

API3 is moving from the third-party oracle model to the first-party data providers directly on-chain. An off-chain first-party oracle connects data from any API to a smart contract through Airnode. DAO-governed, Airnode is Web3 middleware that connects any web API directly to any blockchain application. Airnodes are a piece of cloud service infrastructure that allow data providers to deploy their existing Web2 API onto the blockchain, creating what API3 calls a dAPI (Decentralized API).

Airnode Web3 middleware connects any web API directly to any blockchain application (Source).

The API3 team manages the endpoints and a multi-sig mechanism is used for extra security signing transactions. API3 can also provide individual data sets for users that require full control over the curation of the data feeds they use.

Other Oracles Designs: Umbrella Network

Umbrella is a Layer2 oracle built on a sidechain. Umbrella solves the scalability problem in oracles by leveraging a Layer2 solution and utilizes Merkle trees for batching transactions to save on gas fees.

Umbrella leverages a Layer2 solution and utilizes Merkle trees for batching transactions (Source).

Blockchain oracles have been live since 2015 – the same year that Ethereum smart contracts were introduced – and have since gone through many iterations and improvements. A few new emerging trends in oracle use have been identified both during analyzing case studies and following emerging technologies.

Privacy, ZK Proofs, and Oracles

Privacy enabling zero-knowledge proofs (ZKP) are hot topics that have emerged over the course of 2021-2022, solving inherent blockchain problems like lack of confidentiality and inability to control private data. Blockchain oracles are no exception to this trend. The industry is seeking a solution to reveal and verify the truth without disclosing private information.

For example, Chainlink is working on a ZKP-based oracle solution called DECO, a privacy-preserving oracle protocol developed at Cornell University and later acquired by Chainlink. Oracle nodes can prove facts about data sourced from trusted servers without revealing the data on-chain, while also proving the source of the data since the TLS chain of custody is maintained.

One of DECO’s applications is a verifiable credential oracle that acts as a source of truth for biometric data and allows selective data disclosure paired with digital identity.

Oracle nodes can prove facts about data sourced from trusted servers without revealing the data on-chain.

ZK Cross Chain Messaging Through Oracle Relayers

For the average Web3 user the closest understanding of oracle is the bridge between Web2 real-world data and Web3 dApps. However, oracles can not only act as price or weather data feed providers but also can be used as a source of truth for inter-blockchain messaging itself.

A few prospective solutions are working on a ZK proof for cross-chain messaging where oracles act as a core part of the middleware to prove and verify that the data transmitted is true and can be trusted. An oracle node generates the ZK proof for the state of the smart contract so that data can be transferred across blockchains.

Latency Is Dead, Long Live Latency

The fastest available data on-chain is necessary and widely used in the DeFi world however, DEX interviews revealed that there is no actual demand for the real-time speed of pushing price feeds – it has to be fast, but it doesn’t have to be ultra-fast. There are two different approaches to data delivery speed with respect to pull oracles:

  • Binance Oracle uses hand-selected decentralized data providers and has made architecture improvements (such as hot servers, master-slave architecture, and geographically proximal servers) to ensure speed when delivering data on-chain.
  • Pyth Network proposed the solution to solve this problem and went live with a pull oracle at the end of 2021. Chainlink followed by launching a low latency pull oracle in November 2022.

It is important to keep in mind that oracle’s minimum latency is still a blockchain’s block time to finality when transactions are finalized, which will probably remain the primary limitation to data delivery speed.

Modifications to TWAP

Some protocols developed their own implementations of TWAP oracles with added features such as using moving averages to smooth abrupt price movements. Others have built custom pools as an oracle on the AMM/DEX. TWAP oracles might see increased demand in the future if markets move towards decentralized exchanges, which may be more likely after recent market volatility in November 2022.

CONCLUSION

Oracles are critical middleware infrastructure that enable myriad use cases for the blockchain. Competition amongst legacy oracle providers has pushed them to constantly innovate, add resiliency to the oracle ecosystem, and drive adoption for their services in new and better ways. Binance Oracle’s entrance into the space introduces a new player with enhanced speed and security.

While capital continues to flow to DEXs, the collapse of crypto markets in November 2022 may delay the adoption of further advances in oracle development such as verified credentials and ZK cross chain messaging. Nevertheless, oracle innovation continues to unfold, bringing ever more utility to blockchain over time.

REFERENCES

  1. https://ethereum.org/en/developers/docs/oracles/
  2. https://medium.com/the-capital/deco-privacy-preserving-oracles-2620b80b3ffd
  3. https://chain.link/developer-resources
  4. https://research.thetie.io/blockchain-oracle-comparison/
  5. https://oracle.binance.com/en
  6. https://docs.pyth.network/how-pyth-works
  7. https://docs.bandchain.org/band-standard-dataset/supported-blockchains.html#
  8. https://api3.org/airnode
  9. https://uniswap.org/blog/uniswap-v3-oracles

Follow us to stay updated on everything BNB Chain!

Website | Twitter | Twitter (Devs) | Telegram | dApp Store | Youtube | Discord | Build N' Build Forum | Dev Community |

Share