From 5586b4a746eecef764531c2da7714dee2cc7dd2b Mon Sep 17 00:00:00 2001 From: Aditya Arora Date: Tue, 6 Aug 2024 14:19:46 -0400 Subject: [PATCH 1/3] (refactor)-solana sunset --- pages/price-feeds/how-pyth-works.mdx | 5 ++--- pages/price-feeds/how-pyth-works/oracle-program.mdx | 2 +- .../price-feeds/how-pyth-works/price-aggregation.mdx | 6 +++--- pages/price-feeds/how-pyth-works/pythnet.mdx | 6 +++--- pages/price-feeds/price-feed-ids.mdx | 11 ++--------- 5 files changed, 11 insertions(+), 19 deletions(-) diff --git a/pages/price-feeds/how-pyth-works.mdx b/pages/price-feeds/how-pyth-works.mdx index c4028368..1d814c2d 100644 --- a/pages/price-feeds/how-pyth-works.mdx +++ b/pages/price-feeds/how-pyth-works.mdx @@ -7,12 +7,11 @@ Pyth is a protocol that allows market participants to publish pricing informatio 3. _Consumers_ read the price information produced by the oracle program. Pyth's oracle program runs on [Pythnet](how-pyth-works/pythnet.md). -[Pythnet Price Feeds](./) are available on 50+ blockchains. The prices constructed on Pythnet are transferred [cross-chain](how-pyth-works/cross-chain.md) to reach consumers on these blockchains. The critical component of the system is the [oracle program](how-pyth-works/oracle-program.md) that combines the data from each individual publisher. -This program maintains a number of different [Solana accounts](pythnet-reference/account-structure.md) that list the products on Pyth and their current price data. +This program maintains a number of different [SVM accounts](pythnet-reference/account-structure.md) that list the products on Pyth and their current price data. Publishers publish their price and confidence by interacting with the oracle program on every slot. The program stores this information in its accounts. The first price update in a slot additionally triggers [price aggregation](how-pyth-works/price-aggregation.md), which combines the price data from the previous slot into a single aggregate price and confidence interval. -This aggregate price is written to the Solana account where it is available for transmission to other blockchains. +This aggregate price is written to these SVM accounts of Pythnet where it is available for transmission to other blockchains. diff --git a/pages/price-feeds/how-pyth-works/oracle-program.mdx b/pages/price-feeds/how-pyth-works/oracle-program.mdx index af0194f9..9280ade6 100644 --- a/pages/price-feeds/how-pyth-works/oracle-program.mdx +++ b/pages/price-feeds/how-pyth-works/oracle-program.mdx @@ -7,7 +7,7 @@ The oracle program is responsible for several tasks: 3. Combining the individual data providers' prices into a single aggregate price and confidence interval. 4. Performing any additional stateful computations on the resulting price series, such as computing moving averages. -The oracle solves these problems by maintaining a collection of [Solana accounts](../pythnet-reference/account-structure.md) to represent the set of price feeds. +The oracle solves these problems by maintaining a collection of [SVM accounts](../pythnet-reference/account-structure.md) to represent the set of price feeds. Each feed has two accounts: a product account to store [metadata](../pythnet-reference/product-metadata.md) and a price account. The price account stores a list of authorized data providers for this specific price feed, and allocates storage space for each data provider's price. The oracle program exposes an instruction called `upd_price` that enables an authorized data provider to update the price account with their current estimate of the price and confidence interval. diff --git a/pages/price-feeds/how-pyth-works/price-aggregation.mdx b/pages/price-feeds/how-pyth-works/price-aggregation.mdx index d96d4194..a8670fe6 100644 --- a/pages/price-feeds/how-pyth-works/price-aggregation.mdx +++ b/pages/price-feeds/how-pyth-works/price-aggregation.mdx @@ -13,7 +13,7 @@ Second, the **aggregate price should appropriately weight data sources with diff ![](../../../images/Price_Aggregation_2.png) Finally, the **aggregate confidence interval should reflect the variation between publishers’ prices.** -Under normal market conditions, we expect the a product to trade at a similar price across exchanges. +Under normal market conditions, we expect the product to trade at a similar price across exchanges. In these cases, we would like the aggregate confidence interval to reflect the confidence intervals of the individual data providers, as shown in the figure on the left. However, in some rare situations, a product can trade at different prices on different exchanges. In these cases, the aggregate confidence interval should widen out to reflect the variation between these prices, as shown in the figure on the right. @@ -24,11 +24,11 @@ In these cases, the aggregate confidence interval should widen out to reflect th The aggregation algorithm itself is a simple two-step process. The first step 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 — then taking the median of all the votes. -The second step computes 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. +The second step computes the distance from the aggregate price to the 25th and 75th percentiles of the votes, and then selects the larger of the two as the aggregate confidence interval. This process acts like a hybrid between a mean and a median, giving confident publishers more influence, while still capping the maximum influence of any single publisher. The algorithm has an interpretation as computing the minimum of an objective function that penalizes the aggregate price from deviating too far from the publishers' prices. -This interpretation allows us to prove properties of the algorithm's behavior: for example, the aggregate price will always lie between the 25th and 75th percentiles of the publishers' prices. +This interpretation allows us to prove the properties of the algorithm's behavior: for example, the aggregate price will always lie between the 25th and 75th percentiles of the publishers' prices. **Scenarios** diff --git a/pages/price-feeds/how-pyth-works/pythnet.mdx b/pages/price-feeds/how-pyth-works/pythnet.mdx index 8525fc11..f438e80f 100644 --- a/pages/price-feeds/how-pyth-works/pythnet.mdx +++ b/pages/price-feeds/how-pyth-works/pythnet.mdx @@ -4,12 +4,12 @@ Pythnet is an application-specific blockchain operated by Pyth's data providers. This blockchain is a computation substrate to securely combine the data provider's prices into a single aggregate price for each Pyth price feed. Pythnet forms the core of Pyth's off-chain price feeds that serve all blockchains. -Pythnet is powered by Solana technology: it runs the same validator software, but is a Pyth specific chain that is independent of Solana's mainnet. +Pythnet is powered by Solana technology: it runs the same validator software but is a Pyth-specific chain that is independent of Solana's mainnet. The Pyth Data Association enables each data provider to operate one validator by delegating them the necessary stake. -Once governance is live, it will take over management of validators from the Pyth Data Association. +Once governance is live, it will take over the management of validators from the Pyth Data Association. The purpose of Pythnet is to provide a secure and reliable computing substrate for Pyth's price aggregation. -Recall that Pyth's data providers submit their own price measurements for each product. +Recall that Pyth's data providers submit their price measurements for each product. The Pyth protocol needs to combine these prices to produce a single aggregate price. This computation needs to be performed securely -- prices must be combined correctly -- and reliably -- so that accurate and up-to-date price information is always available for applications. Pythnet solves both of these problems. diff --git a/pages/price-feeds/price-feed-ids.mdx b/pages/price-feeds/price-feed-ids.mdx index b1b92517..55faa64b 100644 --- a/pages/price-feeds/price-feed-ids.mdx +++ b/pages/price-feeds/price-feed-ids.mdx @@ -3,15 +3,8 @@ Every Pyth Price Feed has a unique ID, representing the specific pair of assets being priced (e.g., BTC/USD). Every price update is tagged with the corresponding price feed ID. Applications need to store the IDs of the feeds they wish to read. -However, the ids may be represented in different formats (e.g., hex or base58) depending on the blockchain. -Price feeds also have different ids in the Stable and Beta channels. +However, the IDs may be represented in different formats (e.g., hex or base58) depending on the blockchain. +Price feeds also have different IDs in the Stable and Beta channels. The full catalog of price feeds is listed on the [pyth.network website](https://pyth.network/price-feeds/). The [Price Feed ID reference](https://pyth.network/developers/price-feed-ids) also lets you identify a feed's ID in your chosen ecosystem. -To use a price feed on-chain, look up its ID using these page, then store the feed id in your program to use for price feed queries. - -## Solana Price Feed Accounts - -On Solana, each feed additionally has a collection of **price feed accounts** containing the feed's data. -The addresses of these accounts are programmatically derived from the feed id and a shard id, which is simply a 16-bit number. -See [How to Use Real-Time Data on Solana](price-feeds/use-real-time-data/solana#write-frontend-code) for more information on price feed accounts. From 6ebc7fddfe79bdfc8df8ed648c7be2a7c312ead3 Mon Sep 17 00:00:00 2001 From: Aditya Arora Date: Wed, 7 Aug 2024 10:32:11 -0400 Subject: [PATCH 2/3] requested changes --- pages/price-feeds/how-pyth-works/price-aggregation.mdx | 4 ++-- pages/price-feeds/how-pyth-works/pythnet.mdx | 3 +-- pages/price-feeds/price-feed-ids.mdx | 6 ++++++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/pages/price-feeds/how-pyth-works/price-aggregation.mdx b/pages/price-feeds/how-pyth-works/price-aggregation.mdx index a8670fe6..fefe551f 100644 --- a/pages/price-feeds/how-pyth-works/price-aggregation.mdx +++ b/pages/price-feeds/how-pyth-works/price-aggregation.mdx @@ -13,7 +13,7 @@ Second, the **aggregate price should appropriately weight data sources with diff ![](../../../images/Price_Aggregation_2.png) Finally, the **aggregate confidence interval should reflect the variation between publishers’ prices.** -Under normal market conditions, we expect the product to trade at a similar price across exchanges. +Under normal market conditions, we expect a product to trade at a similar price across exchanges. In these cases, we would like the aggregate confidence interval to reflect the confidence intervals of the individual data providers, as shown in the figure on the left. However, in some rare situations, a product can trade at different prices on different exchanges. In these cases, the aggregate confidence interval should widen out to reflect the variation between these prices, as shown in the figure on the right. @@ -28,7 +28,7 @@ The second step computes the distance from the aggregate price to the 25th and 7 This process acts like a hybrid between a mean and a median, giving confident publishers more influence, while still capping the maximum influence of any single publisher. The algorithm has an interpretation as computing the minimum of an objective function that penalizes the aggregate price from deviating too far from the publishers' prices. -This interpretation allows us to prove the properties of the algorithm's behavior: for example, the aggregate price will always lie between the 25th and 75th percentiles of the publishers' prices. +This interpretation allows us to prove properties of the algorithm's behavior: for example, the aggregate price will always lie between the 25th and 75th percentiles of the publishers' prices. **Scenarios** diff --git a/pages/price-feeds/how-pyth-works/pythnet.mdx b/pages/price-feeds/how-pyth-works/pythnet.mdx index f438e80f..4c84226e 100644 --- a/pages/price-feeds/how-pyth-works/pythnet.mdx +++ b/pages/price-feeds/how-pyth-works/pythnet.mdx @@ -6,10 +6,9 @@ Pythnet forms the core of Pyth's off-chain price feeds that serve all blockchain Pythnet is powered by Solana technology: it runs the same validator software but is a Pyth-specific chain that is independent of Solana's mainnet. The Pyth Data Association enables each data provider to operate one validator by delegating them the necessary stake. -Once governance is live, it will take over the management of validators from the Pyth Data Association. The purpose of Pythnet is to provide a secure and reliable computing substrate for Pyth's price aggregation. -Recall that Pyth's data providers submit their price measurements for each product. +Recall that Pyth's data providers submit their own price measurements for each product. The Pyth protocol needs to combine these prices to produce a single aggregate price. This computation needs to be performed securely -- prices must be combined correctly -- and reliably -- so that accurate and up-to-date price information is always available for applications. Pythnet solves both of these problems. diff --git a/pages/price-feeds/price-feed-ids.mdx b/pages/price-feeds/price-feed-ids.mdx index 55faa64b..0f8eae54 100644 --- a/pages/price-feeds/price-feed-ids.mdx +++ b/pages/price-feeds/price-feed-ids.mdx @@ -8,3 +8,9 @@ Price feeds also have different IDs in the Stable and Beta channels. The full catalog of price feeds is listed on the [pyth.network website](https://pyth.network/price-feeds/). The [Price Feed ID reference](https://pyth.network/developers/price-feed-ids) also lets you identify a feed's ID in your chosen ecosystem. + +## Solana Price Feed Accounts + +On Solana, each feed additionally has a collection of **price feed accounts** containing the feed's data. +The addresses of these accounts are programmatically derived from the feed id and a shard id, which is simply a 16-bit number. +See [How to Use Real-Time Data on Solana](price-feeds/use-real-time-data/solana#write-frontend-code) for more information on price feed accounts. From a2fb416ef51a381774bc74f974632b9a5d24b5c2 Mon Sep 17 00:00:00 2001 From: Aditya Arora Date: Mon, 12 Aug 2024 12:53:46 -0400 Subject: [PATCH 3/3] changes --- pages/price-feeds/how-pyth-works/pythnet.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/price-feeds/how-pyth-works/pythnet.mdx b/pages/price-feeds/how-pyth-works/pythnet.mdx index 4c84226e..532adadb 100644 --- a/pages/price-feeds/how-pyth-works/pythnet.mdx +++ b/pages/price-feeds/how-pyth-works/pythnet.mdx @@ -5,7 +5,7 @@ This blockchain is a computation substrate to securely combine the data provider Pythnet forms the core of Pyth's off-chain price feeds that serve all blockchains. Pythnet is powered by Solana technology: it runs the same validator software but is a Pyth-specific chain that is independent of Solana's mainnet. -The Pyth Data Association enables each data provider to operate one validator by delegating them the necessary stake. +The Pyth Data Association DAO enables each data provider to operate one validator by delegating them the necessary stake. The purpose of Pythnet is to provide a secure and reliable computing substrate for Pyth's price aggregation. Recall that Pyth's data providers submit their own price measurements for each product.