I want to integrate Pyth with a new chain, with smart contract support in Python.
This is the flow of messages I gather should happen:
Get the price info off-chain, using Hermes for example (curl "https://hermes.pyth.network/v2/updates/price/latest?ids[]=ec7a775f46379b5e943c3526b1c8d54cd49749176b0b98e02dde68d1bd335c17&binary=true"). I’ll get the hexadecimal data.
Send the data to the on-chain contract;
On-chain contract has to validate the data;
The data validation process is the one which is unclear to me. I believe there are 2 validations:
a) Validate the VAA message comes from Wormhole;
b) Validate the payload data with oracle info. This would be a Pyth specific message?
Is that correct?
From the hexadecimal VAA data, how can I validate it? Probably there are some resources from Wormhole that you can point to?
After that, how do I decode and validate the Pyth specific data? I couldn’t find resources on the documentation website.
I can try to follow some of the existing integration codes (example: Stacks integration), but it would be much better if I could understand the data models and validation from your docs so no mistakes are made.
Hey, following up here because I noticed some things were up with the analysis that Claude output. I’m still working on this to find a robust and complete solution. When I get there, I’ll be sure to share it here
print(f"Signatures: {signature_count}") # 13 guardians signed
If you look at the data closely, the 6th byte (index 5 for 0 based indexing) in vaa_hex is 0 and it still calculated the number of guardians that have signed as 13.
Hi guys, deleted my earlier post as I wasn’t able to (or couldn’t figure out how to edit it)
I went back to the drawing board, and put together this repository that shows & documents exactly how to extract and verify a wormhole VAA.
One big gotcha I ran into, is that the Pyth VAA’s available from hermes v1 api, seemed to be signed by a different guardian set - any time I tried to recover an address from a signature, it wouldn’t match the v4 guardian set from wormhole. It’s also possible I wasn’t properly constructing the body to create the digest needed to recover the public key.
IN ANY CASE, here’s a repo showing exactly how to validate a wormhole VAA.
I’m working on parsing the Pyth Price update from the payload, will follow up when I get that figured out & have a working example & tests.
I haven’t been able to validate a Pyth Hermes v1 VAA, or find some cryptographic link between one and a Wormhole VAA with the same emitter address & sequence number from WormholeScan.
Not really sure where to go from here.
@ali perhaps you could shed some light on what the correct approach is for verifying Pyth Hermes VAA signatures against the Wormhole Guardian Set Addresses ?