What is an oracle in blockchain?
Think of a blockchain oracle as a mediator between the crypto and non-crypto worlds. Its goal is to send relevant data between a smart contracts blockchain and an off-chain source.
Some technicians compare blockchain oracles with middleware or an application programming interface (API) for the Web3 space. These computerized systems transfer information from non-Web3 data feeds onto a blockchain.
Blockchains wouldn't have a way of "talking" to the outside world without oracles. On their own, blockchains like Ethereum (ETH) are closed systems that only manage on-chain activity. Oracles help bridge the gap between on-chain and off-chain data.
“On-chain” simply means the data and computation that occurs on a native blockchain. For example, the transaction history on the Bitcoin blockchain is “on-chain data.” Anything that’s “off-chain” refers to data stored off of a blockchain network. For instance, data in a centralized cloud server like Microsoft’s Azure will qualify as off-chain data. The prices of stocks on the NASDAQ is another good example of off-chain data.
Developers need oracle systems to help bring off-chain information into their dApps (decentralized applications).
So what's the point of using blockchain oracles? Why would a crypto project want off-chain data feeds? Since oracles can link crypto with the external world, they open up countless use cases for blockchain technology. With oracles, it's possible to use automated smart contracts to handle many real-world transactions.
For example, a decentralized exchange (DEX) can use an oracle to track a stock’s price on the New York Stock Exchange (NYSE). This data can allow people to trade security tokens related to American companies without needing a centralized brokerage.
Blockchain oracles can also enable trustless transfers of real-world assets like property. People can set the parameters for a smart contract before transferring ownership of these assets over the blockchain. The oracle will feed in the required legal documents until the smart contract's conditions are met. Once the smart contract registers all this external data, it can automatically transfer a tokenized ownership deed to the homebuyer.
Although blockchain oracles are most often used for price feeds on DEXs, they have many exciting applications that developers are only beginning to explore.
How do oracles gather data?
An oracle gathers data depending on what information a developer wants to input. These data feeds can come from software or hardware sources. If an oracle solely tracks information on the web, it may pull data from APIs on centralized crypto exchanges. Hardware oracles, however, can collect data from physical devices like a thermostat or a QR scanner.
The unique feature of decentralized crypto oracles is that they rely on multiple node operators to query, validate, and transfer data. The decentralized structure of these crypto oracles helps ensure the off-chain or on-chain data is valid. Since every data point has to pass through so many validators, it reduces the odds of mistakes.
This information is then relayed to the associated smart contract in a coded message. If the smart contract successfully reads this information, it should verify on the blockchain.
Types of blockchain oracles
All blockchain oracles share a similar goal: Securely bridge information from on-chain and off-chain sources. However, not all oracles go about this task in the same way. Below are a few key ways people distinguish blockchain oracle networks:
- Inbound and outbound oracles: The words "inbound" and "outbound" refer to the direction of an oracle's data flow. Inbound oracles bring information into the blockchain, while outbound oracles take data from the blockchain to an external source. Currently, it's far more common for blockchain oracles to bring information onto a blockchain.
- Hardware and software oracles: The hardware versus software distinction relates to an oracle’s data sources. Hardware oracles rely on information derived from physical devices (e.g., sensors), while software oracles collect data from the web (e.g., APIs from exchanges).
- Centralized and decentralized oracles: Centralized oracles rely on one trusted source for their data feeds. While centralized oracles can be efficient, they present a significant threat to blockchains like Ethereum. The high degree of centralization in these oracles requires that smart contract users place extra trust in the oracle provider. This runs counter to the "trustless" nature of decentralized blockchains.
Decentralized oracles promise to provide data feeds to blockchains without introducing a single point of failure. These use consensus mechanisms, token incentives, and multiple node operators to provide data in a trustless manner. Chainlink is the most prominent example.
- Compute-enabled oracles: These relatively new oracles focus on relaying complicated off-chain computations to trigger various functions on-chain. The computations compute-enabled oracles handle are often far too complex to manage on the chosen blockchain. Many layer-two scaling solutions use compute-enabled oracles, but these services can provide high-end analysis and commands for layer-one blockchains.
- Human oracles: Interestingly, humans can provide data feeds to a blockchain oracle. For instance, meteorologists can input this data into a smart contract if they want to submit weather predictions. Human oracles often use an advanced verification system to check the sender's identity.
- Contract-specific oracles: This means the oracle has a one-time use case. Once a contract-specific oracle's smart contract parameters are fulfilled, its job is complete.
The oracle problem
The crypto community’s major concern with oracles is the risk of centralization. Centralized blockchain oracles have a hierarchical structure with easily identifiable leadership and a clear concentration of data. If smart contracts were to rely on these centralized oracles, they’d invalidate the decentralization of a blockchain's architecture.
Although a blockchain like Ethereum is decentralized, introducing a centralized oracle means people need to rely on the oracle network's trustworthiness. Even if a centralized oracle has high standards for transparency, there's a greater chance of data corruption. It only takes one successful hack on a centralized oracle provider to destroy the validity of a blockchain's smart contracts.
Most blockchains favor decentralized oracle services to mitigate this threat. Projects like Chainlink use consensus mechanisms, token incentives, and multiple nodes to ensure the data isn't flowing from just one source to another. Blockchain experts are hopeful the further development of decentralized oracles can effectively solve the oracle problem.
Blockchain oracle use cases
There's no limit to the potential use cases for blockchain oracles. Web3 developers are devising novel ways to bring decentralization into real-world finances, investments, and transactions. Although the possibilities of blockchain oracles are endless, here's a sampling of the current uses of this technology:
- DeFi: Blockchain oracles are a critical aspect of the DeFi ecosystem. Without blockchain oracles, it would be impossible to generate accurate price feeds on DEXs like Uniswap. Oracles also help automate buy/sell orders and keep track of crypto collateral and loans on decentralized lending platforms like Aave.
- Dynamic NFTs: With blockchain oracles, artists can expand their creativity when minting NFTs (non-fungible tokens). Instead of creating static NFT images, oracles allow developers to create dynamic NFTs, which can sense external events and automatically alter their appearance. Besides being a neat feature for collectors, this built-in dynamism can generate more utility and excitement with blockchain-based game items, films, or audio files.
- Environmentalism: Can crypto and NFTs incentivize people to go green? Interestingly, some companies like Outdoor Magazine have begun using Web3 tools to encourage citizens to focus on the environment. With the help of blockchain oracles, it may be possible to track and reward people for taking eco-friendly actions, potentially reducing global carbon emissions.
- Tokenized real estate: Buying a home on the blockchain can soon become a reality. Blockchain oracles allow homebuyers and sellers to submit necessary legal documents to a smart contract. Deed NFTs can signify property ownership in the real world. Also, many developers are experimenting with tokenized real estate-investing platforms that use blockchain oracles for price feeds.
- Insurance: Blockchain oracles may soon automate the insurance industry. If insurance companies use data from sources such as weather records, satellites, and even car monitors, they may be able to submit claims via the blockchain. Not only that, but insurers may also offer output oracles on smart contracts that automatically pay out claims.
- Customer loyalty rewards programs: Businesses can soon use blockchain oracles to track consumer activity and reward customers with crypto or NFTs stored in smart contracts.
- Voting: Many activists are hopeful that blockchain oracles can make democratic elections transparent. Blockchain-based oracles can record and transmit voting data to tamper-proof smart contracts, ensuring transparency in vote count.
- Gambling: Whether people like betting on soccer, F1 races, or celebrity singing competitions, blockchain oracles can bring this data to blockchain gambling platforms. Although the legality of DeFi gambling is a gray area, it remains a potential use case for blockchain oracles.
Examples of blockchain oracles
- Chainlink remains the most influential decentralized blockchain oracle in the crypto community. Created in 2017 on Ethereum, it consists of multiple oracles that provide data to blockchains without a single point of failure. Chainlink offers its ERC-20 LINK token as an incentive mechanism for node operators and a governance token for network participants.
- Band Protocol has many of the same features as Chainlink, but it wasn't built on the Ethereum blockchain. Instead, its founders used Cosmos' software development kit to communicate with multiple blockchains. Like Chainlink, Band Protocol uses a proof-of-stake (PoS) model with multiple validators incentivized to secure the network with the promise of BAND token rewards.
Oracles will play a crucial role in the evolution of blockchain technology. Their off-chain data can help countless real-world industries explore the potential benefits of smart contracts. As Web3 developers continue to tinker with this technology, it’ll be exciting to see how oracles inspire future DeFi applications.
Another company that aims to simplify complex crypto topics like blockchain oracles is set to significantly impact the crypto world. Introducing Worldcoin. We aim to put a share of our crypto in the hands of every individual on the planet. We’re also airdropping free DAI to anyone who downloads our app.
Subscribe to our blog to know more.