Search Featured Websites:
Feature your business, services, products, events & news. Submit Website.


Breaking Top Featured Content:

Oracles: The Invisible Backbone of DeFi and Applied Blockchain Apps

Brainstorming

You may be deceived if you trust too much, but you will live in torment if you don’t trust enough.

Frank Crane

A smart contract is software code that runs on a blockchain network, such as Ethereum, and performs actions or tasks based on certain events. Suppose I wanted to make a transaction where I provide the receiver’s address and proof that I have and own the funds to the network. Provided everything checks out, the network will ‘transfer’ the funds to the receiver.

What if I wanted to create a decentralized application that needed external data such as the current weather temperature, the price of Ethereum, or even the results of a baseball match?

How does a smart contract, or, in other words, a piece of code on a blockchain, get this information? This is where oracles for blockchain applications come in.

https://woj.finance/

The term Oracle literally means a reliable source of information. So, a dictionary could even be considered an Oracle. However, we want to avoid unreliable information, so we introduce redundancy. However, we also consider gas fees. The gas fee for 3 external sources of data is 3x the normal gas fees. As such, we can take an average or pick a median.

What is an oracle?

An oracle can be regarded as an off-chain platform that relays data on-chain. It is also an off-chain platform that connects blockchains to other systems. Relaying data from web servers to the blockchain is the duty of Oracles. Most decentralized applications, apart from DEXes, use Oracle.

In order to have reliable data and avoid a single point of failure or to guard against a rogue Oracle node, we sometimes choose to have redundancy. We introduce more nodes. For instance, if we want to take collateral against a Defi loan, we would like to have multiple sources for the price of ETH where the borrower deposits ETH as collateral.

Oracle helps to relay off-chain data

Smart contracts on a blockchain cannot simply pick information from any data source like a web server because all nodes need to have the ability to independently validate the outcome of running a smart contract. When this happens, it is very likely that they would get different results.

For instance, the price feed of Bitcoin would be different on different exchanges. Even checking the same source at different times can give different results. How do we know which figure is accurate or which one to choose? Often we go with redundancy and pick the outcome of the majority.

What are the types of oracles?

We classify oracles based on three points: the source of the information, the direction of the information, and the level of trust.

The source of the data can either be hardware or software. Hardware oracles collect data directly from the physical world and convert it to digital values that can be fed into smart contracts. These include barcode scanners and sensors that collect data actively or passively and transmit it to the smart contract.

Software oracles get information from online sources, browsing their websites and thereby providing the most up-to-date information to the smart contract. For blockchains, this information usually comes from cryptocurrency exchanges.

The direction of information can be either inbound or outbound. While inbound oracles allow the network to send information from external data sources to smart contracts, outbound oracles permit smart contracts to send data to external sources.

Centralized oracles function as a single entity providing data from an external source to a smart contract operating with a set of security features. However, because there is only a single node responsible — similar to the traditional financial system where there is a single point of failure — it becomes less secure and more vulnerable to being corrupted and attacked by malicious data being fed into the smart contract.

Decentralized oracles, on the other hand, rely on multiple external sources to increase the credibility of the data provided to the smart contracts. Decentralized oracles work on the Schelling points game theory in which all participants provide data without colluding with one another, and the Schelling game determines whether the consensus data point or amendments proposed to the software are valid and acceptable, after filtering for any inaccuracies.

Trusting Oracles

To be trusted is a greater compliment than being loved. George MacDonald

It has been a source of concern that we need to trust an oracle due to a single point of failure. The essence of blockchain is to eliminate the need to trust an intermediary and do away with single points of failure. We can remove this concern by having multiple independent oracles form a consensus.

This has led to the creation of oracle services that obtain information from a variety of sources. Such sources include large corporations like Google, Amazon, and other organizations like weather stations. This ensures that results are more reliable than if they came from a single source.

Provable is an oracle service that helps developers when they have a need to consult a reliable source of data outside the blockchain. It provides a cryptographic guarantee that the data is authentic.

Should you use oracle services or data feeds?

There is a large number of data feeds on the internet. As a result of this, it becomes a challenge for individual applications to integrate directly into the data feeds. This is where oracle services are helpful. They abstract the information coming from both sides and make it easier for applications to get the data feeds they need.

DeFi protocols using oracles

Open lending/borrowing protocols such as MakerDAO, Compound and Aave use oracles to fetch external data while running on the Ethereum blockchain. MakerDAO is among the most popular DeFi open lending protocols, and its Dai token is pegged to the U.S. dollar and backed by crypto assets.

MakerDAO utilizes an oracles module to determine the real-time price of assets. The module is composed of whitelisted addresses of oracles and an aggregator contract. The oracles send periodic price updates to an aggregator that determines a median price, which is then used as a reference price on the platform.

Compound is a money market protocol that allows users to earn interest and/or borrow assets against collateral. Similar to MakerDAO, Compound also uses oracles to gather price information that is then forwarded to its price feed, which is managed and controlled by “administrators” that are holders of Compound’s native token, COMP.

Flash Loans and the need for Tamper-Proof Oracles

Like the concept of yield farming, there is a new liquidity mechanism that has emerged in decentralized finance (DeFi). It is called flash loans. Flash loans enable users to borrow assets from an on-chain liquidity pool with no upfront collateral as long as the borrowed amount of liquidity, plus a small fee, is returned to the pool within the same transaction.

This innovative design increases access to capital for all users in a variety of use cases while ensuring the full, continuous solvency of the underlying liquidity pool.

For a short period of time — the span of a single transaction — a flash loan can make anyone a very well-capitalized actor, providing access to hundreds of millions of dollars in liquidity.

This creates unique opportunities for arbitrage, collateral swapping, and the creation of leveraged positions, but it also creates certain risks, especially for a nascent ecosystem of protocols with varying degrees of decentralization and security. These risks should be understood by smart contract developers so more robust applications can be built for users.

Flash Loans and Price Oracle Attacks

Protocols that fetch prices from a single source are easily exploitable by malicious actors with a large volume of funds who can manipulate the market with one large trade.

Because flash loans can provide instant and sizable liquidity to anyone in the world, at any point in time, they have increasingly been used to fund attacks on DeFi protocols. However, there is a key distinction to be made here: flash loans only provide funding to execute attacks — the real issue at hand is centralized price oracles that do not offer adequate market coverage.

This article isn’t financial advice and I am not a financial advisor. Do your own research before making any investments.

Thank you for reading!

I truly appreciate everyone that took the time to read my article! I would greatly appreciate everyone’s supports. Each user can clap an article up to 50 times per day!

If you enjoyed reading this, please use all 50 claps! 🙂

Thank you so much.

Check out our new platform 👉 https://thecapital.io/

https://twitter.com/thecapital_io


Oracles: The Invisible Backbone of DeFi and Applied Blockchain Apps was originally published in The Capital on Medium, where people are continuing the conversation by highlighting and responding to this story.

Feature your business, services, products, events & news. Submit Website.