Deriving the Price Feed Account
Each feed is a PDA of the pricing oracle programPriCems5tHihc6UDXDjzjeawomAwBduWMGAi8ZUjppd, derived from these seeds:
"price_feed"(buffer)"pyth-lazer"(buffer)- feed ID (buffer): the asset’s
pyth_lazer_idas a decimal string, for example"6"for SOL/USD. Find the supported feeds here.
Parsing the Account
The account uses the same field layout as Pyth’sPriceUpdateV2, 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 withgetBigInt64 - Exponent: use the
exponentfrom the feed list, for example-8for SOL/USD and-10for BONK. The account’s own exponent field reads+8on every feed and is not the scale of the price. - Feed ID: the
feed_idstored 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 withPriceUpdateV2::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

