Skip to main content
skill CX Codex

pyth-price-feeds — Claude Code skill: Pyth on Hedera

A skill for wiring Pyth pull price feeds into Hedera contracts: Hermes payload updates, max-age reads, and confidence checks.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add hedera-dev/hedera-skills --skill pyth-price-feeds -a claude-code
Open on GitHub

What pyth-price-feeds does

Pyth on Hedera is a pull feed, not a push one. A fresh read usually means submitting a Hermes payload on-chain with payment first, then calling getPriceNoOlderThan. The skill walks the agent through that order and reminds it to cover the fee returned by getUpdateFee(updateData).

It ships reference files references/hedera-feeds.md and references/examples.md with update, read and expo sketches, plus a review checklist. The post-read checks are spelled out too: publishTime != 0, price > 0, and a revert when conf is wider than the price itself.

The trap is sourcing. Contract address and price IDs come from the Pyth Hedera docs, not Ethereum defaults, and the chain ID is 296 on testnet or 295 on mainnet. expo is signed and is not the same as ERC-20 decimals, so it has to be normalized to the consumer scale.

What it helps with

  • refresh a Pyth price on Hedera before a fresh read
  • compute the fee with getUpdateFee and attach it in msg.value
  • read a feed with a max-age bound instead of getPriceUnsafe
  • reject a price when confidence is wider than the price
  • normalize a signed expo to 18 decimals

Example prompts for the agent

  • Help me update a Pyth feed on Hedera: pull updateData from Hermes and submit updatePriceFeeds with enough msg.value.
  • Review my contract: read via getPriceNoOlderThan, check conf, and normalize expo to 18 decimals.
  • Build a review checklist for a Pyth integration on Hedera testnet 296.

How to install pyth-price-feeds

1Skills CLI (Vercel)

npx skills add hedera-dev/hedera-skills --skill pyth-price-feeds -a claude-code

2Manually: put the files in place

~/.claude/skills/pyth-price-feeds/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/pyth-price-feeds/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about pyth-price-feeds

How do I install pyth-price-feeds in Claude?

Run npx skills add hedera-dev/hedera-skills --skill pyth-price-feeds -a claude-code. The skill lands at ~/.claude/skills/pyth-price-feeds/SKILL.md.

What does pyth-price-feeds do?

It guides the agent through Pyth pull feeds on Hedera: submitting Hermes payloads, paying updatePriceFeeds, reading with getPriceNoOlderThan, and checking confidence.

What should I watch out for with Pyth on Hedera?

Take the contract address and price IDs from the Pyth Hedera docs rather than Ethereum defaults. On Hedera msg.value is tinybars, and it has to cover the Pyth fee.

Source text

SKILL.md · Apache-2.0
---
name: pyth-price-feeds
description: >
  Pyth pull price feeds on Hedera. Use when integrating Pyth on Hedera (testnet 296 /
  mainnet 295), fetching Hermes update payloads, paying updatePriceFeeds, calling
  getPriceNoOlderThan, checking confidence, or normalizing signed price + expo to 18 decimals.
---

# Pyth Price Feeds (Hedera)

**Pull pattern:** Pyth is not a fire-and-forget push feed. Fresh reads usually need a Hermes payload submitted on-chain (payable) **before** `getPriceNoOlderThan`.

```text
Hermes → updatePriceFeeds{value: fee}(updateData) → getPriceNoOlderThan(priceId, maxAge)
```

Consumers may wrap Pyth behind a local interface; that is optional. Do not assume a project-specific adapter name.

## Quick Reference

| Piece | Role |
| ----- | ---- |
| Pyth contract | Network `IPyth` address |
| Price ID | `bytes32` feed id (not an aggregator address) |
| Update | Payable `updatePriceFeeds` with Hermes `updateData` |
| Fee | `getUpdateFee(updateData)` — `msg.value` must cover it |
| Read | `getPriceNoOlderThan(priceId, maxAge)` |
| Confidence | Reject when `conf > uint64(price)` |
| Scale | Signed `price` + `expo` → consumer decimals (often 18) |

**Hedera chain IDs:** testnet `296`, mainnet `295`.

See [references/hedera-feeds.md](references/hedera-feeds.md) for where to source the Pyth contract and price IDs. See [references/examples.md](references/examples.md) for update / read / expo sketches.

## Critical: Update Before Fresh Reads

If the on-chain price is older than your staleness bound, fetch Hermes update data and submit it:

```solidity
function updatePrice(bytes[] calldata updateData) external payable {
    uint256 fee = PYTH.getUpdateFee(updateData);
    if (msg.value < fee) revert UpdateFeeTooLow(msg.value, fee);
    PYTH.updatePriceFeeds{ value: msg.value }(updateData);
}
```

Hedera `msg.value` is tinybars via JSON-RPC — attach enough native value for the Pyth fee. Do not treat a stale `getPriceUnsafe` as a valid trading price.

## Critical: Confidence And Signed Expo

After `getPriceNoOlderThan`:

| Check | Why |
| ----- | --- |
| `publishTime != 0` | Incomplete |
| `price > 0` | Invalid / non-positive |
| `conf > uint64(price)` | Confidence wider than the price |
| Normalize `expo` | `expo` is signed; not the same as ERC-20 decimals |

```solidity
PythStructs.Price memory price = PYTH.getPriceNoOlderThan(priceId, maxStaleness);
if (price.publishTime == 0) revert IncompleteRound();
if (price.price <= 0) revert InvalidPrice();
if (price.conf > uint64(price.price)) revert InvalidConfidence();
```

## Checklist

When implementing or reviewing Pyth on Hedera:

- [ ] Pyth contract + price IDs taken from Pyth Hedera / Hermes docs (not Ethereum defaults)
- [ ] Hermes payloads submitted with sufficient `msg.value` before relying on a fresh price
- [ ] Reads use `getPriceNoOlderThan` (or equivalent max-age API), not unbounded unsafe prices for trading
- [ ] Confidence wider than price reverts
- [ ] Signed `expo` normalized to the consumer scale
- [ ] Chain ID is `295` or `296` (or the project’s documented Hedera network)

## References

- [references/examples.md](references/examples.md) — update, read, and expo sketches
- [references/hedera-feeds.md](references/hedera-feeds.md) — where to source Pyth contract and price IDs
- [Pyth Price Feeds](https://docs.pyth.network/price-feeds)
- [Pyth EVM contract addresses](https://docs.pyth.network/price-feeds/core/contract-addresses/evm)
- [Hermes price feeds](https://hermes.pyth.network/v2/price_feeds)

© hedera-dev · Apache-2.0 · hedera-dev/hedera-skills

Similar skills

Everything for Backend and APIs →

From the same set13

Quality Gates This skill wires up automatic code checks: lint and typecheck after every edit, a local CI run before push, and a five-stage deploy checklist. CX Codex +1 536installs Hedera Agent Kit v4 Migration Walks a project from [email protected] to v4: swaps packages, rewrites imports and ports custom tools to BaseTool. CX Codex +1 484installs agent-kit-plugin This skill guides the creation of Hedera Agent Kit plugins and tools. Use it when adding token, account, consensus, smart contract, or custom Hedera functionality. CX Codex +1 463installs create-harness-spec Turns a Hedera feature idea into a runnable hedera-harness recipe: PRD, spec file and validators. Useful when you need a spec you can actually run. CX Codex +1 465installs harness-spec-anatomy Defines what a hedera-harness recipe is made of: the files, the v3 defaults, the run stages and the blind evaluate-checklist rule. For anyone authoring or auditing recipes. CX Codex +1 464installs x402-payments An agent skill for gating HTTP resources behind HBAR payments with x402: a 402 challenge, a signed transfer, then verify and settle through your own facilitator. CX Codex +1 462installs layerzero-messaging A skill for building LayerZero V2 bridges between Hedera and EVM chains: OFT/OApp setup, Endpoint V2 wiring, ULN, DVN and sends via quoteSend. CX Codex +1 460installs supra-push-oracle A skill for reading the Supra push oracle on Hedera: getSvalue(pairId), millisecond timestamps and USDT pairs. Useful when a contract pulls prices from Supra. CX Codex +1 448installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor