Pyth Network
Pyth Network is an oracle that publishes financial market data to multiple blockchains. Our market data is contributed by over 80 first-party publishers, including major exchanges and market making firms. We offer price feeds for a number of different asset classes, including US equities, commodities, and cryptocurrencies. Each price feed publishes a robust aggregate of publisher prices that updates multiple times per second.
How Pyth works
Pyth allows market participants to publish pricing information onchain for others to use. The protocol is an interaction between three parties:
- Publishers submit pricing information to Pyth's oracle program. Pyth has multiple data publishers for every product to improve the accuracy and robustness of the system.
- Pyth's oracle program combines publishers' data to produce a single aggregate price and confidence interval.
- Consumers read the price information produced by the oracle program.
Pyth on-demand model
Pyth Network uses a pull price update model that is slightly different from other oracles you may be more familiar with. Most oracles today use a push model, where the oracle runs an offchain process that continuously sends transactions to update an onchain price. In contrast, Pyth Network doesn't operate an offchain process that pushes prices onchain. Instead, it delegates this work to Pyth Network users.
Pyth price updates are created on Pythnet and streamed offchain via the Wormhole Network, a cross-chain messaging protocol. These updates are signed such that the Pyth onchain program can verify their authenticity. Updating the onchain price is a permissionless operation: anyone can submit a valid Wormhole message to the Pyth contract to update the price. Typically, users of Pyth Network prices will submit a single transaction that simultaneously updates the price and uses it in a downstream application.
Onchain prices can only move forward in time. If a user submits a Wormhole message with an outdated price, the Pyth program will not fail, but will also not update the price. This means there's no guarantee that when a user atomically updates the price and then interacts with an application powered by Pyth, the price that the application will read will be equal to the price the user submitted.
Read an in-depth explanation from one of our contributors, Jayant, and read more about on-demand updates.
Use price feeds
Price feed IDs
Each Pyth Network price feed has a unique ID. However, the IDs may be represented in different formats (e.g., hex or base58) depending on the blockchain. Price feeds also have different IDs in mainnets than testnets or devnets. The full list of price feeds is listed on the pyth.network website. The price feed IDs page lists the ID of each available price feed on every chain where they are available. To use a price feed onchain, look up its ID using these pages, then store the feed ID in your program to use for price feed queries.
Pyth on EVM (Linea)
Onchain EVM programs can use the Solidity SDK to read Pyth prices. The EVM API reference lets you interactively explore the complete API of the Pyth contract.
The offchain portion of the application can use pyth-evm-js to generate price update transactions. This repository's quickstart includes an example of both the on- and offchain code necessary to integrate with Pyth.
Examples
View the example applications in the Pyth repository.
Networks
Pyth is currently available on the following Linea networks:
Network | Contract address |
---|---|
Linea Mainnet | 0xA2aa501b19aff244D90cc15a4Cf739D2725B5729 |
Linea Sepolia | 0xA2aa501b19aff244D90cc15a4Cf739D2725B5729 |
Price feed IDs
The price feed IDs for EVM chains differs depending on whether they are a mainnet or testnet (see above):