Decentralized oracles help connect off-chain external data and APIs with sovereign blockchains. In other words, blockchain oracles provide a framework for smart contracts to access data that is not deterministic or readily available from the information contained on this chain. This data could be anything from price feed to weather reports. A real example would be a trader on Injective wishing to purchase 100 USDT worth of Tesla stock (TSLA). The spot price of $TSLA does not live on the Injective Chain but instead, it represents off-chain data that will be continuously queried from public stock exchanges via a third-party or in other words an oracle. The Injective Chain would work with a decentralized oracle in order to retrieve the TSLA price and present it to the trader. In this way, oracles act as bridges between the blockchain and the outside world.
Why are Oracles Necessary?
Smart contracts present a novel way to create new decentralized applications (DApps). However, smart contracts generally cannot access information in the real world such as data on the web or any data available through APIs.
This of course is a major hindrance to crypto adoption as a whole since data is required for nearly all facets of technology. For instance, a decentralized exchange (DEX) cannot properly calculate the amount of collateral required for a leveraged trade without first knowing about the underlying asset prices.
How Oracles Work
An oracle acts as a middleware layer between data sets and the blockchain. An Oracle makes queries to external sources on behalf of the blockchain that is connected to it. The oracle then verifies and authenticates the required data via its internal security framework and relays it to the “client” blockchain that made the request. The way this data actually enters the receiving blockchain is via an external transaction so that it can be guaranteed that all of the nodes connected to the chain share this information to verify the next transaction.
The Oracle Problem
The decisions executed by any smart contract are heavily dependent on the quality of data provided by the oracle. This makes the security of the data source(s) pivotal to the security of the chain. This is also referred to as The Oracle Problem, which remains a mostly unsolved issue. However, the type of oracle a blockchain uses can significantly minimize the risks of being compromised.
Oracles can be either centralized or decentralized. The former type is essentially characterized by the data being imported from a centrally-owned database . An example of that would be querying real-time data from a website run on an AWS server. This approach usually nullifies the advantages of blockchain technology as a single entity would control the data provided to the smart contracts. However, in some use cases, especially around information from real-world data, the use of centralized oracles is inevitable.
Decentralized oracles have significantly minimized the counterparty risks and have rapidly become the gold standard in crypto. Instead of relying on a single entity to provide sources of truth, the smart contract queries multiple oracles to determine the validity and accuracy of the data. As such, each oracle acts autonomously in a decentralized network to bring off-chain data to the blockchain.
Types of Oracles
To recap, an oracle is only as good as its data source(s). It is therefore helpful to differentiate oracle types based on the data source, the direction of information and the level of trust that they imply.
- Software oracles
- Hardware oracles
- Inbound oracles
- Outbound oracles
- Contract-specific oracles
Software oracles handle information that originate from online sources on the Internet such as databases and servers. Since this information is available online in real time via an API, software oracles can request and feed data continuously. As a result, software oracles are the most common type of blockchain oracles.
Hardware oracles refer to devices such as electronic sensors, monitors and barcode scanners that can translate events from the Internet of Things (IoT) in the real world and feed them to the blockchain. For instance, a sensor could track the weather and transmit the data onto the blockchain.
Inbound Oracles & Outbound Oracles
Inbound oracles enable smart contracts to receive data from the outside world. Conversely, outbound oracles enable smart contracts to send data to the outside world. For example, a smart lock in the outside world could be unlocked when a blockchain address receives a certain amount of tokens.
Contract-specific oracles are tailored to provide information to a single smart contract. Even though these oracles are expensive to maintain, they serve a specific use case and as such they provide developers a flexible environment in which they can tailor an oracle according to certain requirements.
Oracles have become an essential component for both internal and external communication within the open web. Today, a large network of different oracles enable functionality of many vital crypto projects. Without oracles, decentralized finance (DeFi) projects would have to rely only on the information available within their network, which would considerably limit their capabilities in the multi-blockchain future, including cross-chain trading.
For instance, Injective relies on a group of decentralized oracles to provide the most accurate prices for any financial market. The project has partnered with oracles such as Band Protocol and Chainlink in order to provide reliable sources of truth. It is crucial to note that while being decentralized, oracles are not exploitation-proof. It is therefore any blockchain’s responsibility to diversify the network of oracles it relies on to minimise the risk of failure. This is one of the many reasons why Injective contributors work closely with multiple oracle providers.
Injective is a lightning fast interoperable layer one blockchain optimized for building the premier Web3 finance applications. Injective provides developers with powerful plug-and-play modules for creating unmatched dApps. INJ is the native asset that powers Injective and its rapidly growing ecosystem. Injective is incubated by Binance and is backed by prominent investors such as Jump Crypto, Pantera and Mark Cuban.