Blockchain Oracles in DeFi

We need to take a step back to understand blockchain oracles and why they are created. Oracles are problem solvers for many smart contracts launched on blockchains. 

But what is a smart contract, and what problem do oracles need to solve? We will start by answering these two questions and then explain how they solve problems for the DeFi space.  

Blockchain Oracles in Brief

Blockchain oracles are complicated computerised systems that connect data from the outside world (referred to as ‘off-chain’) with a blockchain (or ‘on-chain’).

Blockchains, Cryptos, Smart Contracts, and a Problem

The majority of blockchains have their own native cryptocurrency that is used to transfer value, enable the protocol’s operations, or to facilitate governance. Some blockchains (the most well-known being Ethereum) can also be used to build smart contracts. These are blockchain based self-executing contracts with the terms of the agreement between two or more parties, usually a buyer and seller, being directly written into lines of code. 

Smart contracts will execute predetermined actions automatically when defined conditions are met, and by being built on the blockchain, they are traceable, irreversible, and unchangeable (immutable). These smart contracts are executed ‘trustless’, not requiring a third party, and if written correctly, can be designed to carry out nearly any contract imaginable

If a buyer wishes to purchase a home with cryptocurrency, a simple, smart contract could be written for the transaction. It would say something like the following, ‘If the Buyer sends the required funds to the Seller, then the deed of the home at X location is transferred from the Seller to the Buyer’. 

When the conditions of the smart contract are met, it is irreversibly executed in accordance with its programming. There is no need for traditional third parties to initiate, manage, or execute such a contract.  

There is, however, a problem with this system. Blockchains need a way for smart contracts to be able to use external off-chain data so that the smart contracts can have applications in the real world. 

With the real estate example above, off-chain data may include proof of successful payment or the evidence of a deed receipt. Because blockchains are generally self-contained, the connection to the real world is a problem; this is where the problem-solving nature of oracles comes into play.  

Oracles Connects Blockchains to Off-Chain Data

Oracles provide a way for a blockchain and its smart contracts to interact with off-chain data.  Oracles are similar to another computing system, an application programming interface (API), but to the world outside the blockchain. 

There are several instances where real-world data must be communicated to a closed on-chain system. This data is critical when smart contracts rely on real-world events to execute correctly. 

Crypto oracles will query, verify, and authenticate the needed external data and then relay it to the closed blockchain system. This authenticated data will then be used to validate the smart contract.  

Inbound and Outbound Oracles

Oracles will generally establish two-way lines of communication with a blockchain; data that can be sent inward to the blockchain or outward. While outbound oracles can provide information from the blockchain to the real world, inbound oracles that bring into the blockchain off-chain data remain much more common. 

This imported information can be from nearly any source, asset prices and their fluctuations, proof of payments, weather conditions, flight information, pollution measurements, sports scores, and so on.

A common example of an inbound oracle in the form of a smart contract would be written as follows, ‘If asset A hits the defined price P, then place a buy order of U units’. 

An outbound oracle could be used when a smart contract’s conditions are fulfilled on-chain.  For example, a simple smart contract could be created that will unlock a web-enabled smart lock on a real-world storage unit. Once the correct amount of cryptocurrency is received as a payment to a defined crypto wallet, the unlock signal is sent to the real-world lock.  

Software and Hardware Oracles

The majority of crypto oracles are processing digital information, but not exclusively. Software oracles provide data from digital sources, such as servers, websites, and databases.  

Hardware oracles, on the other hand, deliver data directly from the real world. Software oracles can provide real-time information, exchange rates, flight information, pricing information, and the like. Hardware oracles can provide data from video cameras, weather monitors, barcode scanners, and similar. 

The Centralised Oracle Problem

Centralised oracles are under the control of a single entity, and these tend to be the sole providers of information to a smart contract. This system requires that the participants of a smart contract place a significant amount of trust in this single entity. 

A centralised oracle also means that there is a single point of failure, having no redundancy.  This point of failure threatens the security of a smart contract if the connection to the oracle or the oracle itself becomes compromised. The smart contract’s effectiveness and accuracy depend heavily on the data provided. Therefore, centralised oracles retain a tremendous amount of power over smart contracts.  

The reason that smart contracts were invented in the first place was to avoid counterparty risk and reliance on a third-party intermediary. Oracles allow contracts to be performed between trustless parties, but the more centralised they are, the more risk they bring with them, and they become the middleman they were intended to replace. 

This is known as the oracle problem, and it means that the preservation of fairness, security, and privacy, along with the avoidance of over-centralisation, which ultimately damages the relationship between blockchains and their smart contracts.

Decentralised Oracles

Decentralised oracles achieve a trustless and deterministic result that relies on cause and effect rather than a single relationship. We view this as a clear step in the right direction, as blockchain networks operate by distributing trust among multiple participants.

By combining many different data sources and creating an oracle system that is not controlled by a single entity, a decentralised oracle network has the potential to provide smart contracts with increased levels of security and fairness. 

Because centralised oracles can become compromised, many blockchain projects, such as Chainlink, MakerDAO, Band Protocol, and Augur, are or have already developed decentralised oracles. 

Oracles and DeFi

Oracles are used in decentralised finance (DeFi) applications for the same reason, to bring external data onto blockchains, which are then used to execute smart contracts. 

For example, consider a DeFi application with a smart contract programmed to trade cryptocurrency based on a major exchange price. In order to execute this contract, the smart contract needs access to the current price of the cryptocurrency. This data can be provided by an oracle, which fetches the current price from the exchange’s API and feeds it into the smart contract. 

The use of oracles in DeFi applications allows for the creation of very complex financial instruments and applications that are based on real-world data and events, bringing greater functionality and flexibility to the DeFi space.  

Because oracles are responsible for providing external data to smart contracts, it is crucial that the data they provide remain accurate and safe from tampering. Many DeFi applications use multiple oracles and require that they come to a consensus on the data provided.

In our currency trading example above, the exchange API is a single source. If there are multiple decentralised sources obtaining the same price info to gain a consensus, then this could be a decentralised DeFi oracle, automatically more trustworthy than a single API.

Closing Thoughts

The blockchain oracle is the problem solver, bringing external real-world off-chain data on-chain and vice versa. With oracles, smart contracts can expand their functionality, especially useful for the DeFi space, where these enhanced smart contracts create advanced financial instruments. 

When oracles are decentralised, they become even more trustworthy, making them a fantastic option for creating cheap and reliable smart contacts that no longer require a trusted third-party intermediary. As more oracles are created, bringing a more comprehensive array of data sources on-chain, smart contract use should also expand. 

Smart contracts may well turn into the solution that creates mass crypto acceptance.

Disclaimer: The information provided in this article is solely the author’s opinion and not investment advice – it is provided for educational purposes only. By using this, you agree that the information does not constitute any investment or financial instructions. Do conduct your own research and reach out to financial advisors before making any investment decisions.

The author of this text, Jean Chalopin, is a global business leader with a background encompassing banking, biotech, and entertainment. Mr. Chalopin is Chairman of Deltec International Group,

The co-author of this text, Robin Trehan, has a bachelor’s degree in economics, a master’s in international business and finance, and an MBA in electronic business. Mr. Trehan is a Senior VP at Deltec International Group,

The views, thoughts, and opinions expressed in this text are solely the views of the authors, and do not necessarily reflect those of Deltec International Group, its subsidiaries, and/or its employees.