Notice: Undefined index: Features in /data/phemex/wp/wp-content/themes/knowall/header.php on line 1412
combobox arrow
Phemex Blog
Phemex Crypto Blog: Learn the latest news, updates, and industry insights on bitcoin futures, bitcoin trading, crypto derivatives exchange, and related blockchain technology.

What are Blockchain Oracles: Providing Data to Smart Contracts

While blockchains are very powerful, they have one notable limitation: They cannot communicate with data sources outside their own network. The secure, decentralized structure of a blockchain makes it isolated.

As such, smart contracts can’t communicate with data sources such as servers, APIs, and feeds. To address this limitation, blockchains can use intermediary tools called oracles that help smart contracts communicate with external data sources.

blockchain oracles

What is a Blockchain Oracle?

Oracles are computer programs that connect blockchains with data sources outside their own network in order to extract data. Oracles only work on blockchains that support smart contracts. Bitcoin doesn’t have smart contracts, so oracle services aren’t compatible with its network. But many other blockchains are compatible with oracles, including the following:

Smart contract–compatible blockchains allow developers to create custom tokens and execute actions on their blockchains. Their smart contracts can be connected to oracle services that execute code based on the information they receive from the outside world.

Oracles can connect multiple blockchain networks, giving disconnected blockchains a way to communicate and derive data from sources outside the network. For example, Ethereum’s smart contracts can only run on the Ethereum network, and can’t communicate with the Cardano network on their own. But a Chainlink oracle could derive data from Ether’s blockchain and pass that data to the Cardano blockchain if their smart contracts connect to the same oracle. This functionality allows developers to build apps that can communicate between different blockchains.

How Oracles Work

Blockchain oracles work by querying and authenticating data from databases or other external sources. An oracle itself is not the data source, but merely a connector between the smart contract and the source.

isolated blockchains communicating with the external world
How isolated blockchains communicate with the external world (Source: ResearchGate)

Data sources can be configured to work with an oracle and supply data to the blockchain. For example, a server at Phemex could be used to tell the price of Ether (ETH) and send price data to an oracle for a smart contract. A more complex oracle could involve multiple servers around the world forming a consensus on ETH’s price, as pictured above.

An oracle can alert the smart contract about information from the outside world, such as the price of stocks, weather, transaction details, or other services. This data could be used to build complex decentralized applications (DApps). The oracle is programmed to send data to and from the blockchain network.

For example, an oracle could access weather data from a source, such as Google’s “Big Query” platform, to query historic weather data for a geographic area. This could be used to draft crop insurance agreements for farmers in the area using smart contracts.

Banking services and marketplaces could use oracle price feeds to calculate the value of collateral, interest payments, and loan settlement. The AAVE marketplace is an example of a working decentralized marketplace that relies on oracles provided by Chainlink (LINK).

blockchain networks, oracles, and the web
Relationship between blockchain networks, oracles, and the web (Source: SebaBank)

Blockchain oracles don’t work without a smart contract invoking them. The oracle only starts working once a programmer requests that it activate a certain part of a smart contract. In most cases, this consumes resources, and oracle services charge money for the service.

The Chainlink marketplace directly sells oracle services from multiple nodes (computers) that run API calls and data requests from external sources. If an operator sets the price to 0.01 LINK per API call, they will be paid whenever the request is invoked from the smart contract.

Price feeds are the most commonly used oracles, and there are currently over 2,900 price feeds available on the Chainlink marketplace. They are used to show and compute current market prices for cryptocurrencies and fiat currencies.

Theoretically, oracle services help smart contracts achieve 100% of their potential by allowing them to communicate with the outside world. However, companies still prefer the security of running their own centralized oracles for payments and rarely use decentralized oracles.

Types of Blockchain Oracles

Blockchain oracles differ in the way they’re programmed to extract data and communicate with blockchains. Most oracles can be classified as either software or hardware oracles:

  • Software oracles communicate with programs written for the web. They derive data from structures such as databases (MySQL, NoSQL, MongoDB, etc.), data servers, and feeds (news aggregators, price feeds, etc.). This is the most commonly used oracle type.
  • Hardware oracles communicate with hardware. For example, a voting machine could communicate with a smart contract via oracles and inform it of the total number of voters. For another example, a barcode scanner could send data to a smart contract about products being purchased in a supermarket with the help of oracles.

Centralized vs. Decentralized  Blockchain Oracles

A blockchain oracle can be centralized or decentralized, depending on the number of sources it derives data from.

Centralized Oracles

Centralized oracles query data from one external source, such as a database or an API. The team is fully in control of the data source/server, and they use that to pass data to their oracle for smart contract use. For instance, Uniswap uses its own servers and oracles to tell the Uniswap token’s price. In this case, the developer team is placing their trust in the accuracy of their own data source.

Centralized oracles provide a highly secure structure for blockchain projects that want to control their own data sources. If centralized oracles are used to broadcast info on the blockchain, the accuracy of their data can only be compromised if their external database is breached.

get free crypto by just watching videos

Decentralized Oracles

Decentralized oracles use multiple sources to come to a consensus. For example, AAVE holds $15 billion in assets and secures them using decentralized oracles. Developers are not in control of the data sources and the oracles calculate the accuracy of the information based on multiple sources.

Decentralized oracles are secure, but if the developer is not in control of the oracle, they must trust a third-party oracle service to deliver accurate information.

Features of Blockchain Oracles

Blockchain oracles work on a parsing principle, and send network requests to extract data from a certain source. Parsing means taking data from one source such as a Google database, then converting it to another format, such as ETH’s programming language Solidity.

The node software is often written in the Golang or Rust programming languages. They can connect to databases/APIs provided by banks, stock markets, weather sources, and other services.

Blockchain oracles extracting data
Blockchain oracles extracting data from different sources (Source: Chainlink)

On a technical level, blockchain oracles do the following things:

  • Monitoring: monitoring the blockchain network to check for requests coming from the smart contract
  • Data extraction: receiving requests and fetching data from external sources such as third-party APIs, feeds, servers, or hardware products
  • Validation: validating the accuracy of the data by cross-referencing it with other sources, and in some cases organizing the data before passing it to the smart contract
  • Calculation: calculating data from third-partysources and applying mathematical formulas to achieve a certain purpose. For example, the oracle can compare a cryptocurrency’s price on different exchanges and calculate the average price.
  • Action: transmitting computed data to the blockchain to take certain actions, such as approving or rejecting a transaction.

Risks Involved with Blockchain Oracles

The use of oracles carries security risks for smart contracts. For one, an oracle could broadcast false data that causes a smart contract to take an undesirable action. The real risks are not hackers, but oracle providers themselves. The best way to secure an oracle is to own the oracle and the data source.

Developers have to rely on blind trust that third-party oracle providers are honest and will not abuse their oracles for personal gain. Decentralized oracles can be secured by using consensus-based algorithms that derive data from multiple sources. However, if the original sources of data are breached, then the consensus-based structure will fall apart as well.

For example, an oracle provider could claim Ether’s price is $3,000 when its actual price is $4,000. A decentralized exchange that uses their oracles would show Ether trading at $3,000. Then, the oracle provider could start longing ETH and making a huge profit.

Earn 8.5% apy on Crypto Interest account

Blockchain Oracle Adoption

Blockchain oracles are used for decentralized finance by services such as UniSwap, AAVE, SushiSwap, and others. However, the global financial establishment doesn’t use smart contracts. The mainstream adoption of oracle services will depend on the adoption of smart contracts by large financial institutions.

Oracles are widely used on decentralized exchanges, and the Chainlink marketplace currently protects over $30 billion in decentralized assets since its launch in 2017. Lending services such as AAVE currently hold over $15 billion in assets and rely on oracles for calculation purposes.

Visa recently deployed a test smart contract on Ethereum’s Ropsten network, a test network for smart contracts. The financial services giant is currently developing a protocol for CBDCs (central bank digital currencies). This could pave the way for major financial players to start using smart contracts and oracle services.

Banks and digital payment services largely refuse to use smart contracts for the safety of their customers. PayPal supports ETH, which is based on a smart-contract enabled blockchain, but doesn’t use smart contracts for automatic payments. PayPal’s centralized servers calculate ETH’s price and use the data to convert the user’s balance to USD.

Conclusion

Blockchain oracles allow smart contacts to communicate with the external world, but lack the safeguards of centralized oracles with verified data sources. The adoption of oracles and oracle services at large will depend on how financial services respond to the crypto revolution.

This is not likely in the near future, as centralized banking institutions already have methods to send crypto transactions without using smart contracts. Moreover, CDBCs are currently in an early stage of development.

Investors who are bullish on oracle services and tokens should be aware there is a long road ahead before decentralized smart contracts are made safe for mainstream adoption. If large payment services such as Visa start deploying smart contracts to send payments, oracles are likely to gain widespread adoption.


For any inquiries contact us at support@phemex.zendesk.com .
Follow our official Twitter account to stay updated on the latest news.
Join our community on Telegram to interact with us and other Phemex traders.
Phemex | Break Through, Break Free