Tejas Badadare 68d57efe32 chore: support anchor 0.32.1 in pyth-solana-receiver-sdk (#3159) 2 settimane fa
..
cli 197139e346 feat(pyth-solana-receiver-sdk): upgrade anchor-lang to 0.31.1 (#3026) 2 mesi fa
common_test_utils 197139e346 feat(pyth-solana-receiver-sdk): upgrade anchor-lang to 0.31.1 (#3026) 2 mesi fa
migrations 16caff1b04 [solana] Start to implement the solana receiver contract (#557) 2 anni fa
program_simulator 71d6a89aea chore: Rust toolchain/CI update and workspace setup (#2830) 4 mesi fa
programs 197139e346 feat(pyth-solana-receiver-sdk): upgrade anchor-lang to 0.31.1 (#3026) 2 mesi fa
pyth_solana_receiver_sdk 68d57efe32 chore: support anchor 0.32.1 in pyth-solana-receiver-sdk (#3159) 2 settimane fa
scripts 5a676978db feat: add pyth_push_oracle to dockerfile (#1470) 1 anno fa
sdk 31c364cf41 feat: performed a minor bump all packages, since all were changed in the big dual package update 2 settimane fa
target 8f62566dbb [solana] Fix idl (#1279) 1 anno fa
.gitignore ab0cf6f7d8 chore: updated gitignore to excluse the built dist/ folder 3 settimane fa
.prettierignore 6efbe89542 chore: updated prettier ignores to prevent bikeshedding 2 settimane fa
Anchor.toml f3249d9cba feat(apps/hermes): new client package for hermes (#1653) 1 anno fa
Cargo.lock 197139e346 feat(pyth-solana-receiver-sdk): upgrade anchor-lang to 0.31.1 (#3026) 2 mesi fa
Cargo.toml 197139e346 feat(pyth-solana-receiver-sdk): upgrade anchor-lang to 0.31.1 (#3026) 2 mesi fa
Dockerfile 5a676978db feat: add pyth_push_oracle to dockerfile (#1470) 1 anno fa
README.md f31ef9e812 docs: update solana readme, add rust sdk readme (#1387) 1 anno fa

README.md

Pyth Solana Receiver

This folder contains:

Overview of the design

Posting a Pyth price update involves two steps:

  • First, verifying the VAA i.e. verifying the Wormhole guardians' signatures on the accumulator root that contains all the price updates for a given Pythnet slot.
  • Second, verifying the price update by providing an inclusion proof that proves the price update is part of the accumulator root that was verified in the first step.

Implementation

This contract offers two ways to post a Pyth price update onto Solana:

  • post_update allows you to do it in 2 transactions and checks all the Wormhole guardian signatures (the quorum is currently 13 signatures). It relies on the Wormhole contract to verify the signatures.
  • post_update_atomic allows you to do it in 1 transaction but only partially checks the Wormhole guardian signatures (5 signatures seems like the best it can currently do). Therefore it is less secure. It relies on a guardian set account from the Wormhole contract to check the signatures against the guardian keys.

post_update is also a more efficient way to post updates if you're looking to post data for many different price feeds at a single point in time. This is because it persists a verified encoded VAA, so guardian signatures will only get checked once. Then that single posted VAA can be used to prove the price update for all price feeds for that given point in time.

Program addresses

The program is currently deployed on Solana (Mainnet, Devnet) and Eclipse Testnet with addresses:

  • HDwcJBJXjL9FpJ7UBsYBtaDjsBUhuLCUYoz3zr8SWWaQ for the Wormhole receiver
  • rec5EKMGg6MxZYaMdyBfgwp4d5rB9T1VQH5pJv5LtFJ for the Pyth receiver

Example flow

The cli folder contains some useful client code to interact with both the Wormhole receiver and the Pyth receiver.

To run the full flow of posting a price update (on devnet) please follow the following steps:

Get a Hermes update from Hermes stable:

curl  "https://hermes.pyth.network/api/latest_vaas?ids[]=0xff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace"

Post it to devnet:

cargo run --package pyth-solana-receiver-cli -- --url https://api.devnet.solana.com --keypair ${PATH_TO_KEYPAIR} --wormhole HDwcJBJXjL9FpJ7UBsYBtaDjsBUhuLCUYoz3zr8SWWaQ post-price-update-atomic -p ${HERMES_UPDATE_IN_BASE_64}

or

cargo run --package pyth-solana-receiver-cli -- --url https://api.devnet.solana.com --keypair ${PATH_TO_KEYPAIR} --wormhole HDwcJBJXjL9FpJ7UBsYBtaDjsBUhuLCUYoz3zr8SWWaQ post-price-update -p ${HERMES_UPDATE_IN_BASE_64}