Blockchains bring decentralization to finance and basically every other industry you can think of, and they are certainly one of the greatest technological marvels of today. However, as awesome as blockchains are, there is still one slight problem: blockchains can not avail real-world data by themselves, since they’re simply ledgers recording information related to transactions carried out on them. The solution to this challenge is already here, of course, and it’s called a blockchain oracle.
Blockchain oracles feed real-world data to smart contracts, making them ‘smarter’ and capable of making decisions based on the data they can access through these oracles. Blockchain oracles are also called crypto oracles colloquially.
In this article, we answer the question ‘what is a blockchain oracle?’ in detail, and discuss how they work, their types, use cases, and more. Without further ado, let’s get into it already!
What is an Oracle in Crypto?
To expand upon the brief definition above, blockchain oracles are services that bring external, real-world data to a smart contract that can only operate within a blockchain. You have to remember that smart contracts are isolated programs; they have no way to acquire data from outside of a blockchain without intermediaries. This is where crypto oracles come in: this way, smart contracts have the capability of fetching data from the off-chain world (and even other blockchains).
So basically, oracle blockchains are what connect smart contracts to the real world. To give you an example, say you create an Ethereum smart contract to bet on the outcome of a car race with your cousin. Now, this smart contract has both of your bets and conditions for the release of the reward written in its code. It can then use oracles blockchain to find out the result of the car race, and self-execute upon deciding which party has won, releasing the rewards to them.
How do Blockchain Oracles Work?
The entire process of the working of crypto oracles is multi-tiered and pretty fascinating to the tech enthusiast. Here’s how it goes:
- First up, you send a data request. Depending on the kind of application the oracle blockchain is being applied to, the request will usually contain a query for certain data, sources for said data, and instructions for processing the data and aggregating the response received into a single value.
- Now, the on-chain oracle contract (which does all the heavy lifting) will pick up the request and pass it on to an off-chain oracle node. Once the off-chain node completes its job, the data comes back to this very on-chain contract, signifying successful data acquisition.
- The on-chain oracle contract creates a log event which is then picked up by an off-chain oracle node.
- The oracle node captures said log event and accordingly delegates the off-chain task to third party systems.
- Upon data retrieval, it is processed and modified in a way so that the blockchain understands the data. Then, the data is transacted back to the on-chain oracle contract, and the request is fulfilled.
As you can see, blockchain oracles are only the medium through which on-chain smart contracts certain kinds of data. Therefore, the notion that crypto oracles themselves are sources for information is a wrong one.
Types of Blockchain Oracles
Blockchain oracles can be categorized in different ways based on multiple factors. For example, when it comes to network administration, there are two types of oracles blockchain. These are:
Centralized Oracles:
As the name suggests, these crypto oracles are controlled by a centralized entity. Through specialized datasets, they can send off-chain data to smart contracts. However, the accuracy of data received through this method can not be guaranteed always, and it’s important to pick reputed oracles blockchain. Further, in case the single centralized point of control is down, these crypto oracles cease functioning.
Decentralized Oracles:
These don’t have the drawback of being controlled by one single entity, and therefore are not affected by single-point errors and failures. Decentralized oracles are managed through peer to peer frameworks that achieve consensus on any off-chain data gathered before it is transferred to a blockchain smart contract. Therefore, the benefits of these blockchain oracles include better chances of accuracy and steady availability of data even if one of the nodes in the system are down.
There can be further classifications of blockchain oracles made based on design patterns. These would be:
Immediate-Read Crypto Oracles:
As their title suggests, these blockchain oracles provide data almost instantly upon a request. However, they might make use of static or old data while prioritizing speed.
Publish-Subscribe Crypto Oracles:
On the other hand, these oracles blockchain bring a constantly updated data feed for blockchain-based smart contracts. Examples of these dynamic oracles include those that monitor currency exchange rates to offer real time data for trades.
Request-Response Crypto Oracles:
These ones allow smart contracts to ask for certain information beyond the scope publish-subscribe oracles provide. These are handy in situations when the whole dataset is too much for on-chain storage, or when users ask just for fragments of data infrequently.
Example of a Blockchain Oracle
Now that we know ‘what is an oracle blockchain’ and also the types of said oracles, it’s time to look at an example of blockchain oracles to complete your understanding of them.
You might have heard of the Chainlink oracle?
Source| Chainlink, a blockchain oracle
The Chainlink oracle is a decentralized blockchain oracle which feeds real-world information to blockchain-based smart contracts. LINK tokens are there to be used for things like service charges.
Here’s How the Chainlink Oracle Works:
- When a smart contract (a Requesting Contract) puts out a request for information, the Chainlink protocol immediately registers an ‘event’ and creates a parallel smart contract called the Chainlink Service Level Agreement or SLA Contract). The Chainlink SLA Contract is now tasked with gathering the requested off-chain data.
- The Chainlink Service Level Agreement Contract then creates three sub smart contracts:
- A Chainlink Reputation Contract,
- A Chainlink Order-Matching Contract, and
- A Chainlink Aggregating Contract
- The Chainlink Reputation Contract now goes through an oracle provider’s track record to confirm its authenticity and verify its performance. As its name suggests, this one is responsible for ruling out disreputable nodes.
- Then comes in the Chainlink Order-Matching Contract, which delivers the request to Chainlink nodes and accumulates their bids on the request- only on the event that the Requesting Contract does not specify a certain set of nodes- and chooses the right number and type of node to gather the answer.
- Finally, the Chainlink Aggregating Contract takes the gathered information and validates and processes it for the precise outcome. This contract can actually validate data from both single or multiple sources, and reconcile the latter kind of data.
Further, the Chainlink Aggregating Contract relies on the majority vote to determine the correct information in case of data from multiple sources. So say if out of five nodes, two deliver one result on the current weather, and the other three deliver another result, the contract will pick the result the majority agrees on.
Blockchain Oracles Help Them Stay Relevant
We hope this article has helped you understand ‘what is a blockchain oracle?’ to your satisfaction. These applications bring real-world data to blockchains, enhancing their applications and helping them build a bridge with the real world. The benefits of crypto oracles are many, including:
- Blockchain oracles help the chains to perform more complex activities, since they are no longer limited to just one network. Blockchains can now interact with any off-chain data, and help users with better experience in everything from trading to creating new applications and tokenizing their intellectual property to create NFTs (non fungible tokens).
- Blockchain oracles come in diverse categories and therefore are amazingly flexible. An oracle can be designed to perform any task you can think of, and keep doing it as many times as you want. What’s more, while a lot of the blockchain world is still accessible only to the more tech-savvy, some crypto oracles are pretty simple to create and work with.
- Finally, blockchain oracles do not require you to make transactions on the chain yourself. They can instead automate any number of activities, and just execute smart contracts based on external triggers.
Now you know ‘what is an oracle in crypto’, how it works, what are its types, and finally, its benefits. For more information on the world of blockchain and crypto, don’t forget to visit Blockverse!