Skip to main content

Deriving the Price Feed Account

Each feed is a PDA of the pricing oracle program PriCems5tHihc6UDXDjzjeawomAwBduWMGAi8ZUjppd, derived from these seeds:
  • "price_feed" (buffer)
  • "pyth-lazer" (buffer)
  • feed ID (buffer): the asset’s pyth_lazer_id as a decimal string, for example "6" for SOL/USD. Find the supported feeds here.
Read feeds from an Ephemeral Rollup endpoint. The feed accounts are delegated, and the oracle updates them only inside the ER. Their base-layer copies are not updated: on mainnet they were last written in August 2025.

Parsing the Account

The account uses the same field layout as Pyth’s PriceUpdateV2, but it is not a Pyth receiver account. It is owned by the pricing oracle program and has its own discriminator.
  • Price offset: 73 bytes from start
  • Type: signed 64‑bit integer (i64), so read it with getBigInt64
  • Exponent: use the exponent from the feed list, for example -8 for SOL/USD and -10 for BONK. The account’s own exponent field reads +8 on every feed and is not the scale of the price.
  • Feed ID: the feed_id stored in the account is the feed account’s own address, not the Pyth Lazer ID.

Reading a Feed in a Program

In an Anchor program, decode the account with PriceUpdateV2::try_deserialize_unchecked from pyth-solana-receiver-sdk. Don’t declare it as Account<'info, PriceUpdateV2>: Anchor then requires the Pyth receiver as owner and the PriceUpdateV2 discriminator, and rejects every MagicBlock feed (error 3007, AccountOwnedByWrongProgram). Check the account key and owner yourself, and pass the feed account’s address as the feed ID.
Don’t rely on VerificationLevel::Full alone. Anyone can create a feed account that doesn’t exist yet, and a new feed starts as Full with a price of 0 and a feed ID and exponent chosen by its creator. Pin the feed account address, check the owner, require a positive price, and check freshness with publish_time.

Live Demo

Real‑time price stream

Implementation

Learn how to access our oracles onchain

Code Example

Check out our Github Repo