pyth

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

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Developers building DeFi applications on Solana need accurate, low-latency oracle price data, but integrating Pyth involves understanding fixed-point price formats, confidence intervals, feed IDs, staleness checks, and Anchor CPI patterns that are easy to get wrong and costly when mishandled. ## Core Features & Use Cases - Off-Chain Price Fetching: Fetch and stream real-time prices via the Hermes API using @pythnetwork/hermes-client, with support for multiple feeds and SSE streaming. - On-Chain Anchor Integration: Consume prices in Solana programs with pyth-solana-receiver-sdk, including staleness checks, feed ID verification, and confidence validation. - Production Templates & References: Ready-to-use TypeScript client and Anchor oracle templates, complete program addresses, price feed ID tables, API reference, and a troubleshooting guide. - Use Case: Build a lending protocol that values SOL collateral on-chain by posting a Pyth price update and reading it in an Anchor instruction with a 60-second staleness limit and 2% confidence bound. ## Quick Start Ask the agent to fetch the current SOL/USD price from Pyth and show how to consume it in an Anchor program 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, which you convert with price × 10^expo.

How to use Pyth prices in an Anchor Solana program?

Add pyth-solana-receiver-sdk to Cargo.toml, accept a PriceUpdateV2 account in your instruction, and call get_price_no_older_than with the Clock sysvar and a max age in seconds. Verify the account owner matches the Pyth receiver program ID.

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

On Solana, prices are consumed via Anchor CPI to the Pyth receiver program using PriceUpdateV2 accounts. On EVM chains, contracts call the Solidity IPyth interface and submit update data via updatePriceFeeds. Feed IDs are identical across all chains.

Why does my Pyth integration return a PriceTooOld error?

The price update account's publish time exceeds your max age parameter. Either increase the allowed staleness window or post a fresh price update from Hermes in the same transaction before consuming it.

How do I validate Pyth confidence intervals on-chain?

Compute the confidence ratio as conf divided by the absolute price in basis points and reject prices above your threshold, typically 1-2%. For sensitive operations like liquidations, use the EMA price via get_ema_price_no_older_than.

What are the rate limits for the public Pyth Hermes endpoint?

The public endpoint at hermes.pyth.network allows roughly 10 requests per second, 5 concurrent connections, and up to 100 feeds per request. Production applications should use a dedicated endpoint from a Pyth data provider.