pyth

Integrate Pyth Network real-time price feeds into Solana programs and TypeScript clients.

1|1|Updated May 21, 2026
One-click install
npx skills add https://github.com/naruto11eth/cryptoskills --skill pyth-naruto11eth
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pyth
Source: https://github.com/naruto11eth/cryptoskills/tree/main/skills/pyth
Command: npx skills add https://github.com/naruto11eth/cryptoskills --skill pyth-naruto11eth

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? AI agents and developers often lack accurate, current knowledge of Pyth Network's Solana integration — correct program IDs, price feed IDs, SDK method signatures, and safe price-validation patterns — leading to hallucinated addresses, stale-price bugs, and unsafe oracle consumption in DeFi programs. ## Core Features & Use Cases - Off-Chain Price Fetching: Fetch latest prices and stream real-time updates via the Hermes API using @pythnetwork/hermes-client, with confidence intervals and EMA prices. - On-Chain Anchor Integration: Consume PriceUpdateV2 accounts in Anchor programs with staleness checks, feed ID verification, and confidence validation using pyth-solana-receiver-sdk. - Price Posting to Solana: Build and send transactions that post price updates and consume them atomically with PythSolanaReceiver transaction builders. - Use Case: Build a Solana lending program that values SOL collateral using a verified Pyth SOL/USD price no older than 60 seconds, rejecting prices with confidence wider than 2%. ## Quick Start Use the pyth skill to write an Anchor instruction that reads the SOL/USD price from a Pyth price update account with staleness and confidence validation.

Frequently Asked Questions about pyth

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fetch Pyth price feeds in TypeScript?

Use the HermesClient from @pythnetwork/hermes-client and call getLatestPriceUpdates with an array of hex feed IDs. The response includes parsed price, confidence, exponent, and publish time, plus binary data for on-chain posting.

How do I read a Pyth price in an Anchor Solana program?

Add pyth-solana-receiver-sdk to Cargo.toml and accept a PriceUpdateV2 account in your instruction. Call get_price_no_older_than with the Clock sysvar and a max age in seconds to get a validated price.

Does Pyth on Solana support real-time streaming price updates?

Yes, Hermes provides Server-Sent Events streaming via getPriceUpdatesStream in the TypeScript SDK. You subscribe with feed IDs and receive parsed price updates, with options for unordered delivery.

Why does my Pyth integration return a PriceTooOld error?

The price update account's publish time exceeds your max age threshold relative to the Solana clock. Post a fresh price update in the same transaction before consuming it, or increase the max age parameter.

What is the difference between Pyth on Solana and Pyth on EVM chains?

Solana uses Anchor CPI to the Pyth receiver program with PriceUpdateV2 accounts, while EVM chains use the Solidity IPyth interface with updatePriceFeeds calls. Feed IDs are identical across all chains, but contract addresses and SDKs differ.

How do I validate Pyth price confidence intervals on-chain?

Compute the confidence as a ratio of the absolute price in basis points and reject prices exceeding your threshold, typically 1-2%. The skill's template provides validate_confidence helpers and strict or lenient PriceValidationConfig presets.