Oracles: how blockchain networks connect with the real world
We’ve all heard a common definition of smart contracts on the blockchain, that they are contracts that execute automatically, without human intervention when certain conditions are met. Typical examples are: automatic insurance payouts when a flight is delayed, releasing a prize if a team wins, or calculating an interest rate when the official rate changes.
Everything sounds great, but there is a small problem: blockchain networks, by design, live in their own world. They cannot autonomously know when a flight was delayed, whether a team won, or whether interest rates were updated.
So, how can we make the Blockchain “learn” what happens outside it? More importantly, why do we say that smart contracts execute automatically if they don’t learn anything about the outside world? That’s where oracles come in.
What is an oracle?
The name comes from Greek mythology. Oracles were those who could “speak with the gods” and reveal unknown information. In the context of the blockchain, the idea is similar: an oracle is a system that acts as an intermediary between the real world and blockchain networks.
Its role is to bring information from outside the network, such as prices, weather data or sports results, and not only make it available to the smart contracts that need it to execute, but even invoke the contract and trigger its execution.
However, why do blockchain networks need oracles? Unlike a traditional program, a smart contract runs on thousands of computers in a synchronized way. For all of them to reach the same result, the rules must be completely deterministic; that is, there can be no room for interpretation. This ensures consensus, because every copy of the system must record exactly the same state.
An oracle acts as a reliable bridge between the blockchain and real-world data.
That is why a smart contract cannot execute based on random data nor directly query external sources. If every node accessed the internet and read, for example, the current temperature in London, each could obtain a different number — all correct, but in different contexts. Discrepancies can stem from the ultimate source of the data (we all know that London’s temperature varies slightly depending on the source consulted) or, even when consulting the same source (the data from a specific weather station exposed on the Internet), each node’s query is different, they are not synchronized and they may in fact disagree.
Therefore, assuming that queries by each node for the same information can differ, how do they agree on the result? If each node executed the smart contract with a different input, the blockchain would stop functioning as the single source of truth we rely on.
■ Oracles solve this problem by acting as a trust layer between the outside world and smart contracts. Very simply put, oracles obtain data from a source, validate it and send it to the blockchain in a structured way so that all nodes see exactly the same information.
How oracles work
In practice, an oracle collects off-chain information, digitally signs it (to guarantee its authenticity) and publishes it inside the blockchain, where any smart contract can query it. There are many ways to do this, and depending on the type of data or the frequency of updates, different models can be used.
- Immediate-read oracles are the simplest. They answer one-off questions like “Is this person over 18?” or “What is the address of such service?”.
—They usually store the information directly on the blockchain, ready to be consulted when needed. - Then there are publish/subscribe oracles, which work like a news channel. They publish frequently changing data, such as cryptocurrency prices or weather forecasts, and contracts that “subscribe” receive updates whenever there are changes.
—This way, applications don’t have to make the same query repeatedly but stay up to date automatically. - Finally, there are request/response oracles, designed to handle large volumes of information or more complex queries. Here, an application sends a request to the oracle (for example, “current price of gold”), the oracle fetches that information, verifies it and returns it signed.
—It’s a more sophisticated process but also more flexible, since it allows requesting only the necessary data at the right moment.
They collect, sign and publish external data on the blockchain for use by smart contracts.
How data correctness is guaranteed
Bringing real-world information onto the blockchain is useless if someone can tamper with it. That’s why security and data authenticity are fundamental.
A common technique is the use of cryptographic proofs of authenticity, which allow verifying that the data really comes from its source and has not been altered along the way.
Cryptographic verification, TEE and decentralized oracle networks reduce manipulation risks.
Another option is Trusted Execution Environments (TEE), specialized chips that guarantee that the code that collects and processes information cannot be altered from the outside. This adds an extra layer of security, although these devices are still in early stages of adoption and their reliability remains under study.
To reduce the risk of relying on a single source, there are also decentralized oracle networks, where several independent nodes obtain the same data and the blockchain computes a single value by applying a pre-defined algorithm (from simple operations like calculating the mean or median of responses, to applying complex fuzzy-logic algorithms). This avoids a single entity controlling the information.
Besides bringing external data, some modern oracles also enable communication between different blockchain networks. These systems, called cross-chain messaging protocols, expand the oracle concept beyond serving as a bridge between the blockchain and the outside world to also connecting different networks.
■ This allows, for example, a contract deployed on Ethereum to interact with one deployed on Polygon, securely and automatically sharing information and assets.
When well designed, oracles enable secure automation of interactions between blockchain and the real world.
Conclusion
As we have seen, without oracles, smart contracts would live in a kind of isolated bubble, unable to react to what happens off-chain. In other words, they would not meet the definition of executing automatically when certain conditions occur because they would never know those conditions have been met.
However, every time an external source is introduced into a decentralized system a new potential point of failure is added. If an oracle is compromised or manipulated, it can trigger serious consequences, especially in applications that manage money or digital assets. That is why, when designing oracle-based solutions, it is crucial to clearly understand the trust model: who provides the data, how its integrity is validated and what incentives exist to keep the system honest.
Still, when used correctly, oracles open up a universe of possibilities. They enable automation of insurance, payments, loans, games, predictions, identity verification and many other applications that combine blockchain transparency with the richness of the real world. They are, ultimately, the bridge that makes the promises of blockchain technology start to come to life outside the theoretical framework.
References:
Image by Wirestock / Freepik.
Hybrid Cloud
Cyber Security & NaaS
AI & Data
IoT & Connectivity
Business Applications
Intelligent Workplace
Consulting & Professional Services
Small Medium Enterprise
Health and Social Care
Industry
Retail
Tourism and Leisure
Transport & Logistics
Energy & Utilities
Banking and Finance
Smart Cities
Public Sector