Topics Blockchain
Bybit Learn
Bybit Learn
Intermediate
30 Th08 2022

What Are Blockchain Oracles & Why Do We Need Them?

One of the most challenging parts of managing any blockchain is handling the division between off-chain and on-chain data. An oracle is a useful tool that makes it easier to connect real-world information with blockchain activities. With oracles, users have countless ways to make blockchains useful in their day-to-day life. Interested in learning more about these fascinating systems? Here's what you need to know.

What Are Blockchain Oracles?

Blockchain oracles are computerized systems that send outside data to a blockchain. The blockchain can then use this data to automatically complete transactions.

Oracles are a third-party service that function as both a type of connection and a type of automation. They take any sort of real-world data, like temperatures, deed transfers or prices of other cryptos, and communicate this data to the blockchain. Oracles can then tell the blockchain to enact a smart contract based on this data.

Oracles come in many forms. They can transmit data to and from the blockchain, and they can work on both hardware and software. Many oracles are decentralized, but some tasks also require centralized oracles. This makes oracles a very flexible tool for blockchain users.

How Do Blockchain Oracles Work?

Blockchain oracles are third-party computerized systems, so not all oracles have the same exact mechanism. However, the majority of oracles rely on the same basic concept. They function like the blockchain version of an API. Instead of being part of the blockchain or the data source itself, oracles are a layer that work alongside the blockchain. This layer queries an external data source for desired information.

Once that information is authenticated, the oracle sends the verification to the blockchain. After the information is within the closed blockchain system, it can be used in a variety of ways. Typically, the blockchain is instructed to automatically validate a smart contract after certain data is present. Oracles can also be used to send information from the blockchain back into the real world, or perform other types of transactions and blockchain activities.

Why Are Blockchain Oracles Important?

Blockchain oracles are an essential part of most blockchain applications. They're important because they function as a bridge to pass data back and forth. Without oracles, blockchains are closed systems that cannot change and react to external events. To understand why oracles are so essential to blockchain functioning, it's helpful to take a look at some of their many applications.

Applications of Oracles

One of the most popular functions of an oracle is to use cryptocurrency alongside real-world contracts. For example, let's say a person is selling a vehicle in exchange for cryptocurrency. You can set up an oracle that transfers data from the blockchain to the real world, and then use it to transfer the title as soon as the funds are sent. 

You can also use oracles for casual agreements, such as, "I'll give you ten tokens if my team wins the game." An oracle can monitor game results and transfer the tokens as soon as a winner of the game is announced.

Furthermore, oracles are helpful in managing derivatives, insurance and other risk management techniques. A farmer can use oracles to manage agricultural derivatives that provide a payout in case poor weather destroys their crop. The oracle can keep track of the weather, and make sure the farmer gets their insurance funds if a set amount of rain doesn't occur in time.

A final useful feature of oracles is that they can help with cryptocurrency investments. Blockchain oracles can keep track of cryptos, stock prices and foreign exchanges for investors, and then they can buy or sell cryptocurrency in response to these external changes. For a savvy investor, a blockchain oracle makes it far easier to keep a portfolio of diverse assets up-to-date.

As you can see, oracles fulfill all sorts of important tasks. Their ability to bridge the gap between blockchains and real-world events adds functionality to blockchains. With oracles, users can incorporate blockchains into their day-to-day lives.

Types of Blockchain Oracles

Because they have so many uses, most blockchain oracles are quite distinct from each other. Oracles are usually divided into types based on how they function. It's fairly common for an oracle to fall into multiple categories, such as outbound and software. Understanding all the different types of blockchain oracles can help you find the right style for your needs.

Software Oracles

Software oracles are the most common type of blockchain oracle. They use software to connect with digital sources of information, and then pass this information on to the blockchain. Software oracles are essential for connection to things like websites, databases and servers, and they often focus on publicly available information from the internet. They're commonly used for accessing data such as flight information, exchange rates and market fluctuations.

Hardware Oracles

Hardware oracles tend to require some extra setup because they involve other pieces of equipment. A hardware oracle uses items such as RFID sensors, barcode scanners, motion sensors or thermometers. They relay the information these sensors collect to the blockchain, where they can be used for smart contracts. These oracles are complex, but useful because they directly translate real-world situations — such as the arrival of a truck at a loading bay — into a smart contract on a blockchain.

Inbound Oracles

When discussing inbound and outbound oracles, people are referring to the direction of the information flow. An inbound oracle is one that brings real-world information onto the blockchain. These are typically the most useful sort of oracle, because they help to use real-world situations and external data to affect how a blockchain is functioning.

Outbound Oracles

Outbound oracles function in the opposite manner. Instead of bringing external data to the blockchain, they take blockchain data and send it to another system. Depending on the way the oracle is set up, you can even instruct other systems (such as a banking network) to perform a task based on information from the blockchain.

Centralized Oracles

Centralization can refer to both the controlling entity and the sole source of information. An oracle can be called centralized if a single person or group sets up all of its information sources and actions. The oracle is also centralized if it’s only collecting data from a single source. Some degree of centralization is inevitable in most blockchain oracles. However, centralization can be risky, because a single piece of bad information, or a single malicious actor, can harm the whole system.

Decentralized Oracles

Decentralization can reduce some of the risks of oracles because the blockchain oracle is able to function without having to trust that all parties are accurate and acting in good faith. However, implementing decentralization in an oracle can be challenging. Decentralized oracles need multiple network participants to achieve consensus before creating smart contracts, and they can also benefit from having many different data sources. To create a truly decentralized oracle, it can be necessary for a third-party blockchain to manage the oracle.

Contract-Specific Oracles

Many oracles are set to handle repeating actions and continuous streams of data, but contract-specific oracles are designed specifically to manage a single smart contract. They can be helpful in situations such as completing a real-world contract with blockchain funds. However, setting them up can be a little tedious, so they're not ideal for recurring events.

Human Oracles

Technically speaking, even a human can function as an oracle. However, human oracles are usually more than just a person reading the news and making a change in the blockchain. Instead, they tend to be people with specialized knowledge in technological, financial or mathematical fields. Human oracles can verify information on a much more nuanced level, so they can be very helpful.

Computation Oracles

These oracles tend to have both an inbound and outbound aspect. A computational oracle typically receives data from the blockchain, computes it off-chain and then inputs the solution back into the blockchain. This can essentially be a way of using oracles to compute off-chain data solutions and save money on gas fees.

Solving the Oracle Problem

When discussing blockchain oracles, "the oracle problem" comes up quite a bit. This problem occurs when an oracle is compromised and results in the smart contract — depending on the oracle — becoming compromised as well. This is usually the case with centralized oracles, as they’re controlled by a sole entity and are the only data source for a smart contract. 

Smart contracts were designed to eliminate counterparty risk, and to facilitate transactions without over-reliance on third parties. Oracles allow these smart contracts to be enacted between trustless parties. However, overly centralized oracles represent a single potential point of failure. Thus, any compromise in data integrity to the oracle will result in a loss of privacy, security and fairness — key features that were supposed to be protected with the use of oracles.

As such, the oracle problem is a key challenge that remains to be completely solved.

Use Cases of Blockchain Oracles

In their role as a bridge between blockchains and off-chain data, blockchain oracles have many exciting uses. As they become more common, they have the potential to change the way many blockchain-related industries are run.

DeFi

Oracles are absolutely vital for any serious decentralized finance (DeFi) system. The whole ethos of DeFi is focused on the idea of providing financial services without allowing any one financial institution to control those services. In order to do this, blockchains must interact with information outside of their network. Blockchain oracles make it possible to use crypto for everything from buying a home to managing retirement. Since blockchain oracles act as a bridge, they let real-world information be the guiding factor in smart contracts. Any time you use cryptocurrency to do things like receive payment for an item or seek a loan for a car, oracles are an essential tool.

DApps

The usefulness of oracles is especially apparent when it comes to decentralized applications (DApps). DApps are helpful software that allow the average user, who has little technological knowledge, to interact with the blockchain. They provide daily services while still giving users ownership over their own data. You can find DApps for everything, from insurance products to financial prediction markets to social media. Oracles have expanded the capabilities of DApps far beyond their original uses. With blockchain oracles, it’s possible for DApps to work in a much broader range of situations.

NFTs

As NFTs become more common, there have been challenges associated with linking them to off-chain actions. NFT enthusiasts typically use the blockchain to register assets and trade them. However, they can run into problems when they want to start using off-chain data. For example, consider sports-based NFTs. If you want to print a digital football card for players who score a set number of goals, do you have to do it manually? Using oracles makes it much quicker to create NFTs linked to certain real-world events.

Benefits of Blockchain Oracles

No matter how they're used, blockchain oracles come with a lot of perks. Here are a few of the main reasons that blockchain oracles are becoming so popular.

Adds Extra Functionality to the Blockchain

As you've seen, the main benefit of a blockchain oracle is that it connects the blockchain to the outside world. Oracles give blockchains the external data needed to perform more complex tasks. Instead of a blockchain being limited to a single network, an oracle allows it to interact with external data. Thus, you can use the blockchain for everyday activities like buying, selling, betting and investing.

All of this additional functionality is the main reason why so many people are starting to use oracles. They make it easy to use blockchains for everything from saving for retirement to creating DApps and NFTs. When you’re able to use blockchains for daily tasks, they become very flexible, powerful tools.

Flexible Parameters Provide Countless Applications

Since oracles come in so many styles, they're endlessly flexible. You can design an oracle to perform just about any task you want. Depending on your needs, an oracle can repeat an action or just perform it once. The oracle can passively report, or it can take actions in the blockchain for you.

This flexibility is a huge part of why oracles are so popular. You can use them in a variety of situations and easily tailor them to your needs. Unlike many other blockchain tools, even the most detailed, specific oracle is fairly simple to set up.

Saves Time and Effort

A big advantage of oracles is that they don't require you to manually make transactions on the blockchain. Instead of sitting around and performing various tasks at the right time, you can let oracles handle things for you. Once an oracle is set up, it can execute smart contracts in reaction to an external trigger.

This essentially makes oracles a loose form of automation. Though they can't manage complex, nuanced situations, they can perform simple transactions without requiring your constant oversight. You can set up an oracle to do things like buy tokens when a crypto falls to a certain price, or tell the blockchain to generate a new NFT for every user in a game.

Risks of Blockchain Oracles

Though blockchain oracles are a great solution to “the oracle problem,” they're not entirely perfect. There are some potential downsides to be aware of when considering whether or not you want to use a blockchain oracle.

Incorrect Data Can Lead to Big Errors

In general, blockchain oracles are reasonably secure. However, your oracle is only as reliable as the data it consumes. If your oracle gets the wrong information — due either to innocent mistakes or malicious actions — it can end up making unfavorable decisions.

Consider an oracle that buys and sells agricultural derivatives based on temperature. What happens if the oracle is using a random, poorly designed website, and someone hacks the website to input the wrong data? This is a major point of vulnerability that can cost oracle owners a lot of money. To remain safe, it’s essential to use only secure, reliable data, and stopgaps in case the unexpected happens.

Introduction of Third-Party Players

An oracle is never built directly into a blockchain. Instead, it’s a third-party process that requires a user to work with a provider, who then connects them to the blockchain. Adding these sorts of middlemen can cause problems with centralization. The whole goal of decentralization is to put power directly into the hands of users, but most oracles are run by single entities. This gives a lot of control to potentially problematic parties.

For example, what happens if Chainlink, the largest provider of blockchain oracles, gets purchased by a financial institution? You could potentially end up once again putting a big, bureaucratic organization in charge of your finances. There’s also a chance that an untrustworthy oracle could act maliciously once they gain access to your crypto accounts or other assets. Users can mitigate these risks by selecting trusted oracles and working with decentralized oracle providers that are based on blockchains themselves. However, adding any other party to your connection with a blockchain invariably comes with some risks.

Examples of Blockchain Oracle Projects

Blockchain oracles are a relatively new concept, but they're already making waves. In the few years since their introduction, blockchain oracles have been involved in a lot of exciting projects.

Augur

Augur is a market prediction platform based on Ethereum. It’s essentially a decentralized betting platform that lets users create a market for any concept. People can bet on the concept, and then instantly receive funds if they’re correct. Augur is frequently used for things like sporting games and political outcomes — and oracles ensure that users get their payouts in a timely manner.

Wrapped Bitcoin 

Wrapped Bitcoin is an ERC-20 token with a one-to-one correspondence to Bitcoin. Wrapped Bitcoin collaborates with Chainlink to regularly audit its assets, using an oracle to check BitGo custody wallets for WBTC tokens and then update the chain if there are any deviations. This protects user funds and prevents devaluation.

API3

API3 is a DAO-governed project that focuses on enhancing DApp creation. It lets users build APIs for DApps. These blockchain-based APIs are easier to operate and more affordable to scale. Ultimately, API3 is a very influential project. Its trustless applications can seamlessly interact with web-based APIs, so it can help develop a variety of other DeFi projects.

Band Protocol

Band Protocol is a recently launched platform that focuses on cross-chain data integration. The project uses oracles to help bring external data to a variety of blockchains. Its most interesting feature are cross-chain connections that use oracles to send information between different individual blockchains. Band Protocol has been especially useful in creating smartphone-based DeFi platforms.

Agoric

Agoric is an intriguing startup that received a lot of venture-capitalist interest in late 2021. This blockchain is unique because it incorporates one of the most essential programming languages, JavaScript. Agoric allows users to create smart contracts based on JavaScript for a variety of flexible and accessible contracts. The recent integration of Chainlink oracles lets developers create reusable JavaScript components that can rapidly develop applications.

The Bottom Line

With their ability to bridge the gap between blockchain networks and the outside world, oracles are a very helpful tool. They allow users to send external data to the blockchain, and to execute smart contracts based on this data. Whether you're trying to build a brand new DApp or just do a little personal investing, it's worthwhile to work with oracles.