Understanding Digital Oracles
Digital oracles are important elements in the functioning of blockchain networks.
A blockchain is a closed ecosystem that has very few points of contact with the outside world. This statement is relevant for all types of blockchains, whether it is Bitcoin (BTC), Ethereum (ETH), or others.
For instance, a personal computer is a powerful tool, but a lack of internet connection may limit its functionality. A blockchain supporting smart contracts is similar to it in many ways. It contains all kinds of built-in macros capable of processing huge data streams, but it can't get it from external sources.
This is where oracles step in. They serve as external data providers that deliver off-chain data to the blockchain.
How digital oracles work
Any oracle has three key functions:
• Listen and detect requests for any external data inside the blockchain network;
• Extract the requested data from external systems;
• Broadcast extracted data back to smart contracts.
Oracles may serve as a bridge for cross-chain communication or send data from a centralized system to a blockchain. One oracle can transfer the data to a blockchain, while the other communicates with external ecosystems.
Until 2017, most of the solutions in the market were centralized. A sudden failure could leave blockchain with no external data and, thus, affect thousands of users, with their funds locked in smart contracts.
An example of such an interaction is demonstrated below:
Imagine a place where the weather changes dramatically and the only source of information about it is the service called ”Weather.” In case it goes down, people won’t know whether it will be hot, rainy, or stormy outside. This means taking risks when choosing outfits.
Decentralized oracles eliminate such issues, since they obtain data from multiple sources at once. This data is received simultaneously by all oracles, wherein they exchange information between each other. As a result, each oracle receives information verified by other oracles.
A real-life example
The Compound service provides loans in cryptocurrencies, where users pledge one cryptocurrency and get another one which they can further use at their own discretion. If the loan’s price starts to exceed the collateral, due to a rapid price surge, the smart contract automatically liquidates it.
The example above demonstrates how relying on a centralized source of information may result in huge losses. In this case, the Compound protocol users lost nearly $100 million.
It happened because the Compound protocol was getting market data on DAI stablecoin, which is equivalent to the U.S. dollar, from a single source of information — the Coinbase Pro cryptocurrency exchange. On Nov. 26, 2020, a DAI pump on Coinbase Pro resulted in a rapid price surge to $1.30.
That moment, the value of the loans provided subsequently exceeded their collaterals, which triggered a series of automatic liquidations totaling $88.4 million. It also affected the dYdX decentralized protocol’s workflow and caused additional losses of about $8 million.
That wouldn't happen if the Compound service used oracles that extract data from multiple sources at once. A decentralized oracle would mark this unusual surge in the DAI price on a single exchange as an anomaly, and would not react to it.
Today, when the popularity of DeFi projects is on the rise, the importance of oracles is higher than ever. They ensure protocols always have relevant market data to allow investors to trade inside smart contracts, without using traditional exchanges.
The current TVL (total value locked) would unlikely have been achieved without the use of decentralized oracle services. They bridge the gap between on-chain and off-chain systems, allowing them to exchange data and open new ways for blockchain technology.