Definition of Oracle
An Oracle is a trusted third-party service that provides external (off-chain) data to smart contracts on the blockchain.
Since smart contracts cannot access real-world data on their own, oracles act as bridges between blockchains and the external world.
Why Oracles Are Needed?
Blockchains are closed systems and do not have internet access.
But smart contracts often require real-world information like:
- Current stock prices
- Election results
- Weather conditions
- Flight delays
So, oracles fetch such external data and send it to smart contracts for use in logic execution.
Simplified Oracle Interaction Model
Here’s the simplified lifecycle of how an oracle interacts with a smart contract:
Step-by-Step Flow
- Smart Contract Request
→ A smart contract sends a request to the oracle for external data. - Oracle Requests External Data
→ The oracle fetches data from a trusted off-chain source like:- APIs
- Databases
- Web services
- IoT devices
- Notarization / Proof Generation
→ A notary service (like TLSNotary) signs the data with a digital signature to prove it’s authentic. - Data Sent to Oracle with Proof
→ The notarized data is sent back to the oracle. - Optional Storage
→ If the data or proof is large, it can be stored in decentralized storage like IPFS or Swarm. - Oracle Sends to Smart Contract
→ Finally, the oracle sends the data + proof to the smart contract, which then uses it to execute logic.
Diagram: A generic model of an oracle and smart contract ecosystem


A generic oracle data flow
Push vs Pull Oracle Models
- Push Model: Oracle pushes data automatically to smart contracts.
- Pull Model: Smart contract pulls data by sending a request to the oracle.
Security in Oracles
To ensure data is authentic:
- Oracles must digitally sign the data (Proof of Validity).
- Use cryptographic techniques like:
- TLSNotary
- Hardware-based attestation
- Ledger proofs