Blockchain Basics: Understanding Oracles & Price Feeds in Web3
Blockchain oracles are key to enabling a wide range of decentralized applications. They play the role of a trusted third party, querying, verifying, and authenticating external data so it can be used by smart contracts, and in turn, power the capabilities of next-generation dApps that can react to events that occur in the real world.
As such, the function of oracles is to connect deterministic blockchains to the real world, giving them access to useful data that’s generated either by other blockchain networks, or off-chain systems.
Why does Web3 need oracles?
One of the more interesting use cases of Web3 is decentralized insurance. Platforms such as Etherisc provide insurance policies for everything ranging from flight delays to crop failure, but they do so in a very different way. Instead of an insurance company paying out in the event that a farmer’s crop fails due to drought, its community of liquidity providers will do so instead. However, the lack of a centralized intermediary can complicate this.
Weather oracles can solve this problem by providing trusted weather data to blockchains. So if the weather oracle shows that it only rained five days during the summer, that provides evidence of the drought, allowing the smart contract to automate a payout to the farmers who took out an insurance policy with Etherisc. Alternatively, if there was plenty of rain and the farmer enjoyed a bumper crop, the weather oracle will inform the blockchain and no payout will be made.
Another example is decentralized Web3 betting dApps. Let’s say Alice and Bob placed a bet on the outcome of a football game. The amount of money they bet will be held in an escrow smart contract, and an oracle will provide the final score to that contract, so it knows who the money should be paid out to.
Oracles are most commonly used to deliver price feeds to DeFi platforms and DEXs that need reliable, accurate, and up-to-the-second prices for assets such as cryptocurrencies and tokenized commodities. An alternative kind of oracle involves random number generation, where a decentralized protocol will generate a verifiable random number and provide it to smart contracts that power lotteries, NFT launches, prediction markets, and more.
To avoid reliance on centralized third parties, most Oracle providers have created ingenious consensus mechanisms that incentivize “data providers” to provide accurate information. Before any data can be submitted by the oracle onto a blockchain, it must first be validated by a majority of nodes in the oracle network. This technique is known as “consensus”, and there are a variety of ways this can be achieved, such as with the proof-of-stake mechanism that’s used by a large number of blockchain platforms.
What are the most popular oracles?
Blockchain infrastructure platforms like QuickNode offer a wide range of blockchain data oracles to choose from, with many of them being highly specialized. The advantage of using such a platform is it provides access to all of the tools and resources that a developer needs to get started building Web3 dApps, as well as access to a globally distributed infrastructure that guarantees both availability and security.
With QuickNode, developers can build directly on the blockchain platform of their choice and quickly integrate the data oracle that best meets their needs. Many will look no further than Chainlink, which has cemented itself as the data provider of choice for hundreds of dApps across dozens of individual blockchain platforms. Chainlink operates a “push” architecture that involves sending regularly updated price feeds for hundreds of digital assets to blockchains at specified intervals and will provide additional updates if the price of an asset deviates to a significant degree before that interval is reached.
Pyth Network operates a different kind of architecture, pioneering a “pull” model that allows dApp smart contracts to request the latest price feed updates at any time. It claims to be much faster than Chainlink, with some asset prices updated at sub-second speeds.
Another popular oracle is UMA, which has created a specialized dispute arbitration system that makes it possible for arbitrary data types to be brought on-chain.
Driving blockchain innovation
The ability of oracles to provide trusted, off-chain data to smart contracts in a decentralized way has become a game-changer for the Web3 industry. Having catalyzed the birth of more sophisticated DeFi and trading tools, oracles are powering similar advances in areas such as GameFi and NFTs.
The blockchain oracle is a game-changer for Web3 development, acting as a bridge between on-chain functionality and off-chain reality. As blockchain’s use cases expand, we can expect to see the role of oracles take on more importance, catering to the demands of ever more innovative dApps.