Pyth Oracle Explained
An introduction into Pyth Network, Solana’s most dominant price feed oracles.
ORACLE & PYTH NETWORK OVERVIEW
Oracles have become an indispensable part of the crypto space as it is their mission to bridge the data gaps between 2 realms. Acting as a gateway to pipe off-chain data into blockchain networks, oracles allow decentralized applications to interact with the outside world.
Robust data provision is of utmost importance to maintain the required accuracy that guarantees the proper operations of all dapps. Among all programs, Defi protocols often rely heavily on the price feeds provided by oracles.
Pyth is an oracle network with a robust model to optimize the flow of bringing reliable data to web3. With numerous prominent Solana dapps are leveraging Pyth, the program remains as popular and widely used as ever. To have an overview of how Pyth network powers Solana dapps with its price feeds, check out the info below:
Pyth Network’s Participants
Pyth operates with 3 types of participants 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 and 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. They are either 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.
Pyth Network’s Flow of Interactions
Pyth Network’s flow of interactions is constituted of 4 main mechanisms:
Price aggregation combines individual publishers' reported prices and confidence intervals into a single price feed and confidence interval feed for a specific product.
Data staking allows delegators to stake tokens to earn data fees.Stake-weight determines the level of influence that each publisher has on the aggregate price. This mechanism collects data fees, distributed 80% of the total amount to delegators, and the remaining 20% goes into a reward pool shared among publishers. Delegators’ stakes can be slashed when (1) the price feed publishes 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.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 consumer will then receive a payout as compensation for any loss caused by a bad pricing event.
Reward distribution determines the share of the reward pool allocated to each publisher. The mechanism rewards publishers with higher quality price feeds and reduces the likelihood that uninformed publishers will earn rewards.
Governance: a coin-voting system that dictates the parameters of all mechanisms used within the network.
Pyth Network’s Mechanism
Pyth’s entire mechanism can be conceived through this example:
Solend takes the role of the consumer as defined above with its demand for accurate price feeds.
Prices are submitted to Pyth by publishers (they can be traditional or crypto native trading firms, DEXs and CEXs,…)
Delegators stake tokens to specific products and publishers to increase data robustness. Their stakes are paid out to Solend if the protocol successfully files a claim against the protocol for an erroneous price.
Solend pays the fees which are proportionally distributed to both publishers and delegators.
The more Solend and other protocols pay to get accurate prices, the more delegators will stake and the more likely it will attract new publishers
For deeper understanding on why Solana’s developers choose to build with Pyth, Solscan’s users can refer to Pyth Network whitepaper
Since its introduction to the public, Pyth Network has had a firm yet rapid progression thanks to its unparalleled data speed and quality as well as its growing innovation and secured mechanisms. As a result, the submission of accurate price feeds is guaranteed, leading to high level of confidence in the program. Keep up with Pyth’s remarkable tractions with their latest overview article:
As for Solscan, our team has recently finished parsing a lot of Pyth’s instructions, rendering them humanly readable. Some instructions parsed so far include:
Adding Product
Update Product
Adding Price
Adding Publisher
Delete Publisher
Update Price
Set min Publishers.
In the above example, we have a publisher (9Shm3gXvtFpm68iUzmNtMvWBsZw62TJhVQykSqgwbpkz) sending a Price Update to the price account (kQC7awXFEMX6Kcva1SAgCtEyUEDgg8S1sh2ddoQpwDZ) of the USD/CHF price feed.
Status = 1, means TRADING while 0 would mean UNKNOWN. This is a valid price input from the publisher and will be used for the price aggregation.
To determine the 'real' price and confidence interval, you need to apply the exponent -5 (available in the price account).
Thus, the price submitted by 9Shm3gXvtFpm68iUzmNtMvWBsZw62TJhVQykSqgwbpkz for USD/CHF is 0.96427 +/- 0.00067
Pyth’s parsing instruction process will be constantly and manually updated by Solscan team, and of course with the help from Pyth team.
We hope to witness more Solana protocols that integrate Pyth network into their products, and look forward to seeing more on what Pyth can deliver in the future.