Developer Hub

Push Integration

How to use Pyth push feeds across supported ecosystems

This guide explains how to read real-time Pyth prices using push integration across supported ecosystems.

Check Feed Availability

Ensure the feeds your application needs are already updated on-chain. Review the push feeds list, request coverage through the update request form, or operate a Price Pusher to publish updates yourself.

EVM

Developers on EVM chains can read prices directly from the Pyth oracle contract using push feeds.

PythStructs.Price memory price = pyth.getPriceNoOlderThan(priceFeedId, 60);

Provide the price feed ID from the push feeds list.

Sample contract

pragma solidity ^0.8.0;

import "@pythnetwork/pyth-sdk-solidity/IPyth.sol";
import "@pythnetwork/pyth-sdk-solidity/PythStructs.sol";

contract SomeContract {
  IPyth pyth;

  /**
   * @param pythContract The address of the Pyth contract
   */
  constructor(address pythContract) {
    // The IPyth interface from pyth-sdk-solidity provides the methods to interact with the Pyth contract.
    // Instantiate it with the Pyth contract address from https://docs.pyth.network/price-feeds/core/contract-addresses/evm
    pyth = IPyth(pythContract);
  }

  /**
   * This method is an example of how to interact with the Pyth contract using Push Integration.
   */
  function exampleMethod() public {
    // Read the current price from a price feed if it is less than 60 seconds old.
    // Each price feed (e.g., ETH/USD) is identified by a price feed ID.
    // The complete list of feed IDs is available at https://docs.pyth.network/price-feeds/core/price-feeds
    bytes32 priceFeedId = 0xff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace; // ETH/USD
    PythStructs.Price memory price = pyth.getPriceNoOlderThan(priceFeedId, 60);
  }
}

SVM

Developers on Solana and related ecosystems can use price feed accounts to consume push feeds. See the Solana integration guide for implementation details.

Aptos

Developers on Aptos can read push feeds from the Pyth oracle contract:

let btc_price_identifier = x"e62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43";
let btc_usd_price_id = price_identifier::from_byte_vec(btc_price_identifier);
pyth::get_price(btc_usd_price_id)