While revolutionary, smart contracts face a fundamental limitation: they cannot independently access off-chain data, meaning information that exists outside the blockchain environment. Without oracles, smart contracts would lack access to essential information like NVIDIA’s stock price, sports match results, or the current date and time. This is because blockchains are designed to operate in isolation from external data sources. Oracles bridge this gap, acting as a gateway between the off-chain world and smart contracts.
What are Blockchain Oracles and how do they work?
Oracles are services that provide external data to blockchains, enabling smart contracts to interact with real-world information. To illustrate how they work, let’s consider a practical example instead of a complex theoretical explanation. Suppose you want to use the Ethereum blockchain to bet on an upcoming European Championship football match with friends. Each participant stakes 0.1 ETH into a smart contract, which will award the entire pot to the winner. If the match ends in a draw, the contract returns the 0.1 ETH to each original wallet address.
But how does the smart contract obtain the actual match result, given that this information isn’t available on the Ethereum blockchain? This is where oracles come in.
Ensuring data accuracy with Oracles
This example also raises an important question about data reliability. How can we ensure that the data an Oracle provides is accurate? The simplest answer is to choose the most reliable oracle available, but this issue has additional complexity, which we’ll discuss further.
Using the term “reliable” can be challenging in blockchain environments, where decentralised mechanisms minimise trust. Integrating an oracle can expose a blockchain to risks since oracles can become a “single point of failure.” Attackers attempting to compromise the integrity of a smart contract can target external data sources, which are not protected by blockchain consensus mechanisms. However, several solutions have been developed over time to address these issues.
Read on to explore the different types of oracles and how they work.
Types of Oracles
Oracles come in different forms, each with unique characteristics. The main differences relate to their data source, the data direction (whether they allow information to flow in or out of the blockchain), and the trust model.
By Source
- Software Oracles: These oracles obtain data from online databases or servers. They are continuously connected and provide dynamic information such as the date, time, stock prices, or sports scores. They operate in real time, which is essential for applications requiring frequently updated data.
- Hardware Oracles: These interact with the physical world through sensors. A classic example is a sensor that reads a barcode to monitor a supply chain. Hardware oracles are used when data must be captured from the physical world and transferred to a blockchain.
By Direction
- Input Oracles: These oracles transmit information from external sources to smart contracts. For example, an input oracle can supply a smart contract with the current stock price, enabling it to execute transactions based on that data.
- Output Oracles: These operate in the reverse direction, transmitting data from the blockchain to the external world. For example, an output oracle could trigger a real-world action, such as initiating a payment or closing a contract, when a certain condition is met on the blockchain.
By Trust Model
- Centralised Oracles: Controlled by a single entity, these oracles provide data to smart contracts, which can create a single point of vulnerability. Since all trust is placed in one centralised entity, the oracle is susceptible to tampering or attacks.
- Decentralised Oracles: These aim to minimise trust requirements by distributing data validation across a network of nodes. Like the blockchain, these oracles pull data from multiple sources to ensure accuracy, reducing the risk of manipulation. In this model, trust is distributed among various nodes, each of which helps validate the information.
Decentralised oracle models often use blockchain-like reward mechanisms. Nodes that consistently supply accurate data receive rewards, incentivising reliability, accuracy, and timely data provision.
Chainlink: the most widely used decentralised Oracle
A discussion of oracles would only be complete by mentioning Chainlink, one of the most popular oracle solutions for decentralised applications. Chainlink offers a decentralised trust model that enables data transmission between smart contracts and web APIs. It functions through “reputation smart contracts” that use incentives, rewards, and penalties to ensure the accuracy of the data provided.
The transferred data must be accurate and updated in real time. Imagine the problems if the Ethereum blockchain couldn’t track the exact time or token price down to the second.
In short, Chainlink connects off-chain data to smart contracts via a network of nodes that verify and validate the information, reducing manipulation risks and improving security and reliability. Many decentralised applications (dApps) now use Chainlink’s innovative protocol to incorporate off-chain data into their smart contracts.
Real-world applications of Chainlink
- Aave: A leading decentralised lending platform, Aave uses Chainlink to obtain real-time asset pricing. This enables Aave to provide variable interest rates based on market values.
- Synthetix: A protocol for creating synthetic assets that rely on Chainlink to ensure the represented assets’ prices are accurate and current.
- Augur: A prediction market platform that uses Chainlink to verify the outcomes of events that underpin its betting markets, ensuring correct event results.
- Arbol: A dApp providing blockchain-based weather insurance. Chainlink collects meteorological data from trusted sources and triggers automatic payouts based on contract terms.
One notable collaboration between Google Cloud and Chainlink has demonstrated the potential of Oracle technology. Google Cloud integrated Chainlink to enable smart contract developers to access data from BigQuery services.
Conclusion
Oracles are essential for expanding smart contracts’ capabilities, allowing them to interact with the real world. While they introduce trust-related challenges, decentralised solutions like Chainlink help mitigate these risks. With ongoing advancements in Oracle technology and partnerships like the one between Google Cloud and Chainlink, we can expect increasing integration between blockchains and off-chain data, opening up new possibilities for decentralised applications.