Pyth is coming
to Base

With the recent launch of Pythnet - a dedicated app-chain for Pyth price aggregation - and the integration with the Wormhole Protocol, your dApp will soon be able to permissionlessly request and consume any of the 200+ Pyth price feeds directly on Base.

What is Pyth?

The Pyth network is a first-party financial oracle network designed to publish continuous real-world data on-chain in a tamper-resistant, decentralized, and self-sustainable environment.

The network is designed to incentivize market participants — exchanges, market makers, and financial services providers — to share directly on-chain the price data collected as part of their existing operations. The network then aggregates this first-party price data and makes it available for free to either on- or off-chain applications.

In less than a year, the network secured more than $2.0B in total value, supported up to $3.8B in monthly trading volume ($30B+ in total), and exceeded 500K client downloads.

Pyth currently supports 200+ price feeds including crypto, equities (including the full US 30), FX, metal, and more — and updates twice per second without any access restriction. Upcoming feeds include Base ecosystem tokens.

More details can be found here.

How does Pyth Work
on Base ?

Pyth prices are published and aggregated on Pythnet and then relayed to Base using the Wormhole Network as a cross-chain message passing protocol. Wormhole observes when Pyth prices on Pythnet have changed and publishes an off-chain signed message attesting to this fact.

This signed price update message can then be submitted to the Pyth contract. The contract verifies the Wormhole message and updates the on-chain Pyth price to the new price.

Pyth does not automatically submit the prices to the networks; Protocols and users are responsible for updating the on-chain Pyth price before using it.

To learn more, please visit our docs.

How to integrate Pyth
feeds on Base

1// SPDX-License-Identifier: MIT
2pragma solidity ^0.8.0;
3
4import "@pythnetwork/pyth-sdk-solidity/IPyth.sol";
5import "@pythnetwork/pyth-sdk-solidity/PythStructs.sol";
6
7contract ExampleContract {
8    IPyth pyth;
9
10    constructor(address pythContract) {
11        pyth = IPyth(pythContract);
12    }
13
14    function getBTCUSDPrice(bytes[] memory priceUpdateData) public returns (PythStructs.Price memory) {
15        // Update the prices to be set to the latest values. The 'priceUpdateData' data should be
16        // retrieved from our off-chain Price Service API using the 'pyth-evm-js' package.
17        // See section "How Pyth Works on EVM Chains" below for more information.
18        pyth.updatePriceFeeds(priceUpdateData);
19
20        bytes32 priceID = 0xf9c0172ba10dfa4d19088d94f5bf61d3b54d5bd7483a322a982e1373ee8ea31b;
21        return pyth.getCurrentPrice(priceID);
22    }
23}

Start integrating

Read the Docs