Cronos EVM Docs
  • Getting Started
    • Getting Started
    • Background
    • Architecture
    • Cronos roadmap
  • FOR USERS
    • 💳Crypto.com Card Top Up
    • 🔥Crypto Wallets
    • 🦊MetaMask Configuration
    • 🦁Brave Wallet
    • 🌉Bridges
      • From the Crypto.com App and Exchange
        • From the Crypto.com App
        • From the Crypto.com Exchange
      • IBC (Cronos POS Chain, other Cosmos chains)
        • Cronos Bridge Web App
      • Independent bridges
      • FAQs for Bridge transfers
      • FAQs for transactions from/to centralized exchanges
    • 🚰Testnet Faucet
    • 💡Tips & FAQs
    • 👮Key Principles for Wallet Security
    • GasTracker
  • FOR DAPP DEVELOPERS
    • 💡Founder FAQs
    • 🏅Hacker's Getting Started Resources
    • 📃Smart Contracts
      • Contract Development on Testnet
      • Contract Deployment and Verification
      • Contract Verification Export: Cronoscan To Cronos Explorer
      • Best Practices
      • Token Contract Addresses
    • 💻dApp Creation
      • Free and commercial RPC endpoints
      • Wallet integrations
      • Web3-wallet
      • JSON-RPC methods
      • Address Conversion
      • Swagger Playground
    • ⚙️Dev Tools & Integrations
      • All dev tools & integrations
      • Account Abstraction
      • Band Protocol
      • Banxa
      • GoldRush
      • Cronos Safe
      • Flair
      • Google Bigquery
      • Moralis
      • Pyth
      • Secret Network
      • SubQuery
      • Witnet
    • Crypto.com AI Agent SDK
  • FOR NODE HOSTS
    • Running nodes
      • Cronos Mainnet
        • Quicksync
        • State-sync
        • Public Node Sync
        • KSYNC
        • The "Huygen" upgrade guide (v0.6.* to v0.7.*)
        • The "v0.7.0-hotfix" upgrade guide (v0.7.* to v0.8.*)
        • The "Galileo" upgrade guide (v0.8.* to v1.0.*)
        • The "Titan" upgrade guide (v1.0.* to v1.1.0)
        • The "v1.2" upgrade guide (v1.1.* to v1.2.0)
        • The "v1.3" upgrade guide (v1.2.* to v1.3.0)
        • The "v1.4" Pallene upgrade guide (v1.3.* to v1.4.1)
        • Patching Unlucky & Duplicate Tx
      • Cronos Testnet
      • Devnet
      • Best Practices
      • Cronosd build with Nix
      • VersionDB
      • MemIAVL
      • Local State Sync
    • Cronosd
  • CRONOS PLAY
    • Introduction
    • Unity Engine
      • Current Version
      • Legacy Version
        • EVM
        • Login Example
        • Custom RPC
        • ERC20
        • ERC721
        • ERC1155
      • Useful Links
    • Unreal Engine
      • Installation and Enabling
      • Working with Blueprint
        • Actors and Blueprint Classes
        • Cronos Configuration
        • Connect Defi Desktop/Onchain Wallet with URI
        • Connect Wallets with QR Code
        • Connect WalletConnect Step by Step
        • WalletConnect 2.0 and Unreal Engine 5: Hello World Example
        • Wallet
        • ERC20
        • ERC721
        • ERC1155
        • Broadcast Transactions
        • Get Tokens or Transactions
      • Working with C++
        • Creating a C++ Project
        • Creating a child DefiWalletCoreActor
        • Querying a contract
        • Customizing Network
      • Demo
    • Cronos Play C++ SDK
    • Crypto.com Pay Integration
    • Cronos Play FAQ
  • Block Explorers
    • Block Explorer and API Keys
    • Cronos Explorer
    • Cronoscan
  • CRONOS CHAIN PROTOCOL
    • Chain ID and Address Format
    • Cronos General FAQ
    • Genesis
    • Modules
      • module_bank
      • module_distribution
      • module_slashing
      • module_feemarket
    • Chain Details
      • List of parameters
      • Technical glossary
      • Protocol Documentation
    • Common IBC Commands
  • Cronos zkEVM
    • Cronos zkEVM
  • Resources
    • Media / brand kit
Powered by GitBook
On this page
  • Overview
  • Using Pyth Network on Cronos EVM
  • Pyth on Cronos EVM
  • Using Pyth as a PUSH Oracle
  • Developers and community

Was this helpful?

Edit on GitHub
  1. FOR DAPP DEVELOPERS
  2. Dev Tools & Integrations

Pyth

PreviousMoralisNextSecret Network

Last updated 4 months ago

Was this helpful?

Overview

is one of the largest first-party Oracle network, delivering real-time data across . The network comprises some of the world’s . These publish proprietary data on-chain for aggregation and distribution to smart contract applications.

Using Pyth Network on Cronos EVM

The Pyth introduces an innovative low-latency , 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 on Cronos EVM have permissionless access to any of 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 network. You have to pass for Cronos EVM mainnet/testnet and the desired to fetch the latest price.

// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;

import "@pythnetwork/pyth-sdk-solidity/IPyth.sol";
import "@pythnetwork/pyth-sdk-solidity/PythStructs.sol";

contract MyFirstPythContract {
    IPyth pyth;

    constructor(address _pyth) {
        pyth = IPyth(_pyth);
    }

    function fetchPrice(
        bytes[] calldata updateData,
        bytes32 priceFeed
    ) public payable returns (int64) {
		    // Fetch the priceUpdate from hermes.
        uint updateFee = pyth.getUpdateFee(updateData);
        pyth.updatePriceFeeds{value: updateFee}(updateData);

        // Fetch the latest price
        PythStructs.Price memory price = pyth.getPrice(priceFeed);
        return price.price;
    }
}

Pyth on Cronos EVM

The Pyth Network smart contract is available at the following address:

Cronos EVM

Using Pyth as a PUSH Oracle

Developers and community

The Pyth network provides additional tools to developers, such as

Check out the following links to get started with Pyth.

Here you can fetch the updateData from Pyth's , which listens to Pythnet and Wormhole for price updates; or you can use the SDK. Check to pull the latest data.

This provides utilities for consuming prices from the Pyth network oracle using Solidity. Also, it contains the that you can use in your libraries to communicate with the Pyth contract.

It is generally recommended to follow the when consuming Pyth data.

For more information, check out the official . There are details on the various functions available for interacting with the Pyth smart contract in the .

Mainnet:

Testnet:

Additionally, click to access the .

Pyth Oracle can be used as a Push oracle by running a scheduler which can update the prices in the backend. Checkout the open source app to get started with the scheduler.

, or

.

⚙️
Pyth Network
a vast number of chains
largest exchanges, market makers, and financial services providers
pull oracle design
Pyth’s price feeds
Pyth's contract address
price feed id
Hermes
pyth-evm-js
How to Fetch Price Updates
package
Pyth Interface ABI
consumer best practices
Pyth documentation
API Reference section
0xE0d0e68297772Dd5a1f1D99897c581E2082dbA5B
0x36825bf3Fbdf5a29E2d5148bfe7Dcf7B5639e320
Pyth price-feed IDs
price pusher
TradingView Integration
Gelato web3 functions
Pyth EVM Integration Guide
Pyth Docs
Pyth API Reference
Pyth Examples
Pyth Price Feed Ids
Website
Twitter