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

  • Rune DOG•GO•TO•THE•MOON ranked first in transaction volume in the past 24 hours

    According to Ord.io on social media platform, the top 5 trading volumes for runes in the past 24 hours are:

  • CARV announces completion of $10 million Series A financing, with OKX Ventures participating

    CARV announced the completion of a $10 million Series A financing round, led by Tribe Capital and IOSG Ventures. Consensys, OKX Ventures, Fenbushi Capital, No Limit Holdings, Draper Dragon, Arweave, ARPA, MARBLEX, and others participated in the round. The aim is to build the largest modular data layer for gaming and artificial intelligence, and to maximize data innovation while ensuring that individual users can derive value from internet sharing.Jeff Ren, partner at OKX Ventures, said, "CARV's revolutionary approach is reshaping the way we manage decentralized data. Its modular cross-chain protocol and ID aggregation solution cultivate data sovereignty and integrity while emphasizing security and efficiency. We are excited about this collaboration and look forward to seeing how OKX Web3 products can better collaborate with CARV's advanced cross-chain data layer."

  • El Salvador's official Bitcoin wallet refutes rumors it was hacked

    Salvadoran official cryptocurrency wallet Chivo Wallet denies reports that its source code and over 5 million user data related to KYC procedures have been hacked. The wallet's management department clarified that its data security has not been compromised and the leaked data did not come from their system.

  • Franklin Templeton Tokenizes $380M U.S. Treasury Fund on Polygon and Stellar

    According to Cryptoslate, Franklin Templeton tokenized a $380 million US government bond fund on the Polygon and Stellar blockchains to enable peer-to-peer (P2P) transfers without intermediaries.The company launched the Franklin on-chain US government money fund (FOBXX) in the form of BENJI tokens. Each token represents a portion of FOBXX and can be traded on public Polygon and Stellar blockchains. This innovation aims to simplify transactions and expand access, allowing investors to manage their assets more flexibly through direct trading.Franklin Templeton is incorporating blockchain technology into its financial operations to enhance asset management liquidity and efficiency. The company is responding to the growing demand of financial institutions by integrating traditional financial structures with modern technological solutions.

  • UK law enforcement agencies can now confiscate crime-related crypto assets without conviction

    The UK Home Office announced in a press release on Friday that new powers to seize cryptocurrencies used in crimes have come into effect. The Home Office stated that due to these new regulations, police in the country will no longer need to make an arrest before seizing cryptocurrency holdings, making it easier to seize assets known to have been obtained through criminal means, even if seasoned criminals are able to protect their anonymity or are located overseas.

  • DePIN project Natix completes $4.6 million financing

    DePIN project Natix has announced the completion of a $4.6 million financing round, led by Borderless Capital and Tioga Capital, with participation from Laser Digital, Big Brain Holdings, Escape Velocity, IoTeX, WAGMI Ventures, Moonrock Capital, under Nomura Securities (Nomura), as well as a group of angel investors. Natix is a DePIN project focused on map data, and is reportedly about to release tokens and airdrops on Solana.

  • Movement Labs raises $38m to enhance Ethereum ecosystem with Facebook's Move Virtual Machine

    San Francisco-based blockchain development team, Movement Labs, has raised $38m in Series A funding led by Polychain Capital and featuring participation from a range of investors. The funds will be used to bring Facebook’s Move Virtual Machine to Ethereum, addressing smart contract vulnerabilities and enhancing transaction throughput. Movement Labs aims to tackle smart contract vulnerabilities within the Ethereum ecosystem while introducing a novel execution environment designed for 30,000+ transactions per second.

  • Modular Data Layer for Gaming and AI, Carv, Raises $10M in Series A Funding

    Santa Clara-based Carv has secured $10m in Series A funding led by Tribe Capital and IOSG Ventures, with participation from Consensys, Fenbushi Capital, and other investors. The company plans to use the funds to expand its operations and development efforts. Carv specializes in providing gaming and AI development with high-quality data enhanced with human feedback in a regulatory-compliant, trustless manner. Its solution includes the CARV Protocol, CARV Play, and CARV's AI Agent, CARA. The company is also preparing to launch its node sale to enhance decentralization and bolster trustworthiness.

  • Shanghai Municipal Party Committee Secretary: Welcome Standard Chartered to establish more new institutions, new businesses and new platforms such as blockchain in Shanghai

    Chen Jinong, the Secretary of the Shanghai Municipal Party Committee, met with Weihao Si, the Chairman of the Board of Directors of Standard Chartered Bank, and Mark William D'Arcy, the Executive Director, and some members of the Board of Directors yesterday morning. Chen Jinong stated that he welcomes Standard Chartered Bank to leverage its own advantages, strengthen strategic connections, place more new institutions, businesses, and platforms such as wealth management and blockchain in Shanghai, focus on deepening pragmatic cooperation in technology finance, green finance, digital finance, and create more application scenarios, and provide comprehensive and professional service support for enterprises to go abroad.

  • Vitalik: Humanity needs to create a world where blockchain and artificial intelligence work together

    Vitalik Buterin, the founder of Ethereum, stated at BiddleAsia 2024 held at Signiel Seoul in the Songpa district on March 28 that artificial intelligence is a huge market and its importance is increasing day by day. We need to create a world where blockchain and artificial intelligence work together. Artificial intelligence can now create applications with 100 to 500 lines of code. Vitalik also stated that the ability to write 10,000 lines of code can eliminate most of the bugs in the Ethereum virtual machine.