What Are Oracles and Why Are They Needed in DeFi?

by Nikolay Beliavskyi
What Are Oracles and Why Are They Needed in DeFi

In this article, we will talk about what oracles are in the context of blockchain ecosystems, what functions they perform, and their classifications. We will also consider why the full processing of DeFi applications without oracles would be difficult.

The number of use cases for decentralized technologies and smart contracts is growing exponentially with the development and expansion of the blockchain ecosystem. In the beginning, blockchains operated only with data within their personal accounting systems. With the advent of decentralized finance, the need for regular updating of information from the outside world has increased. Due to the technological limitations of the blockchain, it is difficult to obtain reliable data from outside and validate it before adding it to the network. This is where the oracles come into play — they are computer programs that connect data from the outside world (off-chain) to the blockchain world (on-chain).

Oracles Within The Blockchain Ecosystem

Oracles have become an indispensable part of the Decentralized Finance (DeFi) ecosystem. Over the past year, the capitalization of oracle projects has grown to tens of billions of dollars, which indicates their relevance to the industry.

They are designed as APIs for the world outside of the blockchain. After all, the more popular and technologically advanced DeFi becomes, the more information from the outside world will need to be transmitted to the blockchain. Crypto oracles query, verify and authenticate the information coming from outside the blockchain in order to transfer it to smart contracts that request it. 

What Information Oracles Provide

Most oracles work with digital information, but there are a few exceptions. Software oracles provide information to the blockchain from digital databases, websites, and servers. In DeFi, they are needed to provide information on prices, exchange rates, dynamics, and other data. Hardware oracles can supply information from video cameras, scanners, and other sensors. 

Examples of data gathered by oracles include the following:

  • Lottery winners;
  • Natural disasters together with risk measurements;
  • Prices and exchange rates of real/crypto-assets;
  • Static data (e.g., country codes);
  • Dynamic data (e.g., time measurements);
  • Weather conditions;
  • Political events;
  • Sporting events;
  • Geolocation and traceability information;
  • Accidents;
  • Events in other blockchains;
  • Information from IoT devices.

All these categories can serve as required data for the operation of smart contracts. 

Oracle Types in DeFi

Oracles differ depending on the source of the information, the direction of the information, and the degree of trust.

Oracles can transfer data from the outside world to the blockchain (outbound) and from the blockchain to the outside world (inbound). The transmitted information can be varied — from prices to the dynamics of changes in any quantitative data. For example, oracles can be used in a smart contract to buy an asset when a certain price is reached.

There are three main types of oracles by organizational structure:

Centralized

Centralized oracles work similarly to a traditional financial system, acting as suppliers of external data to smart contracts. They are easier to work with, but they may be exposed to the risks of traditional centralized systems. They can be compromised and are vulnerable to hacking and manipulation because they only have a single point of failure.

Coinbase Price Oracle is one of the most famous and trusted centralized oracles in the blockchain ecosystem. This organization uses the Coinbase Pro API as a data source and excludes data points with significant deviation. Many DeFi projects call on Coinbase Price Oracle for up-to-date information on the prices of crypto assets. 

Decentralized

Decentralized oracles rely on multiple sources of information to reduce risks and increase the reliability of the information provided to smart contracts. This type of oracle uses the Schelling points game theory in its work, assuming that all participants act independently of each other. Focal point filters and verifies information for authenticity. Thus, it is possible to ensure the impartiality of the information received and the accuracy of the values.

This is the preferred oracle model and it is in line with DeFi ideas. Many blockchain projects – including Chainlink (LINK), Band Protocol (BAND), Augur (REP), and MakerDAO (builders of DAI) – are developing decentralized oracles. 

Distributed

Distributed oracles are an enhancement to the centralized model. They use whitelists with approved parties that are involved in collecting and transferring information to the blockchain. In addition, to reduce errors, information from different sources is used to calculate the arithmetic mean. However, this construction is still subject to the risk of manipulation by the whitelist’s members.

An evolution of distributed oracles is the Relaying Mechanism. It involves the creation of a hierarchical structure in which several parties transfer information to a higher authority, who decides to transfer the information to a smart contract. However, such a solution is even more vulnerable because information can easily be compromised along the relay chain. 

An additional type of DeFi oracle is the Delegated Proof-of-Stake.

Delegated Proof-of-Stake (DPoS)

In DPoS, external data is provided by the nodes listed on the whitelist. To participate in the whitelist, the nodes have to stake a portion of the assets, which they may lose if they provide incorrect information. This encourages the oracles to be honest, although it certainly does not serve as a guarantee of their compliance.

Those who consider using DPoS Oracles as an alternative to the other oracles should pay attention to the whitelisting process and supporting entity. They should also study what responsibility the nodes will bear as a result of manipulation. 

Weaknesses of Oracles in DeFi

The main drawback of oracles, as we mentioned earlier, is the need to trust their honesty. Data from one or more individuals can easily be altered or manipulated. Some experts have defined the oracle problem in the blockchain as “the security, authenticity, and trust conflict between third-party oracles and the trustless execution of smart contracts.” You can learn more about The Blockchain Oracle Problem in this article.

Centralized Oracles are, in fact, the third party that smart contracts were created to avoid. Distributed and even DPoS oracles can be affected by the same problem, since the nodes of these models may provide incorrect data. 

Blockchain oracles also have a number of technical limitations. Huobi DeFiLabs researchers conclude that network congestion or a lack of price feed can cause price delay causing price deviations:

“In fact, the transfer of asset experience from off-chain to on-chain will produce three different prices with small deviations: exchange quotations, oracle theoretical feed prices, and on-chain quotations (true price generated by Oracles). Behind the difference between these three prices are two easily overlooked risk factors: 1: delay 2: volatility.

Since the on-chain and the off-chain worlds run in parallel with different time structures, price differences are naturally presented between the off-chain and the on-chain worlds due to time delays. However, when the market volatility is higher, price differences can experience some even larger gaps.”

It is extremely difficult to eliminate price lags and variance due to the fact that the off-chain world runs on continuous time, but the on-chain world runs discreetly by block. This is the third problem with blockchain oracles.

Time in the blockchain is discrete, not continuous, and flows block by block.

In the real world, time expiries are continuous, and the market has evolved over time into a complex pricing mechanism based on a continuous timeline. However, in the blockchain world, time expires discretely and the smallest unit of time is known as block time. Thus, determining the market price in a centralized world is almost always more efficient than in a decentralized one. 

How to Solve Oracle’s Vulnerabilities?

Decentralized finance was created with the aim of functioning fully without the involvement of third parties. But the attraction of oracles has become a double-edged sword: on the one hand, protocols can receive data from the outside world, and on the other, decentralized protocols now depend on an intermediary.

However, while the technical capabilities of blockchain do not allow one to take data directly from the outside world, oracles are a necessary solution for a number of tasks in DeFi. If it is impossible to come up with a better solution, we need to improve the existing one. A group of researchers from Huobi Ventures provides a list of recommendations for improving and fixing the current vulnerabilities:

a) Enable computable risks;

b) Consider time as discrete rather than continuous, with the smallest unit of time as blocks;

c) Incorporate time delay, market volatility, and transaction costs when compensating the LPs.

What Are the Most Popular DeFi Protocols Running Oracles?

One of the most popular DeFi projects powered by oracles is MakerDAO. The stablecoin of the DAI project is pegged to the US dollar, and the oracles follow the correspondence of prices. The oracle’s module consists of whitelisted addresses of oracles and an aggregator contract. The oracles send the price value to the aggregator, which calculates the arithmetic average and sends it to the platform’s smart contracts.

Another DeFi giant using oracles is the Compound lending protocol. Similar to MakerDAO, Compound also uses oracles to collect price information, which is then sent to its price stream, which is managed and controlled by “administrators” who hold Compound’s own token, COMP.

Leaders in the development and provision of decentralized oracle services are platforms such as Chainlink, Band Protocol, Tellor, and Nest Protocol. Chainlink has partnered with giants such as Google, Oracle Corporation, Gartner, Binance, and even the Chinese Blockchain Service Network. It has also partnered with SWIFT, which is the global standard for communication between financial institutions.

Conclusion 

Oracles play a truly critical role in providing data to blockchain protocols, and the wider the use of blockchain, the more data from the outside world will be required by smart contracts. The use of Oracles is indispensable in:

  • the creation of a decentralized IoT; 
  • to interact with the traditional financial system; 
  • for conducting trustless transactions in the real economy sector;
  • for the conclusion of smart contracts in traditional business areas. 

This is just a drop in the sea of ​​potential directions for the collaboration of blockchain protocols with oracles, and this number will only grow in the future.

You may also like

Leave a Comment