An oracle is an entity that provides external or off-chain data to smart contracts. To understand the importance of oracles, it is critical to understand on-chain and off-chain data, along with their interaction with smart contracts.
On-chain vs. Off-chain Data
- On-chain data is all the information that is permanently stored on the blockchain, like blockchain states and transactions. This data is validated by the consensus mechanism of the blockchain and is then recorded on the blockchain in the ledger, which ensures that the data is secure, authentic, and transparent.
- Off-chain data is all the information that is not located on the blockchain, which can be anything from cryptocurrency prices to financial data or data on other blockchains. The scope of this data is extremely large compared to on-chain data. This data is not validated by the blockchain, making it less secure, less transparent, and lacking a consensus mechanism.
Smart contracts are self-executing programs that execute based on pre-determined results. This is known as a deterministic system, which is a system where one pre-defined result always results from a certain input. For example, a smart contract could be made to sell a certain amount of crypto when it reaches a certain price. This smart contract has two results: selling the crypto or not selling, and only one precondition: when the crypto price reaches a certain amount. However, this smart contract would need to incorporate off-chain data, the price of a certain cryptocurrency, but smart contracts alone can’t access this data. So how do you fix this problem?
Oracles
Oracles are essentially data feeds that serve to provide smart contracts with off-chain data. Without oracles, smart contracts are extremely limited in their ability, but with oracles, smart contracts can execute based on an innumerous number of causes. This type of smart contract is called a hybrid smart contract, which incorporates information from both the blockchain and externally. These types of smart contracts are extremely useful, as they are able to incorporate information from an almost infinite source, information like market conditions, weather data, sports results, etc. The versatility of these smart contracts is the result of oracles, providing these contracts with the off-chain data.
If you want to learn more, check out the links below:
What is a blockchain oracle, and how does it work?
On-Chain Explained: The Backbone of Blockchain Technology
Thank You for Reading
If you like this article, consider reading my other articles