Cointime

Download App
iOS & Android

What Is a Blockchain Oracle and How It Automates Smart Contracts

Validated Project

Key Takeaways:

  • A blockchain oracle enables smart contracts to interact with off-chain systems for the effective execution of the contract terms.
  • Blockchain oracles are important since smart contracts living on blockchains cannot access off-chain data.
  • Enabling smart contracts to function using off-chain data feeds improves the value of decentralized applications (dApps). 
  • The oracle problem refers to the concerns that stem from having a decentralized system depend on a centralized system to function. 

​​​​​The word oracle is derived from Greek about an individual who communicates directly with the gods and foresees the future. In ancient times, people had little knowledge about current and future happenings. As such, they relied on oracles to gain knowledge beyond their understanding. In the blockchain context, oracles connect blockchains with the outside world, acting as bridges. 

This guide answers the questions:

  • What are blockchain oracles?
  • How do blockchain oracles work?
  • Why are blockchain oracles important?
  • What is the blockchain oracle problem?
  • What are the types of blockchain oracles?

Let’s get the answers to each of them in the separate sections within this article.

What is a Blockchain Oracle?

A blockchain oracle is a data feed that sources, verifies, and transits off-chain data (data from other blockchains and the outside world) to smart contracts living on the blockchain. In addition to sourcing off-chain data and transmitting it to the blockchain, an oracle can relay data from it to external systems. For example, an oracle unlocks a smart lock once a user makes a payment through a blockchain transaction.

Source: Chainlink

As mentioned, oracles function as bridges, linking on-chain systems, like smart contracts, with off-chain/external data providers. This expands the scope in which smart contracts operate. In other words, smart contracts would have a limited application without blockchain oracles since they would only have access to on-chain data. An oracle presents a mechanism for activating smart contract functions using trusted external data.

Note that a blockchain oracle isn’t the data source. Instead, it is the system that queries, confirms, and authenticates off-chain data sources, and then transmits that information to a blockchain network. The transmitted data can be the price and exchange rates of assets, natural disasters and risk measurements, statistics, dynamic data (time measurement), political activities, games, geolocation and tracking data, events in other blockchains, etc. 

How Do Blockchain Oracles Work?

Generally, an oracle consists of a smart contract operating on-chain and some off-chain elements. The contract receives requests for data from other on-chain applications and relays them to the off-chain part (known as an oracle). The oracle node can query data sources primarily through Application Programming Interface (APIs), relay the extracted information, and store it on the blockchain.

Here's an example of how a blockchain oracle works:

Suppose Alice and Bob bet on the outcome of the 2024 US presidential election. Alice is firmly convinced of a Republican candidate win, while Bob is for a Democrat win. They set clear terms and conditions about the bet and lock their stakes in a smart contract. The smart contract will release the funds to the winner after the 2024 election results are announced.  

Remember, the smart doesn’t know what is happening off-chain – in this case, the 2024 US presidential election outcome. When the set timeline reaches or after the election, the oracle queries a trusted API to know the candidate that won and transmits the information to the blockchain. The smart contract then uses the relayed information to release the funds to the winner. 

Without the oracle querying and transmitting the information on-chain, there would be no effective way to settle the bet freely and fairly.

Why Are Blockchain Oracles Important?

Most cryptocurrency users view smart contracts as lines of code operating at specific addresses on the blockchain. These smart contracts are self-governing computer programs capable of executing agreements between parties once the predetermined conditions are met – hence the reason why they are called “smart contracts.” 

However, using smart contracts to execute agreements between parties in deterministic systems, like the blockchain, is a complex issue. A deterministic system always produces expected results under a static state and particular input – there is no variation in computing outputs from inputs. To ensure deterministic execution, blockchains only need to form consensus on basic binary questions drawing on data that is already stored in its ledger. Examples of binary questions include:

  • “Did the wallet owner (identified by a public key) approve this transaction with the right private key?”
  • “Does this wallet have adequate funds to transact?”
  • “Is the transaction binding in the context of this smart contract?”

If blockchains source information from off-chain systems, determinism would be challenging. As the off-chain data mayu change often, this limits nodes from reaching a consensus on the legitimacy of changes to the blockchain’s state. For instance, consider a smart contract executing a transaction based on the current BTC-USDT exchange rate sourced from a standard price API. The figure would probably fluctuate often, besides the risk of the API getting hacked or corrupted. This means nodes performing the same contract code would produce different outputs.    

Determinism is integral for any public blockchain, with numerous nodes spread worldwide. Since no central authority acts as a truth source, we expect the nodes to produce similar results from the duplicate transactions. A scenario where node A performs a smart contract code and arrives at “4” as the output, while node B arrives at “10” after completing the same transaction would break down the blockchain’s consensus and value as a distributed computing system. 

The above example also demonstrates the problem with allowing blockchains to source information from off-chain sources. Nevertheless, oracles solve this problem by “pulling” information from external sources and relaying it to blockchains for use in smart contracts. Since on-chain data is immutable and publicly accessible, this lets blockchain nodes securely utilize off-chain data to make changes without breaking consensus. 

The Blockchain Oracle Problem

The blockchain oracle problem relates to sourcing external data onto a blockchain. It’s important to ensure this data is correct – else, smart contracts will use erroneous inputs to produce incorrect outputs. Since smart contract transactions are irreversible, we must ensure that the oracle input is correct. Imagine a smart contract releasing a $100 million bet to the wrong winner because of an incorrect input! That will be catastrophic, considering that the smart contract is immutable and that the users' identities are hidden.

The other issue is that oracles (particularly centralized oracles) can act as a central point of failure, vulnerable to hacks and manipulations. This could cause smart contracts to execute incorrectly, leading to unintended consequences. Additionally, using oracles can introduce trust issues, as users have to trust that the oracle is providing accurate information.

However, there are ways of addressing the blockchain oracle problem. One is using multiple oracles to provide the same data, increasing the chances of getting accurate information. The second solution is using decentralized oracles, ensuring the use of tamper-proof data. As the adoption of blockchain technology continues to grow, new solutions to the blockchain oracle problem will likely be developed.

Types of Blockchain Oracles

Source: Chainlink

Oracles can be grouped into two broad categories: centralized and decentralized. Let’s discuss them separately, including their advantages and disadvantages.

Centralized Oracle

A centralized oracle is a system that serves as a single source of truth for data or information needed by a blockchain network. The oracle acts as an intermediary between the blockchain and the external world, providing information to smart contracts on the blockchain as required. 

A centralized oracle typically operates on a server or set of servers and is controlled by a single entity or organization. It is responsible for collecting data from various external sources, such as APIs and web scraping, and then formatting and transmitting the data to the blockchain. Provable is a typical example of a centralized oracle.

Advantages

Faster data retrieval: Centralized oracles can use specialized methods to retrieve data from trusted sources quickly.

Greater control: With a centralized oracle, a single entity controls the data fed into the smart contract, stamping more authority into the sourced data (especially when the entity is highly trusted).

Scalability: Centralized oracles can handle many requests, making them suitable for large-scale applications.

Disadvantages

Single point of failure: Since a single entity controls a centralized oracle, it can become a single point of failure for the system.

Lack of transparency: The data provided by a centralized oracle may need to be fully transparent, making it difficult for users to verify the accuracy of the information.

Centralized control: The centralized control of the oracle makes it highly vulnerable to censorship and goes against the decentralized aspect of smart contracts.

Decentralized Oracle

A decentralized oracle is a system that allows smart contracts on a blockchain to access external data securely. It works by using a network of nodes to collect and validate data from external sources and then uses a consensus mechanism to agree on the accuracy of that data.

Examples of Decentralized Oracles

Chainlink is the biggest decentralized blockchain oracle by market cap. It is built on Ethereum and uses a decentralized network of independent nodes to source data from various sources, such as APIs. Then it uses a reputation system and a consensus mechanism to ensure the accuracy and reliability of the data. Blockchain smart contracts then use the data to execute the terms of the contract.

Band Protocol is the second-largest decentralized blockchain oracle by market cap. It is built on Cosmos with cross-chain functionalities, and uses a decentralized oracle network to fetch data from various providers and delegated proof-of-stake (DPoS) to ensure that the data is accurate. The oracle contract uses the data to execute the terms of the contract.

Advantages

No single point of failure: A decentralized oracle is less likely to be compromised or shut down since a single entity does not control it.

Transparency: Transactions on a decentralized oracle are recorded on a public ledger before transmitting and storing them on a blockchain.

Censorship resistance: A decentralized oracle is censorship-resistant because a central authority does not control it.

Tamper-proof: Data stored on a decentralized oracle is secured using cryptography, making it tamper-proof.

Disadvantages 

Complexity: Decentralized oracles can be more complex to set up and run than centralized oracles.

Scalability: Decentralized oracles can be less scalable than centralized oracles because they rely on a distributed network of nodes.

Conclusion

Blockchain oracles expand the capacities of smart contracts by offering access to off-chain resources integral in harnessing useful and enhanced hybrid smart contract applications. Like how the internet presented radical changes to information sharing, oracle-based smart contracts are revolutionizing how people exchange value and execute automated contractual agreements. 

Comments

All Comments

Recommended for you

  • Trump: Details of US-Iran Agreement to Be Released After Signing on 19th

    On June 16, during the G7 summit in Évian-les-Bains, France, U.S. President Trump stated that the details of the US-Iran agreement will be made public after its official signing on the 19th. (Xinhua News Agency)

  • Iranian Foreign Minister Announces Memorandum Signing on June 19

    On June 15, Iranian Foreign Minister Amir-Abdollahian stated that a meeting between the heads of the Iranian and American negotiating delegations is expected to take place in Switzerland on June 19, during which a memorandum of understanding between Iran and the United States will be signed, followed by the first round of subsequent negotiations. (CCTV International News)

  • U.S. Senior Officials: U.S. and Iran Sign Memorandum of Understanding

    On June 16, a senior U.S. official stated that the United States has signed a memorandum of understanding with Iran. U.S. President Trump and Vice President Pence signed the memorandum, and the Speaker of the Iranian Islamic Consultative Assembly also signed the document. The official also mentioned that the agreement stipulates the immediate opening of the Strait of Hormuz and the lifting of U.S. sanctions on Iran. Traffic in the strait will significantly increase starting immediately.

  • BTC Surpasses $67,000

    Market data shows that BTC has surpassed $67,000, currently priced at $67,197.47, with a 24-hour increase of 4.94%. The market is highly volatile, so please ensure proper risk management.

  • Musk's Wealth Reaches $1.2 Trillion as SpaceX Surpasses TSMC in Valuation

    On June 15, according to the latest global billionaire rankings released by Forbes, Elon Musk, the head of Tesla and SpaceX, has seen his personal wealth soar to an astonishing $1.2 trillion, setting a historical record. He became the world's first 'trillionaire' in the previous trading day. This wealth phenomenon is primarily attributed to the strong performance of his two flagship companies. Recent market data shows that SpaceX (SPCX) has reached a total valuation of $2.28 trillion (approximately $2.28 trillion), surging 8% in a single day, officially surpassing semiconductor giant TSMC (TSM), which has a market value of $2.26 trillion, and entering the top tier of U.S. stock market valuations, ranking sixth. Currently, the top three in the U.S. stock market by total market value are Nvidia ($5.05 trillion), Google, and Apple. SpaceX, with its absolute dominance in the commercial space and Starlink sectors, continues to see its valuation skyrocket, becoming the core pillar of Musk's trillion-dollar fortune.

  • Philadelphia Semiconductor Index Soars 4.7% in Early Trading

    On June 15, the Philadelphia Semiconductor Index opened high, rising by 4.7%. Nvidia's stock price increased by 2.67%, TSMC's stock price rose by 3.76%, Broadcom's stock price went up by 3.37%, Micron Technology's stock price surged by 9.31%, Advanced Micro Devices' stock price climbed by 6.61%, and ASML's stock price gained 1.47%.

  • SpaceX Raises Approximately $85.7 Billion in Initial Public Offering

    On June 15, SpaceX announced that underwriters have fully exercised their over-allotment option in the IPO, purchasing an additional 83.33 million shares. SpaceX has raised approximately $85.7 billion through the IPO.

  • Nasdaq Golden Dragon China Index Rises Over 1%

    On June 15, the Nasdaq Golden Dragon China Index rose over 1%. Canaan Inc. increased by 13.84%, EHang soared by 10.86%, Zai Lab gained 5.59%, Xunlei rose by 5.16%, and Kingsoft Cloud climbed by 5.31%.

  • Anthropic Sued by User for Allegedly Inflating Subscription Usage Limits

    On June 15, according to The Wall Street Journal, a consumer is seeking compensation from Anthropic for its highest-tier subscription plan and has accused the company of exaggerating the usage limits provided. The lawsuit claims that Anthropic misled consumers regarding the usage restrictions of its Max 5x and Max 20x subscription plans. The cheapest Pro subscription for individual users costs between $17 and $20 per month, while the Max 5x costs $100 per month and the Max 20x costs $200 per month. The lawsuit alleges that Anthropic advertised the Max 5x and Max 20x plans as having 5 times and 20 times the usage limits of the Pro plan, respectively, but the actual limits are difficult to determine and appear to be far below the advertised levels. The lawsuit seeks to qualify for a class action on behalf of users who purchased these packages since April of last year.

  • ETH Surpasses $1800

    Market data shows that ETH has surpassed $1800, currently priced at $1804.82, with a 24-hour increase of 8.2%. The market is experiencing significant fluctuations, so please ensure proper risk management.