Pyth (Oracle)
Overview
Pyth Network is one of the largest first-party Oracle network, delivering real-time data across a vast number of chains. The network comprises some of the worldβs largest exchanges, market makers, and financial services providers. These publish proprietary data on-chain for aggregation and distribution to smart contract applications.
Using Pyth Network on Cronos zkEVM
The Pyth introduces an innovative low-latency pull oracle design, where users can pull price updates onchain when needed, enabling everyone in the onchain environment to access that data point most efficiently. Pyth network updates the prices every 400ms.
Developers Cronos zkEVM have permissionless access to any of Pythβs price feeds for equities, ETFs, commodities, foreign exchange pairs, and cryptocurrencies.
Example
Here is a working example of a contract that fetches the latest price of ETH/USD on the Cronos zkEVM. You have to pass Pyth's contract address for Cronos zkEVM mainnet/testnet and the desired price feed id to fetch the latest price.
Here you can fetch the updateData
from Pyth's Hermes
, which listens to Pythnet and Wormhole for price updates; or you can use the pyth-evm-js
SDK. Check How to Fetch Price Updates to pull the latest data.
This package provides utilities for consuming prices from the Pyth network oracle using Solidity. Also, it contains the Pyth Interface ABI that you can use in your libraries to communicate with the Pyth contract.
It is generally recommended to follow the consumer best practices when consuming Pyth data.
For more information, check out the official Pyth documentation. There are details on the various functions available for interacting with the Pyth smart contract in the API Reference section.
Pyth on Cronos zkEVM
Deployment status
β Cronos zkEVM Mainnet (Chain-id :
388
)
Mainnet deployment completed - 0x056f829183ec806a78c26c98961678c24fab71af
β Cronos zkEVM Sepolia Testnet (Chain-id :
282
)
Testnet deployment completed - 0xB1DB1498902F08E16E11F1a423ec9CCB9537E1D6
Additionally, click to access the Pyth price-feed IDs.
Using Pyth as a PUSH Oracle
Pyth Oracle can be used as a Push oracle by running a scheduler which can update the prices in the backend. It will make sure that the your dapp will be updated with latest prices as per your configuration. Checkout the open source price pusher app to get started with the scheduler.
Developers and community
The Pyth network provides additional tools to developers, such as TradingView Integration, or the Gelato web3 functions.
Check out the following links to get started with Pyth.
Last updated