BTC
ETH
HTX
SOL
BNB
View Market
简中
繁中
English
日本語
한국어
ภาษาไทย
Tiếng Việt

Prospects and problems of DeFi oracles (data failure)

PANews
特邀专栏作者
2021-10-26 09:54
This article is about 3486 words, reading the full article takes about 5 minutes
Oracles are at the core of DeFi protocols, providing critical data for their operation.
AI Summary
Expand
Oracles are at the core of DeFi protocols, providing critical data for their operation.

Recently, BeinCrypto, a well-known overseas blockchain media, published an article titled "Promise and Problems of the DeFi Oracle — When Data Fails》The article introduced in detail what oracle machines are, the types of oracle machines, and discussed the prospects and problems of DeFi oracle machines, and interviewed Kevin Tai, co-founder of the cross-chain synthetic asset protocol Linear Finance (LINA) in it. The following is the full text translation for reference.

Decentralized finance (DeFi) has grown rapidly in the last year, with a variety of protocols and projects emerging. They all rely on the ability of code to replace trust, but what if the data fails?

In the world of traditional finance, we generally rely on the banking system as an intermediary to carry out our business. There are also various businesses that form a network with banks to provide services to consumers. Industries in which these businesses operate include investment, credit, money markets, lending, and insurance.

Therefore, the trust in these enterprises and banks is the top priority. Customers deposit money and trust that the deposit will be safe and sound. The law imposes obligations on banks to ensure that funds are in accounts.

secondary title

A brief reintroduction to smart contracts

The Ethereum blockchain is where most of the DeFi protocols reside. Smart contracts are programs deployed on top of this blockchain.

The code of the smart contract allows financial transactions to be executed independently based on the conditions and rules specified in the smart contract code.

secondary title

The Vending Machine Metaphor

In 1997, computer scientist Nick Szabo proposed the vending machine analogy for smart contracts.

He explained that as long as the input information is correct, you can guarantee certain specific output results, just like a vending machine, you enter money and the correct amount, and you can get the snack you want.

A software program specifies the logical relationship between input values, actions, and output values. Anyone can write a smart contract and deploy it on the network, but smart contracts consume gas. According to Chainlink statistics, more than 90% of smart contract applications require some type of external data in order to be useful.

Currently, application programming interfaces (APIs) provide access to real-world data. These APIs contain information/mysteries of how the real world works. Without this data, smart contracts can only have limited on-chain applications.

Financial smart contracts require market information for settlement; insurance-related contracts require data from IoT nodes as well as network data to determine when, where, and to pay for water.

secondary title

What is an oracle?

Oracles provide a trusted, off-chain, real-time source for the data smart contracts need to perform operations on the blockchain. This real-time data is provided by the API. Could be provided by companies like Coinbase or Binance.

Blockchains are built entirely on determinism. Consensus is the method by which the blockchain reaches agreement on the state of data values ​​after a transaction. If one traces all transactions from the first block of the chain up to the current chain, one will find that the state of the blockchain after the last block was added is the same as the state of the blockchain after the first block was added .

Sometimes, when using an API, each node on the blockchain may be in many different states, depending on how the API interacts with the corresponding node. Therefore, obtaining data through API has implications for determining data on the blockchain. This is where oracles come into play.

The oracle machine inputs data to the blockchain through external transactions, ensuring consensus on the blockchain. The oracle will interface with the API and report it as a transaction on-chain.

This makes oracles crucial to the process of executing and securing smart contracts. Oracles query and discriminate the authenticity of external data used to mobilize the state of smart contracts, and sometimes even verify the data itself, although this is not a common case.

Kevin Tai, co-founder of Linear Finance, said, “Price feeding is very important for many agreements, and DeFi oracles are one of the lifelines of the agreement because they provide high reliability and real-time price data, which helps the platform to be more efficient and more reliable. The operation of the letter."

secondary title

Building Consensus on the Blockchain

However, oracles are not perfect, nor are they inscrutable. The premise of the blockchain is decentralization, eliminating the failure of the central point. Such failures often come from institutionalized third parties.

Use oracles to get data from often centralized sources. Oracles seem to defeat the entire reason for using blockchains. If the centralized oracle is hacked, the data delivered on-chain may be incorrect, causing the smart contract to give very different results.

Consider Szabo's vending machine analogy. Suppose the vending machine enters a more expensive amount than the actual item deposited. In that case, it will make the selling price higher, resulting in a deviation in the amount of inventory and coins in it.

secondary title

Various oracle options

The above examples also highlight the oracle situation that currently exists. Each iteration has varying degrees of centralization. These iterations include centralized oracles, distributed multi-signature oracles, DPoS oracles, market prediction oracles, and decentralized oracles.

Centralized oracles are provided with data by a single third party. This makes it fast for speed acquisition, but there is a risk of central point failure. If a third party deletes data or goes out of business, the smart contract may have no data available.

The distributed multi-signature oracle machine provides smart contracts with data from multiple whitelist sources, on which various central tendency statistical operations (median, arithmetic mean, geometric mean, etc.) are performed. However, this can still be manipulated.

The DPoS oracle system provides data through whitelisted pledge nodes. However, if an oracle gives poor quality data, they risk losing their stake. They are incentivized to provide good data, but must prevent collusion between nodes.

The market prediction oracle machine is where participants vote for the correct result by betting. If 51% of the participants are honest and don't want to lose money, it can run smoothly. Compared with centralized oracles, this is less likely to cause data manipulation.

However, in the case of staking, the oracle could be bribed to become a user itself and manipulate the bets to their own advantage.

secondary title

Several important cases of oracle failure

There are several well-known incidents caused by accidental smart contracts where the oracle provided data problems.

In November 2020, the DeFi exchange Compound lost $89 million due to a liquidation operation executed by a smart contract (loans were sold at a discount).

The Compound platform lets users lend cryptocurrencies to other people. To borrow cryptocurrencies, users must submit collateral whose value is greater than the loan amount. If the blockchain notices that the collateral is suddenly undervalued, the smart contract forces the loan to be liquidated.

In Compound’s case, the number one factor leading to liquidations was data fetched from the oracle CoinbasePRO. The oracle sends $1.3 of the DAI price to the smart contract. The normal price should be around $1.

To understand what causes a liquidation, we can look at a hypothetical scenario. If someone takes out a $100 loan when DAI is $1, and the value of DAI suddenly rises to $1.3, the loan amount grows to $130. If the person is over-collateralized, that is, the collateral is higher than the loan amount, such as $125, then the person will also be liquidated.

secondary title

Lessons from Synthetix

Another example is the oracle failure incident in 2019, which affected the DeFi platform Synthetix. Losses due to incorrect data reporting were in the $1 billion range.

Synthetix allows users to obtain the price of assets outside the general crypto space, such as fiat currencies. The platform relies on multiple off-chain oracles with regular on-chain updates for aggregated fiat price data.

In June 2019, one of the off-chain oracles providing data for the South Korean Won reported an incorrect price. The wrong price is 1000 times higher than the real price.

Since there are only two price oracles providing prices for the Korean won, the data is aggregated between the oracles to reduce the impact of outliers. Therefore, the aggregation fails to address the excessive price close to the actual price.

secondary title

The future of oracles

Despite some oracle failures in this space, oracles still play an important role in the broad and diverse uses of smart contracts.

“Oracles are challenging and expensive to build and maintain, but we as an industry cannot exist without them,” said Leo Cheng, co-founder of CREAM Finance.

Although it is difficult to predict where the DeFi field will go, optimizing the degree of decentralization of the oracle machine will be a good guess. This is attractive because it is consistent with the core values ​​of DeFi and can also somewhat eliminate the problems found in the current field.

Currently, these oracles are slow, expensive, and difficult to implement. This is because it is very difficult to decentralize the process and allow off-chain data to reach the on-chain.

However, these issues are expected to be gradually resolved over time. In the end, the security and experience of DeFi will be improved, and DeFi will gradually enter the mainstream.

DeFi
Welcome to Join Odaily Official Community