The Importance of Oracles in Decentralised Finance | Hacker Noon

Author profile picture

@btcreadCharles J Read

Bleeding Edge Technologist, Futurist, and Growth Hacker.

Most of the common blockchain audience has by now heard of DeFi, and the implications it has to those who know how to utilise it – but one thing that hasn’t been greatly explored is Price Oracles and their impact on these applications.

An oracle is a third party service that provides smart contracts with the data they need to execute, usually in relation to price.

I’ll take a look at some of the popular DeFi projects and the oracle system that they’re using, the pros and cons of them, before exploring some emerging solutions, and my suggestions on how to build a fair oracle/data retrieval ecosystem.

Traditional financial systems require intermediaries and therefore have single points of failure. They are easily corrupted, subject to fraud, security issues, and more. Smart contracts and decentralised networks gave us an opportunity to rebuild those systems in a universally accessible way while improving the traditional financial products built atop of them – particularly around lending and borrowing.

DeFi gives us new transparent systems that don’t rely on intermediaries.

One of the common themes of DeFi products is hybrid protocols that eliminate volatility while offering the benefits of decentralised networks. This is done by connecting crypto-assets to traditional assets, particularly those that are backed or related to a dollar peg.

Most notably MakerDAO, which uses this hybrid system to maintain an average peg of $1 – and requires volatile assets to be locked to mint the DAI ($1 token).

There are other hybrid systems that use concepts like supply elasticity, in the case of Ampleforth or the now distant memory of Base Protocol. They respond to changes in demand by adjusting circulating supply through a Rebase mechanic.

The intention with rebasing is to constantly rebalance demand with circulating supply which should result in a more stable price, but in a mania, as we recently experienced, this doesn’t quite work. Ampleforth soared to all-time highs, and because of so many positive re-bases (token airdrops to holders) when it was time to come down, it came down very hard and fast.

Oracles are the foundation of the entire ecosystem, as all applications depend on accurate data.

Compound is another DeFi product that allows the borrowing and lending of assets through collateral, adjusting interest rates based on demand on the borrow/lend side.

The Compound network is governed by COMP holders who can vote on its future through a proposal system – the more tokens you hold, the larger your votes. This has interesting implications depending on the number of administrators.

It sometimes calculates an average value of the oracle reports, and if there are not many administrators offering data, this could calculate an incorrect price, resulting in a big impact on many borrowers/lenders.

ChainLink has been a clear winner with the rise of DeFi products.

They’ve seen a meteoric increase of the use of their oracles over the last 18 months, and are currently utilised by some of the biggest DeFi teams in the world, including Kyber Network, Fulcrum, Opium Network, Synthetix and many more. The key benefit of ChainLink is that it uses multiple oracles to get a price.

Bzrx recently suffered a fault because it relied on just one oracle, which was Kyber Network for its price feed. This meant a sudden drop on Kyber would liquidate Bzrx positions also. By using ChainLink, the price feeds are spread and this can be prevented.

Despite that, a research report by Bowen Liu and Pawel Szalachowski of the University of Singapore showed that in the case of Synthetix ETH/USD oracle feed, there was a regular price deviation with an average of 2%.

While this can be regarded as a high standard, for now, it’s important we work towards more accurate price feeds and build more robust systems – which ChainLink are of course doing, but it’s nice to have healthy competition.

At present, most price feed oracles are deviating quite consistently from the actual correct figures.

A few percent might not seem much, but when we’re building new financial systems with lending/borrowing, liquidation events, and interest rates, we need accurate data.

The notorious “Flash Loans” or rapid liquidations that happened on DeFi products were usually related to price oracles!

If I had a DeFi product which only pulled the price of say, BAT (Basic Attention Token) from one exchange, and people were borrowing against the price of BAT, it would only take one significant sell on that said exchange to liquidate any leveraged BAT position.

By using multiple feeds and aggregates, the risk is significantly reduced from bad actors with the ability to move markets quickly.

There are some new contenders in the DeFi Oracle Space.

DIA, pitched as an ecosystem for open financial data in the world of smart contracts, offers multiple price feeds and can scrape data from many sources, including exchanges, blockchains, the European Central Bank (ECB) FX rates, International Token Identification Number (ITINs), SONIA, SOFR & €STR Overnight Rates.

They aim to be “A Wikipedia for Financial Data” meaning the community can vote on the quality of data, in an open-sourced way, rather than a central committee. DIA does not curate, source, and validate data internally, but instead through its stakeholders, using crypto-economic incentives and staking of its governance token. This design results in greatly increased transparency. It’s a bottom-up system for cleaning, aggregating, and delivering financial data both to an API and an Ethereum oracle system.

The database layer is able to handle all different kinds of data streams, including high-frequency trading APIs, through to data that is never changed and accessible in a high-performance key-value-store.

What makes DIA interesting is that it supports a diverse range of traditional financial data as well as crypto market data, in a customisation way that allows you to create your own price feeds dependent on your requirements. DIA provides a reliable and verifiable bridge between off-chain data from various sources and on-chain smart contracts.

The former referenced paper by Bowen Liu and Pawal Szalachowski suggests a lack of transparency in the current oracle systems used by applications like Synthetix and Compound. It makes it difficult to detect malpractice and

When asked directly during a CryptoDiffer AMA what makes them different from their competition, Paul Claudius of the Dia Data team said:

We are not another data silo with difficult pricing models, instead we focus on a Wikipedia-style approach where everyone can participate and assess the work of the community for the community. We provide incentives to data providers and to members of the community diving into data sources by our governance token.

Over the next few months, it will be transitioned to a DAO that is run by the community. The team (and wider community) can then begin to build DeFI products atop of the data ecosystem using the price feeds that will be constantly audited by the community.

But What Makes A Good Oracle? Some Considerations…

I guess the natural transition here is to talk about what makes a good oracle, and how we can build better systems. These aren’t all of the factors but should give you a good understanding of where we should be heading.

Governance

  • Internal vs External: Is the oracle specifically made for this protocol/application, and thus subject to its community’s governance, or is a ready-to-use oracle system from a third party used?
  • Choice of Calculation: Who chooses the methodology for calculation of oracle values? The models generally differ, as I explored earlier there are risks to having admins or vote hoarders determine oracle logic. Can the user choose between several on-chain feeds and aggregate them? 
  • Oracle Changes: How are changes to the oracle itself decided? This includes the issuance of new contracts, changes of aggregation methodology, and in some cases complete removal of some sources. Some oracles require “admins” to make decisions. Is this fair?

Transparency

  • Data Sources: Is transparent documentation easily retrievable about what data sources are being used to generate the oracle feed? Sometimes this info is found in a whitepaper, but live data is often missing.
  • Methodology: Is the exact methodology of calculation methods, data sourcing and aggregation easily retrievable and documented? There is usually vague information available.

Operational

  • Data Frequency: How often is the oracle updated? Markets move fast.
  • Data delay: What’s the delay of the measured data point until it reaches the oracle feed?
  • License tracking: Is information about the licenses of the underlying raw data available? (e.g. exchange data feeds for prices)
  • Gas Model: Who pays for the gas to maintain the oracle?

There are more considerations, but when choosing an oracle feed for your project, these are great starting points. It’s worth keeping an eye on the oracle ecosystem as it is subject to more scrutiny during the rise of DeFi apps – after all, they require accurate and reliable data. Otherwise, people could lose a lot of money.

I’m confident in the direction the oracle space is heading – but I encourage people to really understand the impact oracles can have, and which oracles the applications they’re using are reliant on.

Tags

The Noonification banner

Subscribe to get your daily round-up of top tech stories!

read original article here