Coins: 12,872
Exchanges: 940
Market Cap: $2.091T 1.3%
24h Vol: $59.656B
Gas: 38 GWEI
Go Ad-free
Guides
TABLE OF CONTENTS

What is a Blockchain Oracle and How It Automates Smart Contracts

4.4 | by Josiah Makori

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. 


What are Crypto Oracles on the Blockchain

​​​​​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.

How do oracles work?

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

Centralized vs Decentralized 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. 

Tell us how much you like this article!
Vote count: 25
Josiah Makori
Josiah Makori

Josiah is a tech evangelist passionate about helping the world understand Blockchain, Crypto, NFT, DeFi, Tokenization, Fintech, and Web3 concepts. His hobbies are listening to music and playing football. Follow the author on Twitter @TechWriting001

Related Articles

coingecko
Continue in app
Track prices in real-time
Open App
Select Currency
Suggested Currencies
USD
US Dollar
IDR
Indonesian Rupiah
TWD
New Taiwan Dollar
EUR
Euro
KRW
South Korean Won
JPY
Japanese Yen
RUB
Russian Ruble
CNY
Chinese Yuan
Fiat Currencies
AED
United Arab Emirates Dirham
ARS
Argentine Peso
AUD
Australian Dollar
BDT
Bangladeshi Taka
BHD
Bahraini Dinar
BMD
Bermudian Dollar
BRL
Brazil Real
CAD
Canadian Dollar
CHF
Swiss Franc
CLP
Chilean Peso
CZK
Czech Koruna
DKK
Danish Krone
GBP
British Pound Sterling
GEL
Georgian Lari
HKD
Hong Kong Dollar
HUF
Hungarian Forint
ILS
Israeli New Shekel
INR
Indian Rupee
KWD
Kuwaiti Dinar
LKR
Sri Lankan Rupee
MMK
Burmese Kyat
MXN
Mexican Peso
MYR
Malaysian Ringgit
NGN
Nigerian Naira
NOK
Norwegian Krone
NZD
New Zealand Dollar
PHP
Philippine Peso
PKR
Pakistani Rupee
PLN
Polish Zloty
SAR
Saudi Riyal
SEK
Swedish Krona
SGD
Singapore Dollar
THB
Thai Baht
TRY
Turkish Lira
UAH
Ukrainian hryvnia
VEF
Venezuelan bolívar fuerte
VND
Vietnamese đồng
ZAR
South African Rand
XDR
IMF Special Drawing Rights
Cryptocurrencies
BTC
Bitcoin
ETH
Ether
LTC
Litecoin
BCH
Bitcoin Cash
BNB
Binance Coin
EOS
EOS
XRP
XRP
XLM
Lumens
LINK
Chainlink
DOT
Polkadot
YFI
Yearn.finance
Bitcoin Units
BITS
Bits
SATS
Satoshi
Commodities
XAG
Silver - Troy Ounce
XAU
Gold - Troy Ounce
Select Language
Popular Languages
EN
English
RU
Русский
DE
Deutsch
PL
język polski
ES
Español
VI
Tiếng việt
FR
Français
PT
Português
All Languages
AR
العربية
BG
български
CS
čeština
DA
dansk
EL
Ελληνικά
FI
suomen kieli
HE
עִבְרִית
HI
हिंदी
HR
hrvatski
HU
Magyar nyelv
ID
Bahasa Indonesia
IT
Italiano
JA
日本語
KO
한국어
LT
lietuvių kalba
NL
Nederlands
NO
norsk
RO
Limba română
SK
slovenský jazyk
SL
slovenski jezik
SV
Svenska
TH
ภาษาไทย
TR
Türkçe
UK
украї́нська мо́ва
ZH
简体中文
ZH-TW
繁體中文
Login to track your favorite coin easily 🚀
By continuing, you agree to CoinGecko Terms of Service and acknowledge you’ve read our Privacy Policy
or
Forgot your password?
Didn't receive confirmation instructions?
Resend confirmation instructions
IT'S FREE! Track your favorite coin easily with CoinGecko 🚀
By continuing, you agree to CoinGecko Terms of Service and acknowledge you’ve read our Privacy Policy
or
Password must contain at least 8 characters including 1 uppercase letter, 1 lowercase letter, 1 number, and 1 special character
Didn't receive confirmation instructions?
Resend confirmation instructions
Forgot your password?
You will receive an email with instructions on how to reset your password in a few minutes.
Resend confirmation instructions
You will receive an email with instructions for how to confirm your email address in a few minutes.
Get the CoinGecko app.
Scan this QR code to download the app now App QR Code Or check it out in the app stores