Oracles: Simplified

1 month ago 25
What Is an Oracle in Blockchain? » Explained | Chainlink

An easy-to-understand explanation of everything you need to know about Oracles.

What are Oracles? (Simplified Explanation)

Oracles are data messengers that feed external data into smart contracts, enabling the smart contract to make up-to-date decisions, in real-time. They essentially act as a bridge between the real and digital world, via fetching data from the outside world and feeding into the digital world (smart contracts.

For example: a decentralised application (dApp) that automatically pays out insurance claims based on the weather. Let’s say this dApp will pay out £100 to everyone who claimed that it would rain at 2:00 pm in Manchester. The dApp would need to know at 2:00 pm if it rained in Manchester. How would this virtual dApp, be aware of the real-life weather? Through an Oracle.

The Oracle would check the real-world weather, feed that data into the smart contract on the dApp, and the smart contract would automatically execute the insurance policy. Let’s say it did rain at 2:00 pm in Manchester. The process would be as follows:

  1. Oracle picks up it is raining at 2:00 pm in Manchester
  2. Oracle relays information to smart contracts on dApp
  3. Smart contract in real-time would automatically pay out £100 to all insurance claimants who claimed it would rain in Manchester at 2:00 pm.

It is important to understand a smart contract is a piece of code that automatically executes agreements based on certain criteria. Smart contracts CANNOT access or verify data on the outside world, hence why Oracles are required.

What are Oracles? (Advanced)

A decentralised finance (DeFi) platform offers a smart contract for automated trading based on specific stock market conditions. For example, a user wishes to buy 100 shares of Company XYZ if its stock price falls below $50.

How it works:

  1. Smart Contract Setup: user sets up a smart contract on the blockchain with the condition (rule) for purchasing 100 shares of Company XYZ if the stock price falls below $50.
  2. Oracle’s Role: the blockchain cannot directly access the stock market data, so it relies on an oracle to monitor Company XYZ’s stock price.
  3. Data Fetching: oracle is programmed to regularly check stock price of Company XYZ from reliable financial data sources such as stock market feeds or financial news APIs.
  4. Verification and Submission: oracle fetches the current stock price, verifies data for accuracy by comparing multiple sources to ensure reliability and then submits this information to the blockchain.
  5. Condition Evaluation and Execution: oracle submits data indicating Company XYZ’s stock price has fallen below $50, and the smart contract automatically executes a buy order for 100 shares on behalf of the user.

Types of Oracles

Oracles can be categorised based on various criteria including a source of data, the direction of data flow, the degree of decentralisation, and the nature of the information they provide.

Source of Data

  • Software Oracles: handle data on the internet. e.g. temperature, prices of commodities, and currencies.
  • Hardware Oracles: fetch data from PHYSICAL WORLD, typically using devices such as barcode scanners and electronic sensors. Hardware oracles then translate that information into code that can be understood by smart contracts. For example, RFID sensors allow goods to be tracked along supply chains.

Direction of Data Flow

  • Inbound Oracles: take information from an external source and send it a smart contract. Example: Oracle checking Ethereum price and sending it a DeFi smart contract.
  • Outbound Oracles: send data from smart contracts to the external world. Example: a smart contract that sends you a notification on your phone whenever you receive deposits in your bitcoin wallet.

Nature of Information

  • Consensus Oracles: gather data from MULTIPLE sources to reach a consensus (agreement). Helps reduce anomalies and inaccuracies from any single source
  • Computation Oracles: perform computations outside the blockchain. Example: calculates user credit score for a dApp that offers personal loans.

Degree of Decentralisation

  • Centralised Oracles: single source provides data.
What Is an Oracle in Blockchain? » Explained | Chainlink
  • Decentralised Oracles: source information from multiple sources. They combine multiple independent Oracle node operators and multiple reliable data sources to establish end-to-end decentralisation. Such oracles leverage hybrid smart contracts.
What Is an Oracle in Blockchain? » Explained | Chainlink

Hybrid smart contracts: an application that consists of a smart contract that runs on a blockchain and off-chain services that support the smart contract (oracles).

  • Human Oracles: humans provide information or make decisions that are fed into the blockchain. They tend to be experts in a particular field.

Advantages of Oracles

  • Enables smart contracts to interact with the external world by feeding external data into smart contracts
  • Increases blockchain applicability in various industries, including finance, insurance, supply chain, and many others, enabling blockchains to respond to real-world events.
  • Decentralised oracles can source data from multiple points, reducing reliance on a single source of truth and thus enhancing security and reliability.
  • Computation oracles can perform data-intensive and privacy-sensitive computations off-chain ensuring the blockchain doesn’t expose sensitive data therefore enhancing privacy and security.
  • Increased efficiency and scalability as a computational load on the blockchain can be offloaded to oracles, therefore reducing transaction costs (gas fees).

Disadvantages of Oracles

  • If Oracle provides incorrect data, this will compromise the accuracy of a smart contract.
  • Oracles can be targets for attacks, where their data may be manipulated
  • Costly and complex to implement reliable Oracle systems
  • The speed and efficiency of oracles are limited by the processing capabilities of the oracle service, resulting in delays in smart contract execution.
  • Integrating real-world data in blockchain applications via oracles can raise privacy and regulatory concerns, especially when handling sensitive information.

Use Cases

  • Finance and DeFi: oracles can provide real-time price data of cryptocurrencies, fiat currencies, commodities, or other assets. Price oracles can be used to determine a user’s borrowing capacity. Automated market makers use price oracles to help concentrate liquidity at the current market price.
  • Dynamics NFTs and Gaming: NFTs which can change in appearance based on external events such as the time of the day or weather. Computer oracles can be used to generate verifiable randomness to create loot boxes or randomised matchmaking.
  • Insurance: Ethersic uses oracles to automate insurance processes, including flight delay insurance where payouts are automatically processed if a flight delay is confirmed by oracle-reported data.
  • Supply chain & Logistics: IBM’s Food Trust blockchain uses oracles to integrate data from various points in the supply chain, including temperature data, shipment movements, and product origin to ensure food safety and traceability.
  • Real Estate: verify property prices, ownership history, and local regulations, such information can be used in smart contracts for transparent and automatic processing of sales, rentals, or lease agreements.

Oracles: Simplified was originally published in The Dark Side on Medium, where people are continuing the conversation by highlighting and responding to this story.

Read Entire Article