Overview
Pyth is an oracle network that disseminates real-time market data across 40+ blockchains and can also be used by off-chain applications. Notably, it boasts contributions from over 90+ first-party publishers, including prominent names like Jane Street, CBOE, Binance, OKX, and Bybit.
Unlike legacy oracles, which often rely on infrequent updates and questionable data sources, Pyth offers on-chain data accessibility by directly sourcing information from top-tier global financial market participants, including renowned market makers, exchanges, and trading firms.
The key objectives of Pyth are to democratize access to financial market data across all blockchain networks, empowering data owners and users alike. By leveraging data from reputable sources, Pyth ensures high accuracy and low latency, providing on-chain financial data critical for DeFi applications to scale globally.
The whitepaper introduces an oracle protocol to make accurate and high-resolution financial data available on-chain. The mechanism design ensures that a self-sustaining decentralized network coordinates data publishers and consumers. For this, the incentive structure is designed to attract publishers with high-quality pricing data, and incentivize them by paying them fees collected from consumer usage of the data. The actual process also aims to protect against price manipulation.
Pyth offers price feeds for a number of different asset classes, including US equities, commodities, and crypto. Each price feed publishes a robust aggregate calculated from publisher prices that update multiple times per second.
Pyth sets itself apart in the oracle space with several key features and principles that prioritize quality, security, and reliability:
- Frequency of Updates: Pyth enables high frequency updates via a pull model, which ensures more timely operations for DeFi applications. With other oracles DeFi applications need to wait for periodic updates to be posted on-chain, but Pyth allows them to pull this data whenever they need it.
- Confidence Intervals: Pyth implements confidence intervals to protect protocols and users. These intervals add an additional layer of assurance and risk mitigation against potential data inaccuracies.
- Diverse Data Offering: Pyth provides a diverse range of data, including live US equities, FX pairs, and metal prices, which may be challenging to obtain from other sources. This breadth of data offerings enhances the versatility and applicability of Pyth’s oracle services.
- Advanced Features: Pyth offers various advanced features such as publisher performance metrics, Exponential Moving Averages (EMA/EMAC), cross-pair support, and basketing (indexing or compositing).
- Quality Sourcing and Transparency: Pyth sources data from a wide variety of best-in-class market participants in both traditional and decentralized finance. This approach ensures high-quality and reliable data. Moreover, Pyth’s operations are transparent, with aggregation occurring fully on-chain, unlike legacy oracles that may run opaque processes vulnerable to manipulation.
- High Standards for Security and Reliability: Pyth implements reliability measures such as confidence bands, minimum publisher rules, rigorous data feed conformance testing, and economic recourse for protocol developers.
Pyth eliminates data middlemen by design, ensuring direct access to high-quality data without intermediaries charging fees for relaying data.
Data publishers on Pyth are held accountable for the accuracy and integrity of the data they submit. These publishers understand the significant responsibility entrusted to them, as their data plays a crucial role in securing potentially billions in value within the ecosystem. This accountability incentivizes publishers to maintain honesty and integrity in their data submissions, fostering trust and reliability in Pyth’s oracle services.
Pyth’s design incentivizes publishers to contribute their proprietary pricing information rather than simply copying data from other sources. This emphasis on originality encourages diversity in data sources and promotes the availability of unique and valuable pricing information.
Overview
In traditional financial markets, access to live and historical price feeds has been tightly controlled, limiting accessibility to only a select few institutions and users. While the cryptocurrency markets have been more open, this status quo is not guaranteed to persist. As a result, only a privileged group has enjoyed timely, accurate, and valuable market information.
Pyth aims to democratize access to this valuable financial market data by incentivizing trading firms, market makers, and exchanges to share their first-party price data. This data, collected as part of their existing operations, is aggregated by the network and published on-chain for use by both on- and off-chain applications.
Each product’s price feed is dynamic, constantly reflecting its current price alongside a confidence interval that quantifies the estimated uncertainty in that price. For instance, the BTC/USD feed may report a price of $65,000 ± $50. These feeds are then made accessible on-chain for consumption by a diverse set of users, including blockchain-enabled programs running on various blockchains and off-chain applications.
The generation of these price feeds involves an on-chain program that aggregates data from individual publishers. To participate, publishers must be first-party data providers, possessing the capability to source high-quality, up-to-the-minute pricing data.
To achieve this, Pyth orchestrates the interaction of two primary groups of participants:
- Publishers: These entities are responsible for publishing price feeds, and they earn fees in return. Typically, publishers are market participants with access to precise and timely pricing information.
- Consumers: Consumers are the end-users of the price feeds on a target chain. They read and integrate this data into their smart contracts or decentralized applications (dApps). To access the data, consumers pay fees to the protocol.
To ensure broad accessibility to Pyth prices, the protocol is designed to function across multiple blockchains. Pyth achieves this through Pythnet, an appchain where the state of each price feed is stored and updated.
Pyth Data Products
Pyth offers three different data products to support various applications:
- Solana Price Feeds: Real-time price data access for Solana mainnet.
- Pythnet Price Feeds: Real-time prices for a wide range of ecosystems and chains (most EVM chains, several Cosmos chains, Aptos and Sui). The number of supported chains will increase over time.
- Benchmarks: Benchmarks provide historical Pyth prices that can be used both on-chain and off-chain.
Solana Price Feeds
Solana Price Feeds offer a straightforward way for application developers to access real-time price updates on Solana mainnet.
Solana Price Feeds continuously stream price updates to Solana, and each price feed has its own dedicated Solana account. Application developers can easily access the relevant Solana account associated with the specific price feed they need. They can then use this account as a data source within their Solana programs.
To read the current value of the price feed, developers need to deserialize the data stored in the Solana account. This data represents the current price, along with other relevant information.
To facilitate development Pyth provides a Solana SDK. Developers can familiarize themselves with how price feeds are represented and learn best practices using the following guide.
Pythnet
Pythnet is a fork of Solana. The chain employs a proof-of-authority (PoA) consensus mechanism, with each publisher operating a validator node. Prices are disseminated from Pythnet to other target chains via a cross-chain architecture that leverages decentralized cross-chain messaging protocols like Wormhole. This broadcasting approach simplifies support for numerous target chains, enabling consumers to access Pyth data seamlessly, regardless of the blockchain they are using.
Within Pythnet, publishers and consumers can interact via two mechanisms:
- Price Aggregation: This mechanism aggregates the price feeds of individual publishers into a single price feed for each product. Its primary objective is to create robust price feeds, resilient to significant manipulation by small groups of publishers.
- Pyth Governance: This element governs the high-level parameters of the protocol’s various mechanisms, ensuring the protocol’s integrity and reliability.
Pythnet enables a cross-chain strategy that, by leveraging the cross-chain message capabilities of Wormhole, can enable the seamless flow of price data from one blockchain to another, thus expanding the accessibility and utility of its data feeds across multiple blockchain ecosystems.
Pythnet ensures secure and reliable computation of aggregate prices. Validators replay the transaction log to verify price computation correctness. As long as 2/3+ of Wormhole guardians are honest, users can trust the accuracy of Pyth prices. Furthermore, Pythnet has built-in redundancy to maintain high availability. It remains operational as long as 2/3+ of validators are online, even during periods of high market volatility or contested transaction bandwidth on target chains.
Cross-chain Architecture
Pyth employs a cross-chain architecture to ensure the efficient and reliable transfer of data across various chains. This architecture is designed to meet several critical objectives:
- Minimize Transaction Costs: One of the key challenges in maintaining price feeds across multiple blockchains is the cost associated with transactions (gas fees). These costs can become prohibitively expensive.
- Support High-Frequency and Low-Latency Updates: For applications that depend on timely and high-frequency price information, Pyth’s cross-chain architecture ensures that updates are both rapid and low-latency.
- Scale to Many Blockchains: To accommodate diverse use cases on different blockchains, each with unique runtimes, consensus models, and gas costs, the architecture must efficiently scale across multiple blockchains.
- Scale to Many Price Feeds: The Pyth protocol should be able to handle a wide range of price feeds for various assets, including cryptocurrencies and traditional assets. It must do so while ensuring cost-effective cross-chain data transfer.
These challenges are addressed through a “pull” oracle model which follows a three-part workflow:
- Efficient and cost-effective publishing: Instead of using generalized blockchains with potentially high gas costs, Pythnet, an application-specific blockchain, is used for price publishing. Permissioned publishers can submit price updates to the on-chain oracle program on Pythnet at no cost. These updates include valid prices and confidence intervals, which are stored in corresponding on-chain price accounts.
- Broadcasting: As part of Pythnet’s consensus process, Pythnet validators perform a price broadcast operation. This operation aggregates publishers’ prices into aggregate prices for each updated price feed. Subsequently, it invokes the message buffer program, enabling the creation of messages to be sent to other chains. These messages contain the aggregate prices of updated feeds. Next, validators construct a Merkle tree with these prices as leaves and broadcast the tree’s root to other chains using a cross-chain messaging protocol like the Wormhole network
- Relaying on target chains: On target chains where Pyth prices are required, Pyth receiver contracts store prices for each Pyth price feed. These contracts allow permissionless operations to update stored prices. To perform an update, consumers need an attested merkle tree root, a price update for a specific symbol (a leaf in the corresponding merkle tree), and the path in the tree leading from that leaf to the root. The update undergoes various checks, including signature validation and root-leaf-path verification. If the update is valid, the new prices are stored in the Pyth receiver contract.
To maintain data freshness, consumers of Pyth prices are responsible for invoking permissionless price updates on-chain before using the price. Without these updates, the price stored in the Pyth receiver contract becomes stale over time.
Protocols integrating Pyth price feeds can set limits on the maximum allowable staleness of prices, ensuring that users always have access to up-to-date data. Importantly, consumers only incur transaction costs when they need to update prices for their specific operations, avoiding unnecessary fees.
This approach allows the cross-chain architecture to efficiently stream high-frequency price updates while minimizing transaction costs on target chains.
- Data Publication: Publishers within the Pyth Network continue to publish pricing data to the on-chain program as usual. This ensures that accurate and timely price information is consistently available within Pyth.
- Integration with Wormhole: Pyth leverages Wormhole’s generic messaging protocol to facilitate the transfer of data across different blockchains. Wormhole serves as a bridge that enables the transfer of information or tokens across chains.
- Data Transfer Process: When a data consumer from a Wormhole-supported chain requests price data from Pyth, Wormhole acts as an intermediary. It vouches for the accuracy and integrity of the prices sourced from Pyth and facilitates the transfer of this data to the Pyth contract deployed on the consumer’s native chain.
- Availability on Demand: The transferred price data is made available on-demand, ensuring that consumers can access the information they need at their desired frequency. This on-demand availability helps reduce costs and ensures efficient utilization of resources.
- Scalable Data Usage: Once a specific set of price data is requested and transferred to a particular blockchain, it becomes accessible to all protocols and applications operating on that chain. This scalability allows multiple users and projects within the ecosystem to utilize the same set of data for various purposes.
By integrating with Wormhole and leveraging its cross-chain messaging capabilities, Pyth effectively extends the reach of its price data feeds beyond its native blockchain, enabling seamless integration with various blockchain ecosystems. This cross-chain strategy enhances the interoperability and utility of Pyth’s data, making it accessible to a wider range of users and applications across different blockchains.
- Data providers publish their prices on Pythnet.
- The on-chain oracle program aggregates prices for a feed to obtain the aggregate price and confidence level.
- Pythnet validators send a Wormhole message containing the Merkle root of all prices to the Wormhole contract on Pythnet with each Pythnet slot.
- Wormhole guardians observe the Merkle root message and create a signed Validity Assertion Artifact (VAA) for the Merkle root message.
- A web service called Hermes continuously listens to Wormhole for Pyth Merkle roots and Pythnet for price messages. It stores the latest price messages with their Merkle proof and signed Merkle root and exposes HTTP and websocket APIs for retrieving the latest update.
- When a user wants to use a Pyth price in a transaction, they retrieve the latest update message from Hermes and submit it in their transaction. The update message includes the signed Merkle tree root and Merkle proofs of each included price update.
- The Pyth Network contract verifies the payload by checking Wormhole signatures on the root and Merkle proofs. If valid, it stores the new price in its on-chain storage.
On-chain protocols integrate with the Pyth contract via a simple API to retrieve the current Pyth price from its on-chain storage. This API returns the current price as long as it has been updated recently enough, determined by the recency threshold configured by the protocol.
Pyth’s Pull Oracle
One of the most notable features of Pyth is that instead of using a push model, it relies on a pull-based model. This ensures that users get timely and accurate price data while minimizing operational costs.
Traditional Push-Based Oracles
In the traditional push model, oracles actively publish price data onto a general-purpose blockchain, often performing aggregation on that same chain.
To maintain fresh prices, the oracle must regularly send transactions to update the on-chain prices. These transactions come with associated gas costs, which can escalate with higher update frequencies, more supported price feeds, blockchains, and publishers.
Traditional push oracles can suffer from reliability issues as well, as their price update transactions compete for space with other network activities. During network congestion, these updates may not get processed on-chain.
Pyth’s Pull Model
Pyth adopts a pull-based model, which involves price publishing and aggregation on a dedicated, cost-effective blockchain called Pythnet. Publishers on Pythnet can submit price updates for free, significantly reducing the overall operational costs for the oracle.
When it comes to broadcasting prices to other blockchains, instead of pushing updates regardless of demand (and incurring gas costs), Pyth only pays gas when consumers actively request a price update. This targeted approach ensures that gas consumption is more efficient.
As a result of this efficiency, Pyth can provide more frequent price updates and can scale to support a larger number of price feeds and blockchains compared to traditional push-based oracles.
For instance, Pyth excels at handling stateful computations like exponentially-weighted moving averages (EMAs). Given the frequent price updates, the time-weighted computations can use previously published data.
The pull model is also more reliable. Network congestion on target chains does not hinder publishers from publishing prices to Pythnet. Besides, users who need price data can always pull it from Pythnet to their target chain by paying a transaction fee.
Benefits of Pyth’s pull model include:
- Gas efficiency: On-chain prices are only updated when needed, saving gas by avoiding unnecessary submissions. The cost of maintaining on-chain prices is distributed among users, reducing the burden on Pyth Network.
- High update frequency: Pyth Network updates price feeds once per second, faster than most blockchains’ blocktime. Frequent updates are feasible due to the pull model, unlike push oracles which typically update less frequently.
- Low latency: Users can access recent off-chain prices in every transaction, ensuring low latency compared to relying solely on on-chain updates.
- More price feeds: Pyth Network can scale to thousands of price feeds without incurring additional costs for each feed. Users only pay gas costs for new feeds when they are used on-chain.
- Reliable in volatile conditions: Pyth price updates are incorporated into valuable transactions, ensuring reliability even in volatile market conditions where push oracles may struggle to land price updates.
- Common infrastructure: Components of Pyth Network are shared across blockchains, promoting reliability and accuracy. This approach facilitates rapid deployment on new blockchains with existing price feeds.
- Sustainable: Pyth Network protocol allows for optional data fees to compensate data providers, ensuring sustainability and incentivizing contributions. Oracles without such mechanisms may be unsustainable and prone to failure.
Oracle Program
The Oracle Program within Pyth ensures the accurate and reliable aggregation of price data from various data providers. It is responsible for maintaining price feeds, such that each of them consists of two accounts: a product account for storing metadata and a price account.
Within the price account associated with each price feed, the oracle program allocates storage space for each authorized data provider’s price contributions. These contributions are stored securely and can only be updated by authorized providers.
The oracle program aggregates the individual price estimates provided by authorized data providers into a single aggregate price and confidence interval. This aggregation process ensures that the final price data reflects the collective input from multiple sources.
In addition to aggregating prices, the oracle program can perform additional stateful computations on the resulting price series. This may include calculating moving averages or other statistical measures to further enhance the quality of the price data.
Note that while individual data provider prices are stored as internal state within the oracle program, only the aggregate price and confidence interval are made available for use in downstream applications. This helps maintain data integrity and privacy while providing accurate price data to users.
On-chain Accounts
The Pyth oracle program manages three types of on-chain accounts: Product accounts, Price accounts, and Mapping accounts.
Product Accounts | Price Accounts | Mapping Accounts |
These accounts store metadata about a specific product, such as its symbol, asset type, quote currency, and description.
For example, a product account for AAPL (Apple Inc.) includes fields like symbol, asset type (Equity), quote currency (USD), and a pointer to the associated price account. |
Price accounts store the current price information for a product. This includes the current price, confidence interval, price type, exponent, status, corporate action status, and other relevant fields. Prices are stored in a fixed-point format, and the confidence interval represents Pyth’s uncertainty about the current price.
For example, the price account for AAPL contains fields like price, confidence, price type, exponent, status, corporate action status, and more. |
Mapping accounts serve as an index of the pricing information available on Pyth. These accounts organize product accounts into a linked list structure, allowing applications to enumerate all products currently available on Pyth.
Each mapping account contains a list of product account IDs and may include a pointer to the subsequent mapping account. This linked list structure facilitates efficient access to pricing information for various products. |
The relationship between these account types is hierarchical, with mapping accounts containing references to product accounts, and product accounts containing references to price accounts.
Price Aggregation
Pyth’s price aggregation is designed to produce accurate and robust price feeds.
- 1. Data Sources: Pyth starts with multiple data sources or publishers who provide price data for a particular product, such as the price of BTC/USD. These data sources are typically market participants and institutions with access to accurate and timely pricing information.
See all data providers: https://pyth.network/publishers
- 2. Individual Price Feeds: Each data source or publisher contributes their individual price feed, along with a confidence interval that represents the estimated uncertainty of the price. For example, the BTC/USD feed may indicate the price as “$35,000 ± $50.”
The confidence intervals measure the uncertainty and dispersion between markets in the reported price.
For instance, in the image below, the purple line is the spot price, and the white bands above and below are the aggregate confidence widening and narrowing.
- 3. Aggregation Mechanism: Pyth’s aggregation mechanism combines these individual price feeds into a single, aggregated price feed for the specific product. The goal is to produce robust and reliable price feeds that cannot be significantly influenced or manipulated by a small group of publishers or malicious actors.
- 4. Limiting Influence: The aggregation mechanism is designed to limit the influence of individual publishers on the aggregate price. This is crucial to prevent accidental and/or intentional price manipulation attempts by participants who may try to alter the oracle price.
- 5. Community Oversight: The community plays a role in determining how publishers are permitted to use the protocol. This oversight can help ensure that only reputable and honest participants are allowed to provide data to Pyth.
For example, if most publishers submit a SOL/USD price of $100 and one publisher submits a price of $80, then the aggregate price will remain closer to $100. This property increases the likelihood that the aggregate price remains accurate even if a small percentage of publishers submit a price that is far from the market.
The lower thin bars in the image below represent each publisher’s prices and confidence intervals. The bold red bar on top shows the resulting aggregate price and confidence interval.
It is worth noting that the aggregate price mechanism weights data sources with different levels of accuracy. At the same time, the protocol allows publishers to submit a confidence interval. For instance, some of these publishers will be centralized exchanges. These participants are expected to have different levels of liquidity, leading to wider bid/ask spreads when liquidity is low.
This property can result in situations where one exchange reports $101 ± 1, and another reports $110 ± 10. In these cases, the aggregate price is closer to $101 than $110. This scenario is depicted in the image below.
Since Pyth collects price data from multiple publishers, these publishers may provide slightly different prices for the same product. This variation can arise from differences in data sources, trading venues, and the timing of data collection.
In real-world financial markets, there is no single fixed price for a given product. Instead, products like cryptocurrencies or securities can trade at slightly different prices across various trading venues at any given moment. These variations are influenced by factors such as supply and demand dynamics, trading activity, and liquidity.
The aggregate confidence interval in Pyth takes into account both the variation in prices across different venues and the limitations imposed by the product’s spread. It reflects the range within which the true market price of the product is likely to fall.
Confidence Intervals For Market Data Oracles
In financial markets, measurement uncertainty, often referred to as confidence or precision, is a critical factor that parallels scientific and engineering fields. Just as in scientific measurements, where the observer estimates the potential deviation from the true value, data providers in Pyth attach confidence levels to their price streams. This confidence reflects various factors, such as the bid/ask spread on a venue or expectations of trade occurrences across multiple venues.
Understanding measurement uncertainty in financial markets serves several purposes:
- Precision Indication: It signals the level of precision or uncertainty in a single observation, aiding market participants in gauging the reliability of reported prices.
- Optimal Data Fusion: By incorporating uncertainty measures, multiple independent observations can be combined more effectively. Observations with smaller uncertainties are given greater weight, while those with larger uncertainties are downweighted, leading to more robust data aggregation.
- Propagation to Derived Quantities: Similar to scientific measurements, uncertainties in raw price data can be propagated to derived quantities. For instance, combining price observations to calculate a derived quantity like speed (in financial terms, derived metrics like volatility or spreads) involves considering the uncertainties associated with each observation.
- Detection of Anomalies: Discrepancies between independent measurements, beyond their respective uncertainties, signal potential issues with one or more measurements. This discrepancy detection mechanism aids in identifying erroneous or outlier data, enhancing the overall integrity of price reporting.
In the context of the Pyth, where multiple data providers contribute price measurements asynchronously, consideration of measurement uncertainty becomes paramount. Each provider, drawing from different data sources and reporting within tight timeframes, offers their assessment of price with accompanying confidence levels. This approach fosters a more nuanced understanding of market dynamics and strengthens the reliability of aggregated price data for market participants.
Aggregation Algorithm – Weighted Median Variant
The price aggregation algorithm used in Pyth is a variant of the weighted median, designed to produce an aggregate price that reflects the contributions of various publishers while considering their stake-weight and confidence intervals.
Each publisher in the Pyth network is assigned a stake-weight. Initially, these weights are set uniformly, but in the future, they may be determined using mechanisms like data staking, as decided by the community.
- Step 1 – Computing Aggregate Price: In order to compute the aggregate price, each publisher is given 3 votes:
- One vote at their reported price.
- One vote at their reported price plus their confidence interval.
- One vote at their reported price minus their confidence interval.
- The algorithm algorithm then calculates the stake-weighted median of these votes. In essence, this step considers each publisher’s contribution to the aggregate price while accounting for their confidence intervals.
- Step 2 – Computing Confidence Interval: The second step of the algorithm calculates the aggregate confidence interval. It measures the distance from the aggregate price to two points:
- The stake-weighted 25th percentile of the votes.
- The stake-weighted 75th percentile of the votes.
- The larger of these two distances is selected as the aggregate confidence interval.
Most people understand the median as the middle value in the data set, that is, the 50th percentile. However, the median is also the value R that minimizes the objective function ∑i |R − pi | where pi is the price of the ith publisher.
This function penalizes R based on its distance from the publisher’s price pi. The proposed algorithm computes the aggregate price R that minimizes
Where si is the publisher’s stake-weight and ci is the publisher’s confidence interval.
Hence, the algorithm’s objective function minimizes the sum of two terms:
- The first term considers the weighted absolute differences between the aggregate price (R) and each publisher’s reported price (pi), where the weight is the publisher’s stake (si).
- This part of the objective function weights publishers according to their stake, giving more influence to high-stake publishers.
- The second term introduces a penalty based on the distance between the aggregate price (R) and each publisher’s reported price (pi), but only if this distance exceeds the publisher’s confidence interval (ci).
- This part of the objective function penalizes the aggregate price for being outside a publisher’s confidence interval.
The graph on the left represents the objective function of the ordinary median applied to a price p = 0, which is simply the absolute value of R. On the other hand, the graph on the right illustrates Pyth’s objective function, which is
for various choices of confidence interval ci.
In Pyth’s objective function, the width of the confidence interval determines the location of the kink in the curve. As the interval widens, the kink moves further from 0. The region between the two kinks has a reduced penalty relative to the median.
This generalization of the median maintains the desired properties: robustness to outliers and accounting for the accuracy of different data sources. The robustness stems from the inherent resilience of the median to outliers. Essentially, the 50th percentile of the dataset remains unaffected regardless of extreme values present in the dataset. Additionally, the adjustment of the confidence interval ensures that the algorithm appropriately weighs the contributions of different data sources based on their accuracy.
We can visualize the aggregation algorithm and objective function in four scenarios presented below, which provides insight into how prices and confidence intervals are combined.
- Outlier Publisher: An outlier publisher with a tight confidence interval influences the objective function, but not enough to affect the aggregate price or confidence interval significantly.
- Tighter Confidence Intervals Influence: Publishers with tighter confidence intervals have more influence on the aggregate price, given their prices align with others’ confidence intervals.
- Consistent Publishers: When many publishers’ prices and confidence intervals align, the aggregate reflects their consensus.
- Divergent Publishers: Publishers with distinct prices and non-overlapping confidence intervals widen the confidence interval due to dispersion, creating a gap between the aggregate and percentiles of the votes.
EMA Price Aggregation
An exponential moving average (EMA) is a weighted average that places more emphasis on recent data points while giving less weight to older data points. In Pyth, the EMA Price and EMA Confidence values are derived from the aggregated prices and confidences generated on-chain.
Pyth uses the Solana slot number to measure the passage of time. The averaging period is typically set to 5921 slots, which corresponds to approximately 1 hour.
Each sample is weighted by 1/Confidence, allowing the EMA to give more weight to samples with tight confidence intervals and disregard samples with wide confidence intervals. This weighting scheme ensures that outliers with wide confidence intervals do not significantly influence the EMA calculation.
For example, an outlier aggregate price with a wide confidence interval will not heavily impact the EMA calculation due to the inverse confidence weighting, as opposed to a uniform weighted average.
This implementation is particularly suited for streaming applications, as it allows the entire history of prices and weights to be represented by a single number. This method ensures that the EMA Price and EMA Confidence values accurately reflect the recent trends and reliability of the aggregated prices within the Pyth Network.
Network Roles and Control Flow
The data staking mechanism within the Pyth protocol is designed to ensure fair pricing of data fees, alignment of incentives among participants, and robustness of the claims process.
To achieve this, Pyth functions through the collaboration and coordination of 3 essential parties: Publishers, Consumers, and Delegators.
- Publishers are responsible for sourcing accurate and timely price data, which they then publish onto Pyth as price feeds. Their role extends to earning a share of the data fees generated by consumers who rely on their provided price feeds. To participate in the protocol and earn rewards, publishers must stake $PYTH tokens, thereby ensuring their commitment to delivering correct and reliable data. This staking mechanism also introduces accountability, as publishers risk having their stake slashed if they provide inaccurate information.
- Pyth Publishers: https://pyth.network/publishers
- Consumers, on the other hand, utilize the price data published by publishers in their decentralized applications (dApps), integrating it into their smart contracts for various purposes. Consumers, whether on-chain or off-chain entities, pay data fees to access and use these price feeds. The primary motivation behind paying these fees is risk reduction, as Pyth price feeds offer a means of mitigating financial losses resulting from inaccurate data. Additionally, paying data fees incentivizes more publishers to participate in the network, thereby enhancing the reliability of the price feeds.
- Delegators play a critical role in the Pyth Network by staking tokens on specific publishers. In return, they receive a portion of the data fees generated by consumers who utilize the price feeds provided by those publishers. However, staking tokens as a delegator carries inherent risks, as there is a possibility of losing the stake if the oracle proves to be incorrect. Although delegators may initially receive substantial payouts, their earnings may decline over time as the market becomes more efficient and competitive.
Asset prices are integral to DeFi applications across multiple chains, with Pyth’s oracle prices and confidence intervals contributing to a variety of use cases:
- Lending & Borrowing platforms actively track user account health and determine liquidations using Pyth’s data.
- DEXs & AMMs often rely on Pyth’s real-time prices to ensure synchronization with other exchanges, especially for derivatives.
- Options & Derivatives, Structured Products, and Vaults settle options and derivatives contracts at expiry and calculate P&L based on Pyth’s price feeds.
- Stablecoin projects utilize Pyth’s price feeds to determine the solvency of collateral assets for CDPs.
- DAO Tooling & Infrastructure projects require asset prices for cross-chain interactions and other functionalities.
- Off-chain Applications such as analytics platforms rely on Pyth’s asset price data for analytical purposes.
On the publisher side, Pyth continues to onboard data publishers that supply more data to the network. These publishers can represent a diverse range of entities, such as market makers and trading firms, traditional exchanges, crypto exchanges, or even decentralized exchanges.
Staking and Information Integrity
Introducing staking mechanisms in oracle networks, such as reputational staking or staking of collateral, can significantly enhance the integrity of data without imposing delays. These mechanisms align the incentives of oracle operators and data providers to ensure the publication of high-quality and timely information.
Reputational staking involves holding oracle operators accountable for the quality of the data they provide. By making provider contributions transparent, poor performers can be identified and addressed, thereby maintaining the integrity of the overall data feed. While this mechanism may not be inherently strong on its own, when implemented transparently and publicly, it can incentivize data providers to maintain high standards.
Literal staking, on the other hand, entails the posting of collateral by oracle operators or data providers, which can be seized in the event of incorrect data reporting, also known as “slashing.” This explicit alignment of incentives encourages contributors to actively filter for high-quality information to avoid financial penalties. Additionally, seized funds can be used to compensate for any damages incurred due to incorrect data.
Pyth’s staking mechanism plays a crucial role in ensuring data integrity within its oracle network. By requiring participants to stake $PYTH tokens as a form of collateral, Pyth aligns the incentives of data providers and operators with the accuracy and reliability of the data they contribute.
Participants, including both data publishers and operators, are required to stake $PYTH tokens to participate in the protocol. This staking requirement acts as a commitment mechanism, signaling to the network their vested interest in providing accurate and reliable data.
Publishers | Consumers | Delegators |
Incentivized to provide accurate and timely prices, publishers stake $PYTH tokens and risk stake slashing if they publish prices far from the reference price, causing issues with the oracle’s feed.
In return, they earn a share of data fees, with rewards favoring publishers whose prices predict future changes. |
Encouraged to pay data fees to mitigate risk when using Pyth price feeds and to attract more publishers to improve feed robustness. | Initially earn attractive payments by backing products, with payments reflecting inherent risks and market efficiency over time.
Delegators also set stake-weights of publishers, and are incentivized to ensure a robust price feed to avoid stake loss due to incorrect aggregate price feed. |
Staking tokens imposes a financial cost on participants in case of misbehavior or inaccurate data reporting. This creates a strong incentive for participants to diligently vet the data they provide and ensure its accuracy before publishing it onto the blockchain. The fear of losing their staked tokens acts as a deterrent against malicious behavior or negligence.
Pyth employs a slashing mechanism where staked tokens can be slashed if participants are found to provide incorrect or manipulated data. If the data reported by a publisher or operator is deemed inaccurate, it can lead to a portion of their staked tokens being forfeited. This penalty serves as a punitive measure to discourage malicious actors and maintain the credibility of the data.
Anyone can raise a claim if the oracle publishes an incorrect price. A vote of $PYTH token holders ratifies claims. In the event of a successful claim, the protocol slashes the stakes of the product’s delegators and distributes the slashed amount to consumers based on the value of data fees during the epoch of the event. This ensures that claims are successful if Pyth’s aggregate price and confidence interval were substantially incorrect for any period.
The tokens slashed from participants found to be at fault can be used to compensate users or consumers who may have been adversely affected by the incorrect data. This mechanism ensures that there are repercussions for providing unreliable data and provides restitution to affected parties.
Furthermore, Pyth’s staking mechanism also extends to its governance model, where stakeholders who hold staked tokens have voting power to influence decisions related to protocol parameters, upgrades, or changes.
Oracle Integrity Staking
Oracle Integrity Staking (OIS) introduces enhanced data accountability to Pyth’s ecosystem by requiring Pyth Publishers (data providers) to stake $PYTH tokens. This program incentivizes publishers to maintain high-quality data contributions and slashes their stake if they provide faulty or malicious data.
Key components of Oracle Integrity Staking include:
- Economic Accountability: Publishers must stake $PYTH tokens to be eligible for on-chain rewards. If faulty data is submitted, a portion of the stake is slashed.
- Community Governance: The Pyth DAO oversees key staking parameters and can decide how slashed funds are allocated—whether they should be distributed to impacted parties or used to support the Pyth Network.
- Staker Involvement: $PYTH holders can stake their tokens by delegating them to specific publishers, contributing to the security of the network while earning rewards.
OIS enables $PYTH stakers to contribute directly to the security and performance of the network by delegating (staking) their tokens to publishers. Stakers help secure the oracle and are rewarded based on the data quality of their chosen publishers.
Stakers and publishers share both the rewards and the risks here:
- Rewards: Publishers receive rewards first, with remaining rewards distributed to stakers.
- Slashing: If publishers provide faulty data, both the publisher and their stakers are penalized.
Each publisher in the Pyth Network operates a stake pool, where stakers can delegate their tokens. The size of the reward is influenced by:
- Total Stake: Rewards increase with the size of the pool up to a predefined stake cap.
- Supported Symbols: Publishers can raise their stake cap and increase rewards by supporting more symbols, taking on more risk but gaining higher potential rewards.
The Pyth DAO oversees the parameters governing OIS controlling:
- Reward Structures: DAO members set the maximum reward rates and can vote on the allocation of slashed funds.
- Slashing Mechanisms: In case of misreporting, the DAO determines how slashed tokens should be distributed, such as compensating affected users.
- Future Enhancements: The DAO can introduce additional reward sources, such as incorporating other digital assets to broaden staking participation.
Reward Distribution
The reward distribution mechanism in Pyth is designed to fairly compensate each publisher, penalize bad actors, and encourage accurate reporting. Pyth’s data staking mechanism distributes a portion (initially set to 20% but may be adjusted by governance) of the data fees per product into a reward pool for that product.
- Publishers with access to more accurate or timely pricing information should be rewarded more. This incentivizes the best publishers to contribute to the protocol.
- Penalties should be in place to deter bad actors from exploiting the system for personal gain.
- Publishers should be encouraged to report prices honestly, based on their private information. This ensures that the aggregate price reflects the most accurate information available.
To achieve these goals, the reward distribution mechanism divides the reward pool among publishers based on three factors:
- Stake-weight (s): Determined by the data staking mechanism, reflecting the publisher’s level of involvement in the protocol.
- This number is between 0 and 1.
- Quality Score (q): Measures how well a publisher’s price series predicts future price changes.
- This number is between -1 and 1, with a positive score indicating predictive power.
- Calibration (c): Reflects the accuracy of the publisher’s confidence intervals in representing their uncertainty.
- This number is between 0 and 1.
At the end of each epoch, publishers earn a share of the reward pool based on the product of these three quantities (s × q × c). Negative quantities result in a corresponding stake slashing for the publisher.
The quality score is computed by training an online regression model that predicts future prices based on features of the publisher’s price series. The calibration score measures how accurately the publisher’s confidence intervals represent their uncertainty.
Below you can find a comparison of historical data for two different publishers.
- The left graph is a scatterplot of the predicted and actual price changes. The tighter the linear relationship between these quantities, the higher the quality score.
- The axes of the right graph correspond to the two non-bias features of the regression model, and the color denotes the actual price change. A smooth color gradient indicates a high quality score.
- The top publisher obtains a higher score than the bottom one in this sample.
This mechanism incentivizes high-quality reporting and discourages bad actors by rewarding predictive accuracy and penalizing inaccurate reporting. It also encourages honest reporting by aligning incentives with the provision of truthful information.
Quality Score
In Pyth Network, the quality score is a metric designed to assess the predictive accuracy of a publisher’s price series against future aggregate prices. This score is calculated using an online regression model, which dynamically updates its predictions based on real-time data.
The quality score is derived from two primary components:
- Correlation Measure: This quantifies the degree to which a publisher’s predicted prices align with the aggregate prices over a given epoch. A perfect prediction corresponds to a correlation of 1, random predictions yield a correlation of 0, and predictions worse than random result in a negative correlation.
- Frequency of Contribution: The second factor is the proportion of time slots for which the publisher has provided price data. This accounts for the consistency and reliability of the publisher’s data contributions.
The regression model updates at each time slot t, using two key price change features: the publisher’s current price pt compared to both their own price and the aggregate price from the previous slot. The weight vector wt, representing the model’s coefficients, is adjusted via a clipped gradient method to refine the model after each prediction.
A negative correlation serves as a guard against adversarial behavior, indicating that a publisher’s predictions are systematically inaccurate and could potentially be misleading.
The proposed scoring system is adaptable and can be refined in several ways:
- It may predict price changes beyond the immediate next slot, which presents a more challenging forecasting task.
- Incorporation of additional features to account for nuances such as persistent but minor price disparities across different exchanges. By tracking these differences, the mechanism can avoid unfairly penalizing publishers for variations that are consistent yet minor.
The Pyth network’s developers have subjected this quality score mechanism to tests using historical data, which indicate that the current model produces sound outcomes. However, recognizing the diverse nature of financial markets, the model’s design remains inherently flexible to accommodate future modifications and improvements as new insights and data become available.
Calibration Score
In Pyth Network, the calibration score serves as a tool to assess the accuracy of a publisher’s confidence interval—a range within which they expect the aggregate price to fall. This score is a gauge of how well the publisher understands and communicates their uncertainty regarding the price predictions.
How the Calibration Score Works
- Standard Error Interpretation: The publisher’s confidence interval is interpreted through the lens of a Laplace distribution’s standard error. The Laplace distribution is chosen over the normal distribution due to its heavier tails, which tend to represent the variations in prices more realistically.
- Calculation Process:
- Z-Score Determination: For each prediction, a z-score is calculated by subtracting the aggregate price from the prediction and normalizing this value by the publisher’s stated confidence interval.
- Histogram Binning: These z-scores are then categorized into bins. The thresholds for these bins are set so that if the confidence intervals were perfect, each bin would be equally likely under a standard Laplace distribution.
- Uniformity Check: The histogram from a “perfect” publisher would be uniform across these bins. Hence, the calibration score is defined by the deviation from this uniformity, specifically one minus the earth-mover distance between the actual histogram and a uniform distribution.
The calibration score doesn’t favor publishers for providing narrower confidence intervals because such an advantage is already encapsulated in the quality score. Instead, the calibration score focuses on the appropriateness of the confidence interval—whether it accurately mirrors the publisher’s “true” level of certainty regarding their price predictions.
A high calibration score indicates that a publisher’s confidence intervals are well-calibrated and that the aggregate price frequently falls within the predicted range, considering the stated uncertainty. Conversely, a lower score may suggest that a publisher’s confidence intervals are either too tight or too broad, implying a misrepresentation of their actual confidence.
Why the Project was Created
The creation of Pyth stemmed from the necessity to address the oracle problem in decentralized finance (DeFi) and provide reliable, low-latency market data sourced from institutional providers. Traditional markets often restrict access to such data, while cryptocurrency markets lack comprehensive and dependable sources. Pyth’s original vision aimed to bridge this gap by enabling blockchains to interact with external data seamlessly.
The project was conceived in response to the limitations faced by blockchains before 2018, where decentralized applications (DApps) could only operate with on-chain data. To enable the integration of off-chain data reliably, oracles were needed as bridges between blockchains and the external world. Pyth’s goal was clear: to democratize access to asset prices across all blockchains, thus enhancing the functionality and real-world utility of DApps.
Existing oracles faced several challenges, including unreliable data sources and delays in data delivery. Some solutions scraped data from the internet or obtained it from questionable sources, compromising accuracy and reliability. Moreover, delays in data transmission, particularly evident in time-weighted average price (TWAP) oracles, posed significant risks, especially in volatile markets like crypto.
Pyth sought to overcome these challenges by providing secure, real-time market data from reputable sources. By collaborating with institutional entities such as trading firms, decentralized exchanges (DEXs), and centralized exchanges (CEXs), Pyth aimed to ensure the integrity and accuracy of its price feeds. Through its network, Pyth facilitated the seamless transmission of off-chain data to blockchains, empowering DeFi applications with timely and precise market information.
Sector Outlook
Price oracles play a crucial role in bridging the gap between off-chain price data and on-chain smart contracts within blockchain ecosystems. They provide timely and accurate price information, enabling decentralized applications (dApps) to access real-world market data. However, achieving both accuracy and timeliness can be challenging, and traditional solutions like introducing delays may not always be sufficient, especially in latency-sensitive financial applications.
The sector outlook for Pyth Network amidst its competition with Chainlink in the oracle space can be summarized by offering a differentiated product and unique value proposition. While Chainlink has established itself as the primary oracle provider, Pyth offers a fundamentally different approach, focusing on Solana initially and expanding to other chains with Pythnet.
Pyth’s pull price update model differentiates it from the push model commonly used by other oracles like Chainlink. The emphasis on obtaining data directly from first-party sources without relying on aggregators like Coingecko or CoinmarketCap adds to Pyth’s appeal, offering potentially faster and higher-quality updates.
Pyth also introduces confidence intervals, providing protocols with more nuanced information about price uncertainty, particularly in volatile or illiquid markets. This approach allows protocols to adjust their risk parameters based on their preferred level of aggressiveness or conservativeness.
To address the challenge between timeliness and cost effectiveness to retrieve latency-sensitive financial data, Pyth proposes a “staking” mechanism that involves oracle operators staking reputation, collateral, or trading capital on the integrity and timeliness of the data they provide. By doing so, those who provide inaccurate or untimely data would suffer economic or reputational consequences, thus incentivizing them to ensure the integrity of the information they publish.
Through this principle of “skin in the game”, Pyth oracles serve as a critical source of price data streamed onto the blockchain, bridging the off-chain world with the on-chain environment. While decentralized exchanges (DEXes) provide on-chain price information, their liquidity may be limited compared to centralized exchanges (CEXes), making them susceptible to manipulation. Oracles mitigate these risks by bringing high-quality price data from CEXes onto the blockchain, thus enhancing the reliability and accuracy of price information for decentralized applications.
The Tradeoffs vs Using Data Aggregators
The tradeoffs between Pyth Network and using aggregators in the oracle space revolve around factors such as data accuracy, latency, decentralization, cost-effectiveness, and flexibility.
Pyth | Data Aggregators | |
Data accuracy | Pyth emphasizes obtaining data directly from first-party sources, such as trading firms and exchanges. This approach aims to reduce the risk of data manipulation or inaccuracies introduced by intermediaries. | Aggregators like Chainlink rely on collecting data from multiple sources, including exchanges, marketplaces, and APIs. While aggregators may provide a broader data set, there’s a risk of errors or manipulation introduced during the aggregation process. |
Latency | Pyth’s pull price update model allows for potentially faster updates as data is streamed off-chain via protocols like the Wormhole Network. However, there may be latency introduced by the cross-chain messaging protocol when updating prices on-chain. | Aggregators typically run off-chain processes to continuously update on-chain prices. While this ensures real-time updates, there may be delays due to network congestion or other factors. |
Decentralization | Pyth aims for decentralization by obtaining data directly from a diverse set of first-party sources, reducing reliance on centralized aggregators. | Aggregators centralize data collection and aggregation, which can introduce vulnerabilities such as single points of failure or manipulation. |
Cost-effectiveness | Pyth’s pull model allows for potentially lower costs as users are responsible for posting price updates on-chain only when needed. | Aggregators may charge fees for accessing their aggregated data, but these costs may be offset by the convenience of having a single source for multiple data streams. |
Flexibility | Pyth offers flexibility in terms of integrating with different chains and protocols, as evidenced by the launch of Pythnet and its expansion efforts. | Aggregators may provide a more standardized approach to accessing data across multiple chains and protocols, simplifying integration for developers. |
The process of establishing a publisher-first oracle like Pyth Network from scratch faces significant challenges initially, which can be described as a cold start problem, primarily due to low market coverage and potential reluctance from publishers to onboard due to technical or reputational risks. However, over the past year, Pyth has made notable progress in overcoming these hurdles and enhancing its ecosystem.
- Improved Onboarding and Integration Process: Pyth has refined its onboarding and integration process, making it easier and more attractive for reputable publishers to join the network. This includes providing better documentation and support to publishers, reducing technical barriers to entry, and addressing concerns related to reputation and trust.
- Enhancements to Price Aggregation Algorithm: Pyth has made significant improvements to its price aggregation algorithm to ensure more accurate and reliable price feeds. By refining the aggregation process, Pyth can provide high-quality data that is trusted by users and protocols.
- Introduction of Crypto-Economic Security: With $PYTH in circulation, the protocol can enhance its crypto-economic security model to incentivize participants, including publishers and delegators, to contribute to the network’s security and integrity, further enhancing trust and reliability.
- Expansion to Non-Solana Chains with Pythnet: Recognizing the need to extend its reach beyond the Solana ecosystem, Pyth launched Pythnet, a standalone chain based on the Solana codebase. Pythnet allows Pyth to provide its oracle services to protocols on other blockchain networks, expanding its market and increasing its adoption potential.
Through continuous innovation, improvements in technology, and strategic expansion efforts Pyth has demonstrated a commitment to overcoming the challenges associated with establishing a publisher-first oracle.
Balancing High Quality and Low Latency
Pyth attempts to balance the dual objectives of low latency and high-quality data through various forms of staking and incentive alignment mechanisms.
Staking via Reputation | Staking via Collateral | Staking via Trading |
Pyth implements a moderate form of staking via reputation by publicly disclosing the aggregate set of its publishers. While this transparency enhances accountability to some extent, the lack of individual address disclosure may limit the potential public scrutiny and repercussions for bad contributors. This mechanism may weaken over time, especially if Pyth transitions to permissionless publishing. | The staking $PYTH mechanism allows to reward publishers for bringing novel and correct information while penalizing those providing incorrect data. This adjudication mechanism introduces an approach to incentivizing data accuracy within the oracle network. | Pyth’s potential for staking via trading is high, given that many of its data providers are high-frequency trading firms. These firms contribute prices as a byproduct of their trading operations, aligning their interests with the accuracy of the data. However, challenges remain, such as ensuring timely reporting of prices and validating self-reported prices to prevent misrepresentation. |
Note that Pyth incorporates confidence intervals as an additional line of defense to address periods of uncertainty in price determination, such as the Terra de-peg episode. By widening confidence intervals around reported prices, Pyth acknowledges and accounts for variability in prices across different exchanges, enhancing the robustness of its data representation.
Advantages of Pyth’s Pull Model
Pyth’s pull oracle model optimizes cost efficiency, scalability, reliability, and the ability to handle complex computations compared to traditional push-based oracle architectures. This model ensures that users get timely and accurate price data while minimizing operational costs.
- Efficient Gas Usage: Pyth minimizes gas costs by only paying when consumers demand price updates. This targeted approach reduces overall expenses.
- Scalability: The pull model allows Pyth to scale efficiently, supporting a broader range of price feeds and blockchains.
- Reliability: Network congestion on target chains doesn’t affect the ability of Pyth publishers to provide updates, ensuring reliable data availability.
- Stateful Computations: Pyth’s architecture is capable of handling stateful computations like exponentially-weighted moving averages (EMAs) due to its high-frequency updates, enabling precise temporal combinations of data.
One of the major advantages relative to push-based oracles is that Pyth has the ability to publish price updates more frequently. For instance, push-based struggle to compute calculations that required past data, as their low update frequency produces less timely samples. As an example, it is impossible for push-based oracles that publish data every 10 minutes to compute a 5-minute EMA. Pyth solves this by using its dedicated Pythnet appchain. In Pythnet, the network has access to price updates every 400ms, which easily allows for the construction of more granular and complex temporal combinations.
Potential Adoption
Since launch Pyth has already gained traction, with 230+ applications relying on Pyth’s data, including decentralized exchanges (DEXs), lending protocols, and derivatives platforms. This reflects its potential for widespread adoption in DeFi and beyond.
Nonetheless, Pyth faced early challenges, notably a significant price discrepancy issue due to publisher errors. More specifically, the major issue was with the $BTC price for a 2-minute period in September 2021. Due to 2 out of 11 publishers making a decimal point error and the aggregation logic overweighting their contributions, the aggregated price ended up being significantly off BTC’s true price of ~$42k, reporting prices as low as $5,402 with confidence intervals of +/- $21,623. For protocols that didn’t incorporate the confidence interval, and simply relied on the median price of $5.4k, this resulted in detrimental effects such as erroneous liquidations. Since then, remediation efforts included refining aggregation logic, enhancing publisher onboarding, and providing better documentation for developers.
Despite early setbacks, Pyth has seen steady adoption on Solana, becoming the de facto oracle for the network. Year-over-year growth in publishers, price feeds, and dApps demonstrates increasing acceptance within the ecosystem. Moving forward, Pyth’s launch of Pythnet signified the intention to extend its reach beyond Solana to other chains like Ethereum, BSC, and Aptos. While Pythnet introduces latency challenges compared to Solana, it offers a unique pull model and potential cost efficiencies for consumers.
The launch of the $PYTH token introduced additional incentives and mechanisms for stakeholders, including publishers, delegators, and consumers. This distribution plan will play a crucial role in ensuring widespread adoption and decentralization of the network.
Chains
Even though the first whitepaper version introduced a protocol design focused on the Solana blockchain, the second version provides a more general solution for a broader Pyth ecosystem. With this upgrade, the protocol introduces a cross-chain model to deliver price data to target chains.
Pyth Network’s price feeds are currently available on 40+ blockchains, ensuring accessibility and scalability for developers across different ecosystems.
Pythnet, a separate chain derived from Solana’s codebase, facilitates price submissions exclusively for Pyth publishers. Unlike on Solana, where price updates are automatically pushed on-chain, Pythnet operates on a pull model, with prices updated on-chain upon application request.
Note that this model introduces increased latency, with approximately 3 seconds from the centralized exchange (CEX) price to on-chain update. Of this, 1 second is attributed to CEX to Pythnet latency, while 2 seconds are due to Pythnet to price service latency, induced by Wormhole messages.
Non-Solana protocols utilizing Pythnet must pay fees for on-chain price updates, starting at a nominal denomination but potentially adjustable by governance later. Gas efficiency is enhanced as gas fees are incurred only when consumers necessitate price updates, minimizing wastage.
Moreover, Pythnet’s autonomy ensures reliability even if the Solana network experiences downtime. Despite latency challenges, strategies like asynchronous order settlement, staleness thresholds, and tying price update requests to users’ transactions help mitigate risks.
Using the Protocol
Users and developers can seamlessly integrate Pyth’s real-time market data into their applications via powerful APIs. The “pull oracle” feature allows applications to control when and how real-time prices appear on-chain, providing flexibility and cost-efficiency.
Pyth operates through 4 key mechanisms that govern its flow of interactions:
- Price Aggregation: This mechanism combines prices reported by individual publishers along with their associated confidence intervals into a unified price feed and confidence interval feed for a specific product. By aggregating these inputs, Pyth produces a single, reliable price point for market participants to reference.
- Data Staking: Delegators have the opportunity to stake tokens in order to earn data fees. The stake-weight system determines the influence each publisher has on the aggregate price. Data fees collected are distributed, with 80% going to delegators and the remaining 20% allocated to a reward pool shared among publishers (subject to changes via governance). Delegators’ stakes may be slashed if discrepancies arise between the published aggregate price and reference prices during the claim interval. Successful claims result in the identification and penalization of at-fault publishers, with redistributed stakes compensating affected consumers.
- Reward Distribution: This mechanism allocates shares of the reward pool to individual publishers based on the quality of their price feeds. By incentivizing high-quality data provision and penalizing poor performance, this mechanism aims to maintain the integrity and reliability of the price aggregation process.
- Governance: Pyth Network employs a coin-voting system to govern the parameters of all its mechanisms. Through this governance framework, participants have a say in shaping and refining the network’s operations, ensuring its continued effectiveness and adaptability.
Participants
Pyth’s user base spans DeFi projects, dApps, and blockchain developers seeking reliable and low-latency data for their applications.
In the Pyth ecosystem, there are three key roles: consumers, publishers, and delegators, each with distinct responsibilities and incentives.
- Consumers are the users of price feeds within the ecosystem, predominantly comprising smart contracts and DeFi protocols. Their primary responsibility is to utilize the provided price feeds to make decisions and execute transactions. While consumers on Solana receive price feeds for free, those outside Solana must pay small “on-demand” fees to retrieve prices from Pythnet. Consumers have the option to pay insurance fees in $PYTH to hedge against oracle inaccuracies, providing an added layer of protection at an extra cost.
- Publishers are responsible for publishing prices to the network. In return, they receive $PYTH tokens as rewards and a share of data fees. However, publishers are required to stake $PYTH tokens for the products they price, and their stakes are subject to slashing if they produce errors. This incentivizes accuracy and reliability in price reporting. The reward structure for publishers may vary over time and is subject to change, affecting their earning potential within the ecosystem.
- Delegators play a crucial role in determining the aggregate prices reported by Pyth. They stake $PYTH tokens on price feeds to determine the weights of different publishers, thereby influencing the accuracy of reported prices. Delegators must carefully manage their staking strategy to optimize yield while minimizing the risk of losses due to inaccurate price feeds. Additionally, there is a slashing risk associated with delegators, as they may be penalized if the feed they stake on produces errors, irrespective of the responsible publisher. This underscores the importance of diligent selection and monitoring of price feeds by delegators.
It’s crucial to differentiate the slashing risk between delegators and publishers within Pyth.
- In the event of a failure, all delegators staking on a specific feed will face penalties, regardless of which publisher was responsible for the erroneous price, even if they didn’t stake on that particular publisher.
- On the other hand, publishers will only be subject to slashing if they themselves are directly accountable for the error.
Delegators must navigate a delicate balancing act when staking. They must consider various factors, such as the reputation of publishers and the distribution of influence among them. Overweighting high-reputation publishers helps ensure the accuracy and reliability of price feeds, while also preventing any single publisher from exerting disproportionate influence. This strategy mitigates the risk of a small number of publisher failures causing a broader failure in the aggregate, safeguarding the integrity of the network and minimizing potential losses for all stakeholders.
Developers
Using Solana Price Feeds
- Each Pyth Network price feed is stored in a Solana account, and it’s identified by a unique Solana account key. Developers need to correctly identify and match the price feed with the corresponding feed ID and account key, which can be found in Pyth’s price feed ids page.
- Pyth price feeds use a fixed-point numeric representation with a shared exponent for both the price and confidence interval. To obtain the integer representation of these values, developers can multiply by 10^exponent.
- One thing to consider is that there may be situations where Pyth cannot provide a current price for a product. This can occur due to factors like market hours or network outages. Pyth has built-in safeguards to prevent the use of stale prices. Developers must ensure that their applications also incorporate these safeguards, such as staleness checks, to avoid using outdated data inadvertently. It is also important to understand that the market hours depend on the asset class. This is crucial to ensure that you are using up-to-date price data based on market trading hours.
Asset Class | Opening Hours | Exceptions |
Crypto | 24/7. | No market close. |
US Equities | Every weekday from 9:30 a.m. EST to 4:00 p.m. EST. | Markets are closed on weekends, US holidays, and during extraordinary events. |
FX | From Sunday 5:00 p.m. EST to Friday 5:00 p.m. EST. | Trading continues during most US holidays. |
Metals | From Sunday 5:00 p.m. EST to Friday 5:00 p.m. EST. | Spot gold and silver trading also follow the CME holiday closures. |
- Application developers must account for the latency difference between on-chain oracles like Pyth Network and off-chain data sources such as centralized exchanges. While Pyth Network is designed with low latency, no on-chain oracle can match the speed of off-chain sources. As a result, technical teams should consider a possible threat model where adversaries may see price changes slightly ahead of the protocol. This can be solved through various implementations of different nature, such as:
- Configuring Protocol Parameters for Balanced Flows: Balance the losses from smart flow against the gains from two-way flow by configuring protocol parameters. This can be done by implementing a bid/ask spread and limited liquidity similar to traditional market makers. This helps cap losses to smart flow while still allowing profits from two-way flow. It is also possible to adjust the spread and liquidity parameters to strike a balance that minimizes adverse selection from smart traders while effectively participating in two-way flow.
- Implement a “Last Look” Mechanism: Provide the protocol with a “last look” capability to decide which transactions to accept. For instance, transactions can be split into two parts: a request and a fulfillment. In the first transaction (the request), users initiate an action or request a trade. In the second transaction (the fulfillment), the protocol determines whether to fulfill the user’s request based on the observed Pyth price at that moment. Integrators can implement a short delay between the two transactions to allow the protocol extra time to observe price changes. Next, applications can fulfill the user’s request at the Pyth price as of the second transaction, giving the protocol a head start in the latency race.
- Since Pyth publishes both price and confidence intervals, developers can use the confidence intervals to assess price uncertainty and protect their applications against adverse market conditions. One solution is to compute a range around the price using the confidence interval to ensure conservative pricing. Depending on the use case, some applications may consider using Pyth’s Exponential Moving Average (EMA) price. Overall it is important to ensure that derivative instruments and similar financial contracts are designed to eventually settle even if the confidence interval remains wide, avoiding infinite delays.
- Consider using Pyth’s exponential moving average (EMA) price when dealing with price data over a specified time period. EMA represents an estimate of the average price and reduces the influence of prices with wide confidence intervals, making it suitable for applications where stability is critical.
- The aggregate price provided by Pyth represents the best estimate of the price at a specific point in time. It may be imprecise in cases of wide confidence intervals, but it is the most accurate data available from Pyth for a single time point.
- When lending money or accepting collateral, consider the confidence interval provided by Pyth. For that, you can calculate a range for the true price by adding and subtracting a multiple of the confidence interval to the Pyth price. A multiple of 2.12 provides a 95% probability that the true price lies within this range. You can then use the lower bound of the range when originating the loan or valuing collateral to be conservative and limit borrowing when prices are uncertain. Similarly, when the loan has been issued or collateral is held, use the upper bound of the range to be conservative, preventing actions based solely on increased price uncertainty.
- In derivative contracts, applications can value collateral at the lower price within the calculated range during contract initiation to manage risk. In the same way, when evaluating margin limits, the higher price within the range can be used to err on the side of caution.
Pyth on Solana provides one SDK for Solana on-chain programs. This can be used to consume Pyth prices inside Solana programs written in Rust.
- Pyth Solana SDK: pyth-sdk-solana crate
- Example programs:
The price feeds available on each Solana network are listed on the following pages:
Using Pythnet Price Feeds
Pythnet’s “pull” price update model offers flexibility to users who are responsible for posting price updates on-chain when needed.
To effectively integrate Pythnet price feeds into applications, developers should follow the following key guidelines:
- Integration in On-Chain Programs: On-chain programs should read price data directly from the Pyth program deployed on the same blockchain. This ensures that your smart contracts and on-chain logic have access to real-time Pythnet price feeds.
- Integration in Off-Chain Frontends and Jobs: For off-chain applications, including frontends and background jobs, it’s essential to incorporate Pyth price updates into your transactions and data processing. For that, development teams need to ensure that their off-chain code can access and utilize Pyth price data alongside or within their application-specific transactions.
- Pyth Ecosystem-Specific SDKs: Pyth provides ecosystem-specific SDKs to streamline the integration process for both on-chain and off-chain components. These SDKs are tailored to work seamlessly within their respective ecosystems.
- Preparation and Best Practices: Before diving into SDK integration, developers should familiarize themselves with Pyth’s price feed representation and best practices. Understanding how Pyth price feeds work and following recommended practices ensures that you use Pythnet prices safely and accurately in your application.
- Selecting the Right SDK: Choose the Pyth SDK that aligns with your specific blockchain ecosystem. Pyth offers different SDKs to support various blockchain networks, making it easier for you to integrate Pythnet price feeds into your application.
Pythnet Pull Updates
Pyth Network operates on a “pull” price update model, which differs from the more common “push” model used by many other oracles. Pythnet’s “pull” price update model offers flexibility to users who are responsible for posting price updates on-chain when needed.
Pyth Network’s pull model relies on its users to create and submit price updates, which are then authenticated and verified for on-chain use. This approach fosters decentralization and allows users to efficiently update and use prices in a permissionless manner. However, it’s important to ensure that the submitted price updates are current to achieve accuracy in downstream applications.
- Push vs. Pull Model: Most traditional oracles follow a “push” model where they have an off-chain process that continuously sends transactions to update on-chain prices. In contrast, Pyth Network does not employ such an off-chain process. Instead, it relies on Pyth Network users to create and submit price updates.
- Delegating Price Update Work: In Pyth Network, the responsibility of generating and submitting price updates is delegated to its users. These updates are initiated on Pythnet and transmitted off-chain through the Wormhole Network, a cross-chain messaging protocol.
- Authentication and Verification: To ensure the authenticity of price updates, they are signed before being transmitted off-chain. The on-chain Pyth program can verify these signatures to confirm the validity of the updates.
- Permissionless Price Updates: Updating the on-chain price in Pyth Network is a permissionless operation. Anyone can submit a verified update message to the Pyth contract to update the price. This decentralized approach allows for wide participation.
- Atomic Transactions: Users of Pyth Network prices typically submit a single transaction that accomplishes two tasks simultaneously. First, this updates the price and secondly, it allows for using the price in a downstream application. This streamlines the process and ensures consistency between the updated price and its usage.
- Forward Movement of Prices: In Pyth Network, on-chain prices can only progress forward in time. If a user submits a Wormhole message with a less recent price, the Pyth program will not fail, but it also will not update the price. This means that there is no guarantee that the price read by an application powered by Pyth will be the exact price submitted by the user if it’s not the most recent.
Publisher Metrics
Pyth offers Publisher Metrics in a public dashboard that provides insights into the performance of data publishers. Developers gain granular insight into Pyth’s data performance and publishers’ track records, while publishers benefit from new analytics and monitoring capabilities.
Publisher Metrics offer critical information for informed decision-making within the network, benefiting publishers, end-users, and delegators. The metrics include uptime, price-quality, and confidence interval accuracy, aligning with factors determining publishers’ scoring and rewards. Users can access the metrics through the Pyth Markets page, analyzing graphs for price comparison, uptime, data quality, and calibration to the expected distribution.
The Publisher Metrics page for each publisher displays several insightful graphs, each of which is detailed below.
The price graph shows how a publisher’s price compares to the aggregate price, illustrating how closely the two prices track each other, and whether there were any periods where the publisher deviated significantly from the rest of the market.
The uptime graph shows when the publisher was actively contributing prices. The x-axis subdivides the time interval into bins, and the y-axis is the % of slots in that bin where the publisher’s price was recent enough to be included in the aggregate. This graph lets you determine the regularity and reliability of a publisher.
The quality graph shows the dataset used in the regression model for computing the quality score described in the whitepaper. It measures how well a publisher’s price series predicts future changes in the aggregate price. A smooth color gradient (from blue on the bottom left to pink on the top right) indicates a high-quality score.
The calibration graph shows how closely the publisher’s prices and confidences match the expected Laplace distribution. The closer the fit between the two distributions, the higher the calibration score. A perfect publisher should produce a uniform histogram. Note that the calibration score does not reward publishers for producing tighter confidence intervals; rather, the score captures whether the reported confidence interval corresponds to the publisher’s “true” confidence.
Business Model
The business model of Pyth Network revolves around generating revenue through data fees and leveraging its native token, $PYTH, to enhance its operations and incentives structure.
- Publishers can stake $PYTH to participate in the protocol and earn a share of data fees. This incentivizes them to provide accurate and timely price data, as their stake is at risk of being slashed in case of misbehavior.
- Consumers can utilize $PYTH to pay data fees for accessing price feeds. This creates a demand for $PYTH tokens within the ecosystem.
- Delegators have the opportunity to stake $PYTH on specific price feeds and earn a share of data fees. Similar to publishers, delegators are at risk of losing their stake if they support incorrect data.
In cases of misbehavior, such as providing incorrect data, the staked $PYTH tokens will be utilized to compensate affected consumers. This ensures accountability and incentivizes all participants to maintain the integrity of the data.
Fee Breakdown
Pyth allows for the optional activation of data fees to update on-chain price feeds. Governance on each blockchain determines the existence and size of these fees.
Fees collected by the protocol are used to compensate data providers and may serve other purposes determined by governance. Additionally, a portion of these fees may serve other purposes as determined by the network’s governance structure. This ensures that the data providers are incentivized to continue supplying accurate and timely data, crucial for the network’s reliability and trustworthiness.
When protocols integrated with Pyth require an on-chain price update, consumers must pay an update fee. These fees are charged in the native token of the target blockchain and are necessary to invoke the price update operation on a Pyth receiver contract. The decision to impose such fees and their size are governance decisions, reflective of the operational needs and economic dynamics of each blockchain where Pyth operates.
When protocols integrated with Pyth require an on-chain price update, consumers must pay an update fee. These fees are charged in the native token of the target blockchain and are necessary to invoke the price update operation on a Pyth receiver contract. The decision to impose such fees and their size are governance decisions, reflective of the operational needs and economic dynamics of each blockchain where Pyth operates.
In addition to fee collection, the Pyth Network has a stake-weight system that influences each publisher’s impact on the aggregate price. Delegators can stake tokens to earn a portion of the data fees. Of the fees collected, 80% are distributed to delegators while the remaining 20% are allocated to a reward pool shared among publishers. This distribution ratio can be adjusted through governance decisions.
Delegators’ stakes may be slashed if discrepancies are detected between the published aggregate price and reference prices during the claim interval. Successful claims lead to the identification and penalization of at-fault publishers, with redistributed stakes compensating affected consumers.
Tokenomics
The total supply of $PYTH tokens is 10,000,000,000, with 85% initially locked and set to unlock gradually over 6, 18, 30, and 42 months after token launch. The remaining 15% of tokens are initially unlocked. The allocation of tokens includes categories such as Publisher Rewards, Ecosystem Growth, Protocol Development, Community, and Private Sales.
Token Distribution
The total supply is 10,000,000,000 $PYTH and will not increase. At the inception of the $PYTH token launch in November 2023, 15% of the total supply, amounting to 1.5 billion $PYTH tokens, was immediately circulating within the ecosystem. These unlocked tokens were aimed at facilitating early network activities and rewarding participants who actively contributed to the development and growth of the Pyth Network.
At the inception of the $PYTH token launch in November 2023, 15% of the total supply, amounting to 1.5 billion $PYTH tokens, was immediately circulating within the ecosystem. These unlocked tokens were aimed at facilitating early network activities and rewarding participants who actively contributed to the development and growth of the Pyth Network.
Publisher Rewards, comprising 22% of the total supply, incentivize data providers to publish high-quality and timely data. The Ecosystem Growth allocation, the most substantial at 52%, is designed to catalyze various initiatives across the network, from funding research and development to bolstering educational programs. Protocol Development, accounting for 10%, is earmarked for oracle tooling and infrastructure enhancements.
The Community and Launch segment, constituting 6% of the total tokens, ensures immediate engagement and network support activities right from launch. Finally, 10% of the tokens are allocated to strategic contributors through Private Sales, with the aim of securing long-term advisory and infrastructural support for the network.
The Pyth Network Retrospective Airdrop was a program designed to distribute $PYTH tokens to those who had meaningfully engaged with the network’s services and the broader DeFi community. The initiative recognized users who interacted with dApps powered by Pyth data, held specific NFTs related to the network, or played active roles in the Pyth Discord community. The airdrop reached participants across 27 different blockchains and was one of the larger initiatives of its kind in terms of cross-chain reach, involving over 90,000 wallets.
Commencing on November 20, 2023, and concluded on February 20, 2024, the claim process was structured to ensure an equitable distribution of tokens based on past contributions and interactions within the ecosystem. The $PYTH tokens were allocated in alignment with the network’s governance structure. As the Solana Program Library (SPL) standard tokens native to the Solana blockchain, the $PYTH tokens were readily integrated into the recipients’ wallets within that ecosystem.
Supply Schedule
The release of $PYTH tokens is designed to be gradual, supporting different phases of the network’s growth. The schedule demonstrates a distribution plan that allows for immediate use in community-driven projects, while the majority of the supply is set to be released over a series of phases spanning up to 42 months after the initial launch.
The lockup schedule shows an immediate allocation for community and initial launch activities to stimulate the early use and governance of the network. Sequential tiers, intended for publisher rewards, ecosystem growth, protocol development, and strategic private sales, unlock progressively. This phased approach is intended to sustain ongoing network development and to prevent a flood of tokens from overwhelming the market prematurely.
The distribution model incorporates a strategy to encourage the provision of data for newer or less popular products. It recognizes the challenge of encouraging data providers to support products that do not yet generate data fees, a common issue in platform economies known as the “cold-start problem.” To counteract this, the protocol may offer additional incentives to early publishers, taken from a predetermined pool of tokens set aside for this purpose.
Governance plays a critical role in enabling claims for a product once it has reached a robust level of publisher participation. The mechanism through which data fees are paid for products not yet open for claims serves as an additional signal to the network.
$PYTH Staking
With the mainnet launch of the Pyth Network on November 20, 2023, holders of $PYTH Tokens now have the opportunity to participate in the governance of the network through staking. Staking involves locking $PYTH Tokens in the official staking program, which grants holders voting power in governance decisions.
Staking $PYTH Tokens is necessary for participating in the on-chain governance process of the Pyth Network. Governance decisions include determining reward structures for data providers, setting oracle fees, and choosing which data feeds and providers are listed on the network.
To stake $PYTH Tokens, holders should visit the official staking website. The website provides a user interface that guides users through the staking process:
- Stake: Depositing $PYTH Tokens into the staking program initiates a warm-up period. Tokens become eligible for voting at the start of the next epoch, which occurs every Thursday at 00:00 UTC.
- Unstake: Removing $PYTH Tokens from the staking program causes a loss of voting rights and initiates a cooldown period of one epoch.
- Withdraw: After the cooldown period, tokens can be transferred back to the holder’s SPL wallet.
Detailed Steps
- Initiating Staking: Access the “STAKE” tab on the staking website, enter the desired amount of $PYTH Tokens, and confirm the transaction through your wallet.
- Tracking Staked Tokens: The staking interface shows the amount of staked tokens and their voting eligibility. Tokens staked will appear with a pending status until the next epoch begins.
- Initiating Unstaking: To unstake, select the “UNSTAKE” tab, specify the amount, and confirm the transaction. The tokens will then enter a cooldown period.
- Withdrawing Tokens: Once the cooldown period is complete, tokens are ready for withdrawal. Navigate to the “WITHDRAW” tab, enter the amount of $PYTH Tokens to withdraw, and confirm the transaction to return the tokens to your SPL wallet.
For assistance or if encountering issues, holders can contact support through the Pyth Network’s Telegram or Discord channels.
Governance
On-chain governance is responsible for determining update fees, reward distribution for publishers, software updates, product listings, and publisher permissions.
Pyth Network’s governance is driven by its native token, $PYTH, which allows token holders to participate in decision-making through staking.
To engage in governance activities, $PYTH token holders are required to stake their tokens. This action enables them to vote on proposals within the Pyth DAO (Decentralized Autonomous Organization). The voting system operates on a simple and direct principle where each staked token equals one vote, ensuring that every participant’s voice is proportionate to their stake.
PYTH token holders who have staked at least 0.25% of the total supply are eligible to propose governance actions. This inclusive threshold allows for a broad range of community members to actively contribute to the network’s evolution.
When a proposal is submitted, it enters a 7-day voting period. For a proposal to be accepted, it must garner more affirmative votes than negative ones and meet the Approval Quorum, which is a predefined percentage of yes votes relative to the staked tokens at the commencement of the vote. This quorum ensures that a significant portion of the governance participants consents to the decision.
Once a proposal is approved, its corresponding on-chain actions are automatically executed. These can affect various network functions, such as:
- Setting and adjusting update fees for price feeds.
- Changing how rewards are distributed to those who publish data.
- Implementing software updates to the network’s on-chain programs.
- Specifying details for listed price feeds, including accuracy and reference sources.
- Approving publishers to supply data for price feeds.
The range of issues that can be addressed by PYTH token holder proposals is adaptable. The Pyth DAO can widen the scope of governance as needed to fit the network’s and its participants’ developing requirements.
Risks
Data Accuracy
While Pyth sources its data from direct contributors, errors can still happen. This could be due to human mistakes or technical issues, affecting the accuracy of the data Pyth provides. An example of this was the significant price discrepancy in the $BTC price feed due to publisher errors in September 2021. Remediation efforts have since been made, but the potential for similar occurrences exists.
Market Manipulation
Despite safeguards, there’s still a risk that someone could try to manipulate the market data Pyth distributes. This could be done by influencing or attacking the data providers themselves.
Technical Problems
The performance of the Pyth Network can be impacted by technical issues such as network congestion, latency introduced by cross-chain messaging protocols, or outages in underlying blockchains. These could delay the timely update of price feeds, potentially affecting the financial operations of DeFi protocols that rely on Pyth.
Cross-Chain Data Transfer
Pyth operates across different blockchains, which adds complexity and potential delays in updating prices due to the reliance on cross-chain messaging. The integration with Wormhole and the latency of cross-chain data transfer present challenges in maintaining low-latency price updates, essential for the efficient operation of financial protocols.
Dependence on User Fees
Pyth Network’s pull-based model depends on consumers requesting and paying for on-chain price updates. Variability in consumer demand and the associated fees could impact the economic model of the network, its adoption rate, and the incentive structure for publishers and consumers.
Slashing Risks
Pyth uses a slashing mechanism to penalize inaccurate reporting, which creates a risk of financial loss for publishers and delegators. While this incentivizes accurate data provision, it also exposes participants to potential financial penalties, impacting their willingness to contribute to the network.
Competition
The oracle market is competitive, with other services like Chainlink providing similar offerings. Pyth needs to continuously innovate to maintain its position and attract users.
By addressing these issues proactively, Pyth can become a reliable provider of blockchain data, supporting a wide range of financial applications in the DeFi space.
Oracle Price Manipulation
Challenges such as potential price manipulation attacks are addressed by the price aggregation and governance mechanisms. For instance, stringent limitations are placed on publishers’ influence over the aggregate price to guard against manipulation. The community also plays a crucial role in defining how publishers can use the protocol, potentially restricting participation to reputable and trustworthy entities. Furthermore, the diversity of publishers, each sourcing from different exchanges, mitigates the risk of price manipulation efforts affecting the overall Pyth price.
Security
The price aggregation mechanism ensures resistance to manipulation, appropriately weights data sources, and reflects price variations across publishers.
Audits
Pyth Network has undergone a series of security audits conducted by various organizations to ensure the robustness and reliability of its systems. Below is a chronological summary of the key security audits performed:
- Zellic – April 15, 2022: Conducted a Smart Contract Security Assessment for Pyth Oracle.
- Zellic – April 27, 2022: Examined Pyth2Wormhole in a Smart Contract Security Assessment.
- Zellic – May 16, 2022: Reviewed Pyth Governance through a Smart Contract Security Assessment.
- OtterSec – July 8, 2022: Performed an audit on Pyth Oracle.
- OtterSec – July 8, 2022: Audited Pyth Governance.
- Zellic – November 1, 2022: Assessed Pyth Cross-chain in a Smart Contract Security Assessment.
- OtterSec – October 10, 2022: Audited Pyth Aptos.
- CertiK – November 30, 2022: Security Assessment of Pyth-client was verified.
- CertiK – December 13, 2022: Verified the security for pyth2wormhole Governance.
- CertiK – December 13, 2022: Conducted a Security Assessment for pyth2wormhole on Solana.
- CertiK – February 23, 2023: Provided a Security Assessment for pyth2wormhole on Ethereum.
- Zellic – March 14, 2023: A Smart Contract Security Assessment was conducted for Pyth Network.
- OtterSec – July 7, 2023: Conducted a Smart Contract Security Assessment on Pyth Sui.
- Zellic – July 24, 2023: Provided a Smart Contract Patch Review for Pyth Network.
- Trail of Bits – July 31, 2023: A security assessment was performed on the Pyth Data Association Pythnet.
Bounties
The Pyth Network is offering a substantial bug bounty program aimed at enhancing the security of its real-time on-chain market data. White hat hackers are encouraged to participate, with potential rewards reaching up to $500,000 USDC for critical vulnerabilities and up to $100,000 USDC for high-severity issues.
Participants are invited to explore several key components of the Pyth Network, including the Pyth Oracle, Pyth Cross-chain contracts on platforms like Ethereum, Aptos, Sui, and CosmWasm, and the Pyth Governance systems. Details and access to the code can be found on their respective GitHub repositories.
To qualify for a reward, submissions must include a comprehensive report detailing the vulnerability, complete with steps and data necessary to reproduce the bug, and a proof-of-concept. It’s important to note that issues already known to the team, or those involving undeployed code, are considered out-of-scope. Additionally, Pyth staff, auditors, contractors, and those with inside information are ineligible for rewards.
Testing should be conducted responsibly without using public networks or mainnets, and participants should refrain from public disclosure of vulnerabilities prior to an official embargo lift. The program strictly prohibits phishing, social engineering, denial of service attacks, and any illegal activities.
Examples of critical issues include the ability to manipulate oracle prices, unauthorized assumption of contract control, or the loss and theft of funds. Bugs associated with third-party dependencies will be considered on a case-by-case basis, depending on the impact on Pyth’s ecosystem and whether the dependency has its own bounty program.
Upon successful bug identification, reporters will need to comply with KYC requirements including providing a wallet address, proof of address, and identification documents, such as a passport. U.S. persons will need to submit a completed W-9 form, and non-U.S. persons a W-8BEN form.
The Pyth Data Association maintains full discretion over the payout of reported vulnerabilities, emphasizing the case-by-case nature of reward decisions and ensuring the confidentiality of all personal data collected through the KYC process. This program is a significant part of Pyth’s commitment to maintaining the highest security standards within its network.
Economic Attack Vectors
The Pyth Network faces potential economic attack vectors primarily related to the integrity and accuracy of the price data it provides. Here are the key areas of concern and the measures Pyth has implemented to mitigate these risks:
Oracle Manipulation Risk: Pyth could be susceptible to data manipulation if dishonest publishers intentionally submit inaccurate price data. However, Pyth combats this by sourcing data from multiple reputable first-party publishers. This diversity in data sources helps to dilute any single publisher’s ability to skew the overall data significantly.
Front-Running Risk: Due to the real-time nature of the data Pyth provides, there’s a risk that individuals with advanced access to data updates could engage in front-running. Pyth minimizes this risk by ensuring rapid dissemination of data updates across its network, thereby reducing the window of opportunity for potential front-runners.
Collusion Among Publishers: While theoretically possible, the risk of collusion is mitigated by the large number of independent data publishers within the network, each of which would incur a significant penalty for dishonest behavior, not just in terms of reputational damage but also in potential financial penalties through the Pyth staking and slashing mechanisms.
Adversarial Selection and Latency: Pyth Network allows users to select prices for transactions within certain constraints, akin to experiencing latency effects. This feature can be exploited if users selectively use outdated prices to their advantage. To mitigate this, Pyth implements strict staleness checks, ensuring that only recent prices are used for transactions. This minimizes the window for exploiting price latency discrepancies between on-chain updates and faster off-chain market movements.
Price Manipulation through Confidence Intervals: The structure of Pyth’s price feeds, including the reporting of confidence intervals, inherently guards against simple price manipulation. The aggregation of multiple data sources dilutes the impact of any single skewed input. However, during periods of high volatility or divergence in market views, the aggregated price may still be subject to manipulation if a group of data providers coordinates their inputs. Protocols can defend against this by using the lower bounds of confidence intervals for critical financial operations, thereby adopting a conservative stance on asset valuation.
Sybil Attack Resistance: In a Sybil attack, an attacker could create multiple fake identities to influence the network. Pyth’s requirement for publishers to stake $PYTH tokens, which could be slashed in the event of dishonest behavior, helps protect against such attacks by adding a financial cost to creating multiple identities.
Ensuring Reliable Price Feeds: To further protect against price manipulation, Pyth employs advanced statistical techniques to aggregate multiple data inputs into a single robust price feed. This aggregation process includes checks and balances that disregard outliers and overly volatile submissions, ensuring that the published price feeds are a true reflection of the market.
Dependencies and Access Controls
Pyth Network relies on a sophisticated oracle mechanism to aggregate and distribute financial market data across various blockchain platforms. However, this dependency on external data sources and the oracle infrastructure introduces certain risks and challenges:
Source Reliability and Manipulation Risks: Pyth aggregates data from multiple first-party publishers which include major trading firms and exchanges. This diversity helps mitigate risks associated with data manipulation or source failures. However, the integrity and accuracy of the data are crucial, as manipulation at the source level can propagate through the network, affecting all dependent applications.
Infrastructure Dependence: The Pyth Network’s operation is heavily reliant on its off-chain and on-chain infrastructure. Off-chain, data is collected and initially processed; on-chain, it is aggregated and made available to consumers. Any disruption in these systems, whether due to technical failures, cyber-attacks, or external dependencies (like cloud services or internet connectivity issues), could impact the availability and timeliness of data feeds.
System Downtime and Updates: Regular updates and maintenance are necessary to ensure the oracle remains secure and functional. However, these activities can lead to temporary downtimes or unforeseen issues post-update, during which data feeds might not be available or could perform suboptimally.
Safeguards Against Stale Data: Given the critical nature of timely and accurate data for DeFi operations, Pyth implements mechanisms to prevent the use of stale data. The SDKs provided by Pyth include default checks that reject data queries if the data is older than a pre-set threshold, which can be adjusted according to the specific needs of different protocols.
Handling High-Latency Scenarios: Despite Pyth’s low-latency design, there is an inherent delay in on-chain data transmission compared to real-time market movements. This can create windows of opportunity for arbitrage that exploits these delays. Protocols integrating Pyth data need to design their systems considering these latency aspects to minimize risks associated with rapid price movements in the underlying markets.
Pyth employs multiple data sources to reduce reliance on any single provider and has built a reputation for providing secure, timely, and accurate market data to decentralized applications.
Team
Some of the key personnel at Douro Labs driving the Pyth Network forward include:
- Michael Cahill – Co-Founder & CEO of Douro Labs
- Jayant Krishnamurthy – Co-Founder & CTO of Douro Labs
- Ciaran Cronin – Co-Founder & COO of Douro Labs
- Harnaik Kalirai – Head of Integration at Douro Labs
- Abhimanyu Bansal – Head of Partnerships at Douro Labs
- Alexandre Lemos – Head of HR at Douro Labs
The Pyth Data Association has a lineup of contributors who fortify the network’s capabilities:
- Marc Tillemet – Contributor
- Edward Zuo – Contributor
- Mario Bernardi – Contributor
- Burak Saglamm – Contributor
- Yanis Kheddouci – Contributor
- Ande Zheng – Contributor
- Giulio Alessio – Contributor
- Pierre Tillemet – Community Management & Content
- Tyrone van der Ley – Community Management
Douro Labs
Douro Labs is a blockchain infrastructure company concentrated on the enhancement and expansion of the Pyth Network’s oracle services and data offerings. Their work includes developing oracle tools and Web3 infrastructure to facilitate access to live market data for blockchain ecosystems.
The company’s objectives are as follows:
- Development of Oracle Tooling: Creating tools that improve the function and dependability of Pyth Network’s oracle services.
- Product Expansion: Developing new products to diversify Pyth Network’s data services portfolio.
- Infrastructure Innovation: Upgrading the supporting infrastructure to meet the DeFi sector’s growing demands.
- Mission: Focusing on innovation to provide the blockchain space with timely and previously inaccessible market data.
Douro Labs’ team comprises professionals with backgrounds from established institutions such as Goldman Sachs, BNP Paribas, Amazon Web Services, Jump Crypto, and Chorus One, indicating a strong foundation for driving Pyth Network’s initiatives.
Douro Labs has been instrumental in implementing the Perseus Upgrade for the Pyth Network, which improved the functionality of the Pyth Price Feeds. This was part of the network’s transition towards a permissionless mainnet and the establishment of on-chain governance to steer the protocol’s future development.
Pyth Data Association
The Pyth Data Association is a Swiss-based organization established by contributors to the Pyth Network. Its main role is to foster the network’s advancement by driving technological development, promoting awareness, and stimulating ecosystem growth through a grants program.
The association is focused on the application of the Pyth Network as outlined in its whitepaper, with the aim of bringing real-time market data, traditionally held by centralized financial institutions, onto the blockchain. This initiative is part of a broader push towards decentralized finance.
In terms of governance, the introduction of $PYTH governance tokens by the Pyth Network is a move toward decentralizing the decision-making process within the network, allowing token holders to have a say in its future direction.
The Pyth Data Association initially oversaw the protocol, ensuring a solid foundation for development. With the transition to a live ecosystem, governance responsibilities are progressively shifting to an on-chain system. On-chain governance, powered by $PYTH tokens, is designed to be inclusive, allowing token holders to propose changes, delegate their voting power, and participate in shaping the network’s trajectory. The governance period for voting on proposals spans two weeks, ensuring ample time for deliberation and participation. This process is an integral part of the Pyth Network’s ongoing development.
As the Pyth Network expands its reach across multiple blockchains, the role of the Pyth Data Association in stewarding its development and supporting the ecosystem’s growth remains crucial.
Project Investors
While the exact amount raised and the valuation of Pyth Network remain undisclosed, the Swiss-based Pyth Data Association has confirmed the participation of prominent crypto venture firms and market makers.
GBV Capital and CTC Venture Capital have been involved in the early seed round of Pyth Network.
Venture round saw contributions from entities such as Castle Island Ventures, Multicoin Capital, Wintermute Ventures, Borderless Capital, CMT Digital, Bodhi Ventures, Distributed Global, Tagus Capital and Delphi Digital.
FAQ
How does Pyth work?
- Pyth is a protocol connecting market participants for on-chain pricing data. Data providers supply pricing, which Pyth’s oracle program aggregates. The aggregated prices are available on-chain, ensuring transparency.
What is an on-demand or “pull-based” oracle?
- Unlike “push” oracles, Pyth’s model allows users to request prices as needed. It optimizes efficiency, avoiding unnecessary data transactions and costs. Users can verify price authenticity and use verified data in applications.
How does Pyth Network ensure data accuracy?
- Pyth Network employs a decentralized model with first-party data providers. Data accuracy is bolstered by multiple providers contributing to each feed. The system is designed to weigh data sources and mitigate outliers or manipulation.
What sets Pyth Network apart from other oracles?
- It offers ultra-low-latency, high-frequency updates. The network features an extensive range of price feeds across multiple asset classes. Pyth provides real-time data directly from the market participants.
How does Pyth Network handle data distribution?
- Pyth operates on Pythnet, an app-specific blockchain, ensuring efficient data aggregation. It utilizes a “Pull Oracle” architecture, allowing on-demand data retrieval. This method promotes gas efficiency and provides updated prices when needed.
What is Pythnet and how does it differ from Solana?
- Pythnet is an application blockchain built on the Solana codebase for data aggregation. It runs independently from Solana mainnet, dedicated to processing Pyth data. Pythnet’s faster slot time enables quicker updates for Pyth price feeds.
How does Pyth use Wormhole?
- Wormhole serves as a bridge for Pyth data to multiple blockchains. It ensures that price updates are authenticated and integrated into user transactions. Pyth price updates are permissionless, enabling broad participation in data verification.
What are the latency and costs associated with Pyth Price Feeds?
- Pythnet to Wormhole latency averages 0.3 seconds, excluding native block time. The fee structure for using Pyth Price Feeds is determined by governance and is minimal to encourage widespread use.
Can Pyth data be trusted for financial decisions?
- The network’s design emphasizes transparency and provider accountability. Confidence intervals provided alongside prices reflect data robustness. Pyth’s Pull Oracle architecture ensures the latest data availability for users.