Pyth: Pull and Push Oracles

  • Most oracles today are push oracles where the oracle operator is responsible for submitting price updates to the blockchain.
  • Pyth is different: it is a pull oracle where anyone can permissionlessly update the on-chain price.

Push Oracles

  • Push oracles periodically update on-chain price based on external trigger condition.
  • The oracle has a smart contract that stores the current price.
  • The contract also has a set of permissioned operators who are authorized to update the price.
  • The oracle operators then commit to updating the on-chain price at a specific cadence, for example once every 30 minutes or if the price moves by 1%.
  • Thus, in push oracle, the on-chain price is periodically updated, regardless of whether or not anyone is using it.

Pull Oracles

  • In contrast to push oracles, pull oracles only update the on-chain price when requested.
  • There are different ways for users to request an updated price from a pull oracle.
  • Some pull oracles respond to on-chain requests: applications send one transaction to request data from the oracle, which then submits the response in a second transaction.
  • Pyth uses a simpler system where users can request the latest price update from an off-chain service.
  • Anyone can submit a price update to the on-chain Pyth contract, which verifies its authenticity and stores it for later use.
  • This system allows applications to use a single transaction flow that first updates the price then performs necessary application logic.

Comparing Push and Pull

  • Push and pull oracles differ on a number of important dimensions

    • Update frequency
      • In a push oracle, every price feed updates at a fixed update frequency.
      • The oracle operator determines the frequency, but it typically ranges from every 10 minutes to 1 hour.
      • In contrast, pull oracles can update at a much higher frequency.
      • For example, every Pyth price feed updates every 400 milliseconds.
    • Latency
      • An oracle's update frequency also affects its prices' latency.
      • The higher update frequencies of pull oracles allow applications to access low latency data
    • Blockchain Support
      • Pull oracles support a wide variety of different blockchains.
      • Push oracles typically support a smaller number of blockchains, as each additional chain requires ongoing gas expenditures.
    • Price feed selection
      • Similar to the item above, pull oracles also support a wide selection of price feeds.
      • In contrast, push oracles typically have more limited selection.
      • Push oracles generally cannot support a wide selection of feeds due to the gas cost of periodically updating each feed.
  • A fundamental reason for these differences is that push oracles incur gas costs for price updates.

  • These gas costs limit the scalability across all of the dimensions above.

Integration differences

  • Push oracles and pull oracles require applications to integrate in different ways.
  • With a push oracle, applications typically read the current price out of a smart contract.
  • Since the push oracle periodically updates the price, the application can assume the data in the smart contract is (reasonably) fresh.
  • With a pull oracle, applications need to update the on-chain price before reading it.