Pyth Network

From DefiLlama
Revision as of 23:23, 11 May 2022 by KemarTiti (talk | contribs) (reduced some bolding)
Jump to navigation Jump to search
Pyth Network

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

The network incentivizes market participants — exchanges, market makers, and financial services providers — to share directly on-chain the price data collected as part of their existing operations. The network then aggregates this first-party price data (still on-chain) and makes it available for free to either on- or off-chain applications.[1] End-users of Pyth data can elect to pay data fees to gain protection against a potential oracle failure as well as attract additional publishers to make the network more robust.

History

Pyth Network Whitepaper

Started in: April 7, 2021

Devnet release: May 15, 2021

Mainnet release: August 26, 2021

Whitepaper release: January 18, 2022

On April 7, 2021, Dave Olsen, the President and Chief Investment Officer of Jump Trading, announced on The Jump Off Point podcast that Jump Trading is “collaborating on a world oracle project called Pyth”.[2] Pyth then revealed its live devnet prices in mid-May and showcased its live streaming and sub-second price update capabilities. In June 2021, Pyth released its v2 upgrade smart contract, improving its aggregation method and space for up to 32 data publishers for a single asset. Finally, on August 26, the Pyth network officially launched on the Solana mainnet.

Pyth finished 2021 with over $1B in Total Value Secured (TVS), and facilitated over $7B in trading (including perpetual and synthetics platforms), with 38 announced mainnet integration partners and 41 data publishers.[3] Since then, Pyth TVS reached about $2B spread over 50 integrations and welcomed more than 15 new data publishers.[4]

In January 2022, the Pyth Data Association released the Pyth network whitepaper. It outlined the design and mechanics around the PYTH token and its role in making the Pyth network self-sustaining and decentralized. The Pyth Data Association was created to support the Pyth network. A board of directors oversees the Pyth Data Association.

The Pyth network has also been involved in several public events within the Solana ecosystem and DeFi. Pyth was a sponsor for the Solana Season Hackathon (May 15-June 7, 2020) and the Convergence - Serum x Wormhole Hackathon (January 7-31, 2021). Pyth also held its first own workshop in Chicago for developers looking to learn more about Pyth and building on top of it (January 17-21, 2022). Outside of DeFi, Pyth was a platinum sponsor at the 2022 FIA Boca Conference in Florida (March 15-17).

General Concepts

Definitions

Total Value Secured (TVS): represents the aggregate amount of Total Value Locked (TVL) within all protocols and platforms that depend on the proper operation of an oracle network to operate.

Total Value Locked (TVL): represents the number of assets that are being staked in a specific protocol at the moment: this value is not meant to show the number of outstanding loans, but rather the total amount of underlying supply that is being secured by a specific protocol or application by DeFi completely.

Oracles

Blockchain oracles act as the bridge between smart contracts living on a blockchain and real-world data. They are designed to relay information from off-chain sources (data outside a blockchain) to an on-chain network. In most cases, the off-chain data is used to trigger smart contracts that need external data to execute.[5]

Borrow-Lending protocols, such as Solend, rely on oracle price feeds to determine the value of the underlying collaterals supplied and/or borrowed. Whenever the collateral provided is worth less than 1 + x% (usually x = 30) of the borrowed collateral, borrow-lending platforms must liquidate a user's position to keep the overall platform healthy (enough collateral to repay the outstanding debt).

The Price of an Asset

Pyth Price and Confidence Interval

Consider a single stock, say TSLA.

“What is the price of TSLA?” is a seemingly simple question, but there are subtle complications.

Overall, there is no “one single price” for TSLA at any moment in time.

There is the best bid price (the price a person could currently sell TSLA at) and the best ask price (the price a person could now buy TSLA at). They are typically close together, but the difference between them (the so-called bid-ask spread) could indeed be viewed as the uncertainty of what the “price” of TSLA currently is, with the midpoint (halfway between the best bid and best ask) being an estimate of the price itself.

Another “price” that could be considered the proper price is actual transaction prices. “Last traded price” is a price that is often reported, and especially in a thinly traded stock, might be even more representative of the true price than the current best bid and best ask prices (where the bid-ask spread might be very wide).[6]

Uncertainty (or “Confidence”) in a Price

In scientific and engineering fields, observation or measurement is almost always accompanied by a measurement of uncertainty. The distance between two points might be measured to be 10.12m +/- 0.01m. The time it took for a car to travel that distance might be 1.23s +/- 0.05s. The measurement of uncertainty is the observer’s best estimate of how far off from the “true” value their measurement is likely to be, given the precision of their measuring equipment, the difficulty in making the measurement, and potentially other factors the observer deems important.

Pyth extends the concept of measurement uncertainty to asset prices with its Confidence Interval (discussed below).[6]

High-fidelity (HiFi) data

Financial applications requires high-fidelity, time-sensitive, real-world data, which has historically been inaccessible on-chain. High-fidelity in this context means accurately reporting data in a timely fashion.

Contemporary music science introduced the concept of high-fidelity to audiophiles by demonstrating the importance of minimizing all distortions in sound reproduction. Simply put, sound engineers focused on reproducing music accurately (with more granularity) on new digital mediums.

The Pyth Network

Pyth Ecosystem

Network Participants

3 different types of stakeholders will interact within the network:

  • Publishers publish price feeds and earn a share of data fees in exchange. Publishers are typically market participants with access to accurate, timely price information. The protocol rewards publishers in proportion to the quantity of new pricing information that they share.
  • Consumers read price feeds, incorporate data into smart contracts or dApps, and optionally pay data fees. Consumers can either be on-chain protocols or off-chain applications.
  • Delegators stake tokens on a specific product and publisher to (1) earn a share of the data fees and (2) increase the price feed robustness but may potentially lose their stake if the oracle is inaccurate.

Participants Incentives

Publishers must stake PYTH tokens to participate in the protocol and earn a share of the rewards. Publishers earn a share of the data fees for the products they price. The data fees paid for a product will likely grow in proportion to consumer usage of the price feed. Publishing erroneous data (voluntarily or not) to the network may lead to the publisher's stake being slashed.

Consumers are incentivized to pay data fees for two reasons. First, data fees enable applications to reduce the risk of using Pyth price feeds as they would receive a payout in case of failure. Second, paying data fees attracts more publishers to the product, which improves the robustness of the price feed. Consumers will be able to pay a fee to the Pyth protocol in any governance-approved token, which may include PYTH, USDC, or other tokens.

Delegators are incentivized to participate in the protocol to earn data fees (coming from consumers’ data fees).

Network Interactions

Pyth Ecosystem Diagram

The Pyth protocol consists of 4 on-chain core mechanisms:

  • Price aggregation combines individual publishers' reported prices and confidence intervals into a single price feed and confidence interval feed for a specific product (e.g. BTC/USD feed). This mechanism is designed to produce robust price feeds — feeds whose prices cannot be significantly influenced by small groups of publishers.
  • Data staking allows delegators to stake tokens to earn data fees. The delegators in aggregate also determine the level of influence (stake-weight) that each publisher has on the aggregate price. In addition, this mechanism determines whether delegators' stakes are slashed. Finally, the mechanism collects data fees from consumers and distributes a share to delegators (initially set at 80%). The remainder (20%) goes into a reward pool distributed among publishers. The 80/20 fee distribution initially set may be adapted at any point with a governance proposal.
  • Reward distribution determines the share of the reward pool earned by each publisher. Each product has a reward pool that delegators can stake into. The reward distribution mechanism preferentially rewards publishers with higher quality price feeds and reduces the likelihood that uninformed publishers will earn rewards.
  • Governance will be using a coin-voting system that will help determine the high-level parameters of the three mechanisms above. Parameters include what types of tokens may be used for data fees; which products are listed on Pyth; the share of data fees allocated to publishers, delegators, and other uses; the number of PYTH tokens that publishers must stake or enable claims to be filed against a product, and more.

The Claims Process

The purpose of this process is to verify that the Pyth aggregate price and confidence interval for a product were incorrect in comparison to some ground-truth off-chain data.

The process will use the HUMAN Protocol to collect the necessary off-chain information from impartial judges, then feeds that information into a predetermined algorithm that determines the outcome of the claim. [7]

The Human judges’ role is not to answer yes or no the claim is valid but rather to report several pieces of (public) information:

  • What was the minimum and maximum price for the product during the time interval in question on a fixed set of reference exchanges (those will be selected in advance per-product by Pyth protocol governance).
  • The maximum and minimum Pyth aggregate price and maximum confidence interval during the time in question.
  • The maximum and minimum price per publisher and maximum confidence interval during the time in question.

The claim will be successful if (1) the price feed published an aggregate price during the claim interval, and if (2) the published aggregate price, incorporating any uncertainty provided by the confidence interval, disagrees with the reference prices.

The algorithm for comparing the prices constructs two ranges. The Pyth network price range extends from the minimum aggregate price minus 3 confidence intervals to the maximum aggregate price plus 3 confidence intervals. The Human price range extends from the reference exchange with the lowest reported price to the one with the highest reported price. The claim is successful if these two ranges do not overlap – this indicates that the Pyth aggregate price and confidence are highly improbable according to these reference exchange.

If the claim is successful, the algorithm will then additionally identify a set of at-fault publishers, slash their stake, and then redistribute it to paying end-users according to the share of fees they paid. The algorithm identifies at-fault publishers using the same algorithm applied to the publisher’s price and confidence instead of the aggregate price and confidence.

Example:

Let's assume the following values were submitted by publishers and returned by the Pyth smart contract on a specific time for BTC/USD.

Pyth network.png

Note that 1,000 is an unusually wide confidence interval for bitcoin. The typical confidence interval is ~50 (0.1%).

Reminder that the Pyth network price range extends from the minimum aggregate price minus 3 confidence intervals to the maximum aggregate price plus 3 confidence intervals.

So the Pyth price range extends from 47,750 to 52,250.

Now, let's assume the Pyth Governance selected Coinbase and Binance as the reference exchanges for any BTC/USD claim and the Human job returns the following values.

Human Protocol Inputs.png

Reminder that the Human Protocol price range extends from the lowest reference exchange reported price to the highest reference exchange reported price.

So the Human Protocol price range extends from 46,500 to 47,300.

In this case, the Pyth range ($47,750 to $52,250) does not overlap with the Human range ($46,500 to $47,300).

Therefore this claim is valid and we now look for the at-fault publishers.

Identifying at-fault Pyth Publishers (3).png

Pyth Publishers A & B do not overlap with the Human Protocol range, their stake is slashed and paid out to voluntarily paying users.

Pyth Network Products

Pyth EMA Chart

Data Feeds

Pyth’s ‘main product’ is its set of live price feeds. Find all the price feeds available on the Pyth network website.

Each feed admits to the following features:

  • Continuous Streaming: Thanks to Solana, Pyth is able to stream data at a sub-second latency and at affordable costs. The network’s publishers can update prices at every Solana slot — currently once every 400ms.
  • Sophisticated Aggregation: As a reminder, the Pyth program computes this price on-chain by aggregating individual publishers' prices and confidence intervals. The first step of the algorithm computes the aggregate price by giving each publisher three votes — one vote at their price and one vote at each of their price +/- their confidence interval — and by then taking the median of all the votes. The second step computes the distance from the aggregate price to the 25th and 75th percentiles of the votes, then selects the larger of the two as the aggregate confidence interval. Overall, the aggregate price will always lie within the 25th-75th percentile of the publisher’s prices. In addition, Pyth is working on a staking system for publishers that incentivizes them to provide accurate data. In that system, each publisher will have a varying amount of stake. All of the results also hold for stake weights if Pyth replaces the percentage of publishers with the percentage of stake controlled. In the future, the weight calculation can be extended to include other non-price factors such as publisher’s stake, historical publisher’s performance, and other relevant metrics. For more information, please visit the Pyth docs.
  • Confidence Interval: Each Pyth publisher reports both a price estimate and confidence interval (for that estimate) to be aggregated, and the aggregated price will have its own aggregated confidence interval value.The confidence interval represents the width around their price estimate in which they believe the true price probably lies. Different publishers have access to different sorts of data and may have different methods of calculating their price estimate and confidence.[8] This confidence value will inform users of the data of the perceived strength of the output. Publishers can acknowledge the low liquidity environment on the traded venue and choose to adjust their confidence accordingly. Applications using Pyth prices can respond to this extra information accordingly for greater flexibility and security. Synthetic asset platforms, for example, could choose to scale liquidity at a price with the confidence reported rather than allow infinite liquidity for mints/redeems on every price (and confidence level). The Pyth network empowers data consumers by continuously publishing a consolidated estimate of these important price reporting dislocations.
  • Price and Confidence EMA: Pyth also offers an exponentially-weighted moving average (EMA) price and exponentially-weighted moving average (EMA) confidence.These values are time-weighted averages of the aggregate price and confidence. Both the EMA price and confidence are natively available from Pyth price accounts.[9]While conceptually not as simple as an SMA (Simple Moving Average), the EMA has a particularly simple implementation for streaming applications such as Pyth.The exponential weighting method allows the entire history of prices and weights to be represented by a single number. Anyone can find more details about Pyth EMA here and the implementation in Pyth’s GitHub

The Pyth Network Ecosystem

Publishers

Pyth Data Publishers

The Pyth network is made up of proprietary (first-party) data providers that contribute their data (inputs) on-chain to the Pyth program and create derived outputs. By having a diverse group of data publishers, ranging from exchanges (US accredited or Crypto) to trading firms and other financial services providers, the Pyth network creates a completely new composite market data stream at quality levels previously inaccessible.

There are more than 55 publicly announced data providers. The full list of publishers can be found on the Pyth website here.

End-Users

Pyth data is natively available on Solana. Accordingly, Pyth’s data is permissionlessly queryable (i.e. no paywall exists on the blockchain). The Pyth team will not know who is using the price feeds unless the person tells them (due to the permissionless nature of a blockchain).

As of April 2022, there are over 50 identified Pyth integrations on Solana and off-chain.

Pyth Metrics as of April 2022

Pyth users vary in types but usually offer the following services: borrow-lending, synthetics, derivatives trading, options vaults, and more.


Notable Pyth users:

With many more broadcasted on Pyth website.

Sources