Pyth Network Deep Dive

Serotonin Juice
7 min readAug 7, 2022

History of Pythia

Throughout the Ancient Greek era, oracles and diviners practiced their divine art, giving insights into the future for commoners and nobles. Oracles would relay divine information ranging from epidemics and plagues to wars and invasions. People trusted the information because they were from the gods. Pythia, who lived in the temple of Delphi, was one of the famous oracles.

Nowadays, no one goes to the Temple of Apollo to find answers to what tomorrow looks like. However, the term “oracle” has resurfaced in the blockchain world.

Modern and ancient oracles play a similar role — relaying much-needed information to people who cannot access it on their own. Let us go over a refresher of what blockchain is before we dive deep into blockchain oracles and Pyth.

A blockchain is simply a network technology that stores data, especially transaction data. Blockchain networks are decentralized and distributed, meaning users share ownership and management of the network. Blockchain stores data in blocks that are linked together by cryptography.

Blockchain Networks and Oracles

Advanced blockchain networks such as Ethereum, Solana, and Cardano introduced smart contracts in the crypto space. Smart contracts are agreements on the blockchain that automatically executes a programmed contract once the pre-set conditions are met. Smart contracts allows these blockchain networks to support more applications beyond mere payments. Smart contracts can allow people to swap tokens: For example, if Jack sent X number of BTC, they receive Y number of SOLANA. These contracts can also be deployed for more complex applications, such as insurance contracts where people can pay a monthly premium. When their houses burn down, the insurance contract pays them. Other uses include betting on event outcomes such as presidential elections such that the program automatically rewards one if the candidate they predicted wins. These digital contract on the blockchain can be improved and executed without censorship. By using a decentralized network to store and enforce contract terms. A decentralized network with no central point to be hacked and no centralized intermediary bribes thus reduces the ability of intermediaries to seek and extract value.

The problem is that a blockchain cannot see outside its code. They cannot go around searching for the houses that burnt down under the circumstances described on the smart contract to qualify the owners for compensation. They cannot track the changes in the exchange rate of tokens X and Y, let alone who has won a presidential election. So how can a blockchain get this information?

The answer is in oracles.

What are Oracles?

An oracle is a program that gives blockchains reliable data outside of the current information that blockchain has access to. For example, they will track token exchange rates and relay the information to smart contracts to help initiate transactions per the contract terms. As such, oracles are highly significant for the sustainability of smart contracts. They bridge the gap between the blockchain ecosystem supporting the smart contract and the real world, just as the ancient world bridged this world and the unseen world of gods. However, unlike the real Ancient Greek oracles, blockchain oracles are just code programmed by someone and trusted by many.

Currently, the majority of the oracles provide information about financial assets. However, the use cases of oracles are unlimitedly wide. Oracles can transmit information about the temperatures and humidity levels. Such use cases may not be popular yet, since blockchain is still primarily a financial technology. We may appreciate other use cases once the blockchain has become part of our daily lives.

Chainlink is one of the oldest and most popular oracles in the crypto space. Other protocols include Universal Market Access, WINklink, Tellor, and Band Protocol.

Many oracles are decentralized. They do not rely on one source of information. Instead, they allow anyone to participate and provide information to users. These information providers, known sometimes as “reporter nodes”, fetch information from other sources, including aggregators who have copied or obtained their information elsewhere.

Now, this model has two main issues. First, the accuracy of the information reaching the users may be compromised. Imagine having five oracles between the people and gods. If you are a parent with a very sick child, seeking instruction from the gods on what to do to save the life, the information will pass through the five oracles before reaching you. If one of the oracles misses part of the instruction, the error will be propagated all the way to the user. The parent will end up administering the wrong treatment procedure, and the child might die. The chances of error increase with the number of oracles between the source of the information and the user. A similar challenge happens with the blockchain oracles. Some participants will send information that they have not verified. Sometimes these reporters are just honest, and it’s only that their chosen sources have lied to them. However, sincerity cannot change erroneous data to accurate ones.

The second problem is to do with the time taken for the information to reach the user. If one oracle takes a day to pass information, five oracles will need five days. Imagine the parent waiting until the child dies. In that case, the information that arrives later becomes useless at best. Some oracles are required to relay nearly real-time data. For example, getting the information as quickly as possible in the markets is essential. An oracle may need to transmit the price of BTC for trading. First, the exchange will determine the price and display it on its website for public view. Among the users viewing the price, an aggregator may receive the data with a slight delay due to an internet connection. The aggregator will then publish the information on its website. One of the information providers on an oracle may look at the data and copy it to the oracle network, of course, with some additional delay. In the oracle network, the information first reaches the validator nodes that determine the price to be displayed. Again, the data validation takes some time, amounting to more delay. Finally, data is published on the blockchain, where it is subject to block time. A block time is a time taken to validate transactions. Block time may be different from one blockchain to the other. Ethereum 1.0 takes about 10 to 15 seconds. Generally, nodes cannot have a perfect transmission time because of the many stages the data takes from the source to its arrival on the network.

These are both real problems with this current oracle design. Is there a better way of designing an oracle?

This is where Pyth comes in.

What is Pyth?

Pyth is a publisher oracle network that requires its participants to be the source of information. For example, the trading platforms will give information to the Pyth network directly. Think of having only one Pythia that communicates directly with gods.

Pyth receives price information directly from world-class market participants: global exchanges, market makers, and financial service providers. As such, it receives fresher information with a shorter transmission time. As compared to most legacy oracles where nodes must purchase the data last mile from API endpoint or middlemen before sending to on-chain consumption Furthermore, Pyth is built on the Solana blockchain, which allows Pyth to refresh its data feeds every 400ms.

Pyth has three types of network participants: publishers, delegators, and consumers.

Publishers are the people who send information to the network, and they may include exchange platforms and investment firms. The network rewards publishers according to the amount of helpful information they share. Pyth’s publishers include FTX, LMAX Digital, Bitstamp, Bitso, CTC, and DV Chain etc.

Next are the Delegators. These users own Pyth tokens and can stake them towards specific publishers for specific Pyth feeds. Delegators increase the stake-weight (influence) of publishers for each price feed by adjusting the amount they stake towards those publishers. The job of the delegator is to help demonstrate confidence in the data from a particular Pyth data provider by selecting them based on their historical performance and accuracy.

Finally, we have the consumers who are the applications that use the information published on Pyth, and they read the data provided and possibly pay a fee. Data fees will go towards hedging against oracle risk: if anything goes wrong with a Pyth data feed, consumers who paid fees will receive a payout. Consumers can be on-chain or off-chain applications.

Advantages of Pyth Network

First, the network has cross-chain compatibility. Pyth uses Wormhole technology to send Pyth prices to other chains. Therefore the network’s cross-chain publish can be live on any Wormhole-supported chain. Pyth is deployed on BNB Chain for devnet and testnet already, for example.

Another advantage Pyth has over its competitors is the high on-chain speed. The high transaction speed is possible because of Solana’s consensus algorithm, proof-of-history (PoH), and proof-of-stake (PoS). This feature suits DeFi projects, which rely on the network to provide them with information at a higher speed comparable to the standards of the traditional financial world. For instance, decentralized lending or derivative platform would need faster input to reflect the market more closely and allow users to make decisions in time.

Pyth appeared first on April 7, 2021. Pyth went mainnet on August 26, 2021 yet has attracted 66 major data providers.

🏋️‍♀️ Get Involved

--

--