Builders
Developer Tools
Building
Oracles

Oracles

This reference guide lists different Oracles you can use when building on Optimism. Oracles (opens in a new tab) provide offchain data onchain. This allows code running on a blockchain to access a wide variety of information. For example, a stablecoin (opens in a new tab) that accepts ETH as collateral needs to know the ETH/USD exchange rate:

  • How many stablecoins can we give a user for a given amount of ETH?
  • Do we need to liquidate any deposits because they are under collateralized?
💡

This page includes providers that meet specific inclusion criteria, as outlined below. Please visit the community oracles page (opens in a new tab) for an additional listing of third-party Oracles.

Security and Decentralization

Different oracles have different security assumptions and different levels of decentralization. Usually they are either run by the organization that produces the information, or have a mechanism to reward entities that provide accurate information and penalize those that provide incorrect information.

Types of Oracles

There are two types of oracles:

  1. Push oracles are updated continuously and always have up to date information available onchain.

  2. Pull oracles are only updated when information is requested by a contract. Pull oracles are themselves divided into two types:

    1. Double-transaction oracles, which require two transactions. The first transaction is the request for information, which usually causes the oracle to emit an event that triggers some offchain mechanism to provide the answer (through its own transaction). The second transaction actually reads onchain the result from the oracle and uses it.
    2. Single-transaction oracles, which only require one transaction, such as Chainlink's random number generator (opens in a new tab). The way this works is that the transaction that requests the information includes a callback (address and the call data to provide it). When the oracle is updated (which also happens through a transaction, but one that is not sent by the user), the oracle uses the callback to inform a contract of the result.

Gas Oracle

OP Mainnet provides a Gas Price Oracle (opens in a new tab) that provides information about gas prices and related parameters. It can also calculate the total cost of a transaction for you before you send it.

This contract is a predeploy at address 0x420000000000000000000000000000000000000F:

This is a push Oracle. OP Mainnet (and the testnets) updates the gas price parameters onchain whenever those parameters change. The L1 gas price, which can be volatile, is only pushed once every 5 minutes, and each time can change only by up to 20%.

Chainlink

Chainlink (opens in a new tab) is the industry-standard decentralized computing platform powering the verifiable web. Chainlink powers verifiable applications and high-integrity markets for banking, DeFi, global trade, gaming, and other major sectors.

Chainlink provides a number of price feeds (opens in a new tab). Those feeds are available on the production network @ Op Mainnet (opens in a new tab).

  • Data Feeds: Chainlink Data Feeds provide a secure, reliable, and decentralized source of off-chain data to power unique smart contract use cases for DeFi and beyond.
  • Automation: Chainlink Automation is an ultra-reliable and performant smart contract automation solution enabling developers to quickly scale their operations in a verifiable, decentralized, and cost-efficient manner, to build next-generation apps.
  • CCIP: Chainlink CCIP provides a secure interoperability protocol for powering token transfers and sending arbitrary messages cross-chain.

This is a push Oracle. See the Using Data Feeds guide (opens in a new tab) to learn how to use the Chainlink feeds.

Pyth Network

The Pyth Network is a financial oracle network which delivers over 400 low-latency, high-fidelity price feeds across cryptocurrencies, FX pairs, equities, ETFs, and commodities.

You can explore the full catalog of Pyth Price Feed IDs for OP Mainnet and Sepolia (EVM Stable) (opens in a new tab).

RedStone

RedStone (opens in a new tab) offers flexible Data Feeds for Lending Markets, Perpetuals, Options, Stablecoins, Yield Aggregators and other types of novel DeFi protocols. The infrastructure is well battle-tested and secures hundreds of millions of USD across mainnet.

Builders can choose how they want to consume the data among 3 dedicated models:

Interested in integration? Get in contact (opens in a new tab) with the RedStone team!

Inclusion Criteria

Developer teams who want to feature products/tools on this page must meet the following criteria:

  1. ongoing partnership with Optimism whether formal agreement, RPGF, RFP, collaborated on specific initiatives, etc.;
  2. established user base and OP ecosystem engagement such as governance participation, homegrown TG or Discord participation, etc.; and
  3. actively maintained developer tool that aligns with OP's commitment to a magical developer experience (e.g., easy-to-use, easy-to-integrate, great DevX, highly-rated by community, etc.)

For teams that are supporting but still establishing a user base, we encourage you to share your tool on the community oracles page (opens in a new tab). You can also promote your tool in the developer forum (opens in a new tab) and signup to share your tool at the next demo day (opens in a new tab).

Next Steps