pyth-crosschain/target_chains/solana
guibescos a592c6bc33
fix: publish workflow (#1532)
* dry run

* check

* Fix workflows

* rexport price feed message
2024-05-01 19:11:25 +01:00
..
cli fix: initialize guardian expiration to the right value (#1485) 2024-04-22 17:14:42 +01:00
common_test_utils feat: pyth pull-based push oracle (#1370) 2024-04-01 14:43:47 +01:00
examples/send_usd feat: add input boxes (#1515) 2024-04-30 14:07:05 +01:00
migrations [solana] Start to implement the solana receiver contract (#557) 2023-02-15 15:43:51 +00:00
program_simulator feat: add posted slot (#1372) 2024-03-20 19:38:33 +00:00
programs feat: move VAA_SPLIT_INDEX (#1466) 2024-04-17 18:14:11 +01:00
pyth_solana_receiver_sdk fix: publish workflow (#1532) 2024-05-01 19:11:25 +01:00
scripts feat: add pyth_push_oracle to dockerfile (#1470) 2024-04-19 15:36:25 +01:00
sdk/js chore: remove repetitive words (#1524) 2024-04-30 12:17:10 +01:00
target/idl [solana] Fix idl (#1279) 2024-02-06 11:36:19 +00:00
.gitignore chore(target_chains/solana): add verifiable build script (#1378) 2024-03-21 19:07:17 +01:00
.prettierignore [solana] Start to implement the solana receiver contract (#557) 2023-02-15 15:43:51 +00:00
Anchor.toml feat: add solana send usd example app (#1471) 2024-04-25 20:19:11 +01:00
Cargo.lock feat: add anchor to pythnet sdk (#1531) 2024-05-01 14:39:17 +01:00
Cargo.toml feat: add solana send usd example app (#1471) 2024-04-25 20:19:11 +01:00
Dockerfile feat: add pyth_push_oracle to dockerfile (#1470) 2024-04-19 15:36:25 +01:00
README.md docs: update solana readme, add rust sdk readme (#1387) 2024-03-25 12:31:40 +00:00
rust-toolchain.toml Bump toolchain: (#1382) 2024-03-22 12:18:44 +00:00

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}