Why we need decentralized oracles
Powering the smart contract economy with decentralized oracle networks
Dear Bankless Nation,
Oracles are a crucial piece of infrastructure for the crypto economy.
Today’s writer puts it like this—without oracles, blockchains are like computers without an internet connection. They’re cut off from the outside world and can only reference information native to the blockchain’s internal ledger.
This limits the use cases of crypto.
Oracles solve this problem.
Want a real-time price feed for ETH/USD to measure liquidation thresholds for a DeFi protocol like on Maker, Aave, or Compound? You need an oracle.
Want to trade a synthetic version of AMZN, AAPL, or TSLA? Oracle.
Since so much of DeFi is riding on oracles, we should learn more about them. Today ChainlinkGod unpacks the value of decentralized oracles.
Let’s dive in.
📺 Tune in for our AMA with Andy8052 from Fractional
We chat with the founder of Fractional, a new protocol for fractionalizing NFTs, on the explosive growth in the NFT sector this year.
Guest Writer: ChainLinkGod, Chainlink Community Ambassador
Decentralized Oracle Networks (DONs): Powering The Smart Contract Economy
Public blockchains are not maintained by a single centralized institution or tech monopoly like Facebook, Google, or Apple, but instead by a network of independent computers around the globe. Through economic incentives, these computers achieve global consensus on the current state of the blockchain without any centralized leader for coordination. As many Bankless readers probably know, this provides an array of valuable properties such as censorship-resistance, permissionless access, non-custodial asset management, and irreversible transactions.
However, there is a fundamental problem: Blockchains are like a computer without an internet connection.
Blockchains generate their strong security properties by only tracking activity happening within their own ledger. As a result, blockchains are effectively isolated networks and cannot natively connect to external resources in the real world that a smart contract may require, without losing all of the properties that make blockchains useful.
This is a problem because the vast majority of smart contract use cases require external data such as accessing the price of Ether against US dollars, the average temperature in Buenos Aires, the location of a shipping container with raw materials, the state of another blockchain network like Bitcoin, or any other piece of data that is not already stored on that blockchain’s native ledger.
To overcome the lack of external connectivity, an additional piece of infrastructure is required known as an “oracle,” which fetches data from off-chain sources and delivers it onto a blockchain so that the information can be consumed by smart contract applications. Oracles not only provide the delivery mechanism of transmitting data on-chain, but also serve as the validation mechanism required to ensure the data is high integrity. If smart contracts are to retain end-to-end determinism, the oracle mechanism needs to be as secure and reliable as the underlying blockchain because the oracle data input directly determines the output of consuming smart contracts.
As the famous saying goes, garbage in leads to garbage out.
As such, the oracle mechanism cannot be a single centralized node, as this introduces a single point of failure such as the node being corrupted or going offline. This would defeat the entire purpose of using a blockchain network consisting of thousands of nodes. Additionally, the oracle mechanism shouldn’t rely on a single data source since the data source could deliver faulty data and/or go offline.
Instead, the oracle mechanism must be decentralized at the node operator and data source level in order to ensure there is no point of failure. While blockchains and oracles aim to achieve different goals (the former providing consensus on transactions and the latter consensus on real world data), their complementary nature means similar approaches are taken to achieve security.
A properly secured Decentralized Oracle Network (DON) must also provide additional layers of security such as the ability to connect to high quality data sources (which provide accuracy and uptime guarantees), data integrity proofs through cryptographic signatures (when the data provider themselves runs the oracle node), data validation through a multi-layer aggregation process (mitigating downtime, outliers, and corrupted data), cryptoeconomic guarantees to incentivize proper operation (implicit incentives and explicit staking), as well as optionally provide data privacy (such as zero knowledge proofs).
Chainlink—the most widely adopted oracle solution—follows this defense approach to provide the smart contract ecosystem with a generalized framework for building DONs that open up access to any external data resource.
Currently, there are over 450+ Chainlink Price Feeds operating across a number of blockchain networks including Ethereum, Polygon, BSC, Avalanche, xDai, and Heco, with plans to expand access to many more blockchains and layer 2 solutions such as Arbitrum, Optimism, Solana, and beyond. The oracle network provides not only decentralized Data Feeds, but also a wide range of secure off-chain computation services including Verifiable Randomness, Keepers, and other various forms of off-chain computation in development like FSS, DECO, and Town Crier.
With properly secured DONs, developers can create hybrid smart contracts—applications which combine blockchain-based smart contracts and DON services to offer far more advanced features than on-chain logic in isolation. These applications leverage the best of both the on-chain and off-chain worlds to empower the use cases that have long been pitched as the core value proposition of smart contracts.
Use Cases of Decentralized Oracle Networks (DON)
While there are a virtually unlimited number of hybrid smart contract use cases enabled by DONs, I’ll cover a few that I think have significant disruptive power in the short, medium, and long term (including examples of DeFi apps you are likely already familiar with). With the crypto ecosystem in a constant flurry of innovation and progress, these use cases will continue to be expanded upon over time to meet the needs of their users.
Let’s dive in.
1) Decentralized Finance and Price Feeds
The first and primary use case we see of DON-powered hybrid smart contracts today is Decentralized Finance, otherwise known as DeFi. Arguably the product market fit of blockchain technology, DeFi provides a decentralized, permissionless, non-custodial, and censorship-resistant alternative to the broken traditional financial system of today. However, what is less commonly understood is that the DeFi ecosystem was made possible precisely because DONs exist.
For example, the #1 DeFi application by total value locked today is Aave, a decentralized money market that allows users to lend and borrow dozens of different on-chain tokens.
This creates a two-sided marketplace where lenders can earn passive yield on their idle tokens and borrowers gain access to working capital to deploy as they please. Decentralized money market protocols like Aave, Compound, Cream, Rari, and more use Chainlink Price Feeds to calculate the maximum loan size during the creation of a position as well as determine when positions become under-collateralized and must be liquidated, keeping the market as a whole solvent.
While DeFi-based money markets today are focused specifically on the lending and borrowing of native cryptocurrencies and stablecoins, new markets can and will be created in the future to support tokenized real world assets. For example, this allows users to borrow against tokenized real estate in replacement of a mortgage or borrow CBDCs to bankroll their business. As generalized infrastructure, such markets can theoretically support any type of tokenized asset that will exist in a backward compatible manner thanks to token standards such as ERC20 and ERC721.
Another powerful financial primitive made possible through Chainlink DONs are protocols such as Synthetix, which enable users to generate synthetic assets that are overcollateralized by on-chain crypto (SNX) and mirror the price of real world assets such as cryptocurrencies (e.g. BTC, ETH, LINK), fiat currencies (e.g. USD, EUR, JPY), commodities (e.g. gold, silver, oil), indices (e.g. FTSE, N225, sDEFI), and equities (e.g. TSLA, GOOG, AMZN). Backed by a global debt pool, users can “exchange” their synthetic assets at zero slippage for any other synthetic by simply switching the data feed that determines the value of their tokens.
Through the combination of on-chain collateral and Chainlink data feeds, synthetic versions of any asset or metric in the real world can be brought on-chain and into the crypto economy, including property valuations, CPI metrics, aggregate value of raw materials, TVL of a specific protocol, number of followers Vitalik has on Twitter, or other other metric that can be quantified and digitized as an on-chain data feed.
The potential here is virtually limitless, allowing users to tokenize anything and begin speculating and hedging without ever having to leave the on-chain ecosystem.
There are a number of other DON-enabled use cases in the DeFi ecosystem too such as decentralized/algorithmic stablecoins, yield aggregators, decentralized exchanges, perpetuals, options, futures, rebase tokens, prediction markets, yield farming, asset management, cross-chain tokens, fixed-rate yield, and much more.
2) Dynamic NFTs and Verifiable Randomness
NFTs have seen a major surge in public attention in 2021, with trading volume and the diversity of tokens minted going exponential. While many of these NFTs are static images or gifs, we have also seen the rise of dynamic NFTs supported by NFT platforms such as Ether Cards, which gamify the experience of acquiring and owning NFTs via external data inputs.
These external inputs can include real world data that changes the properties of the NFT in real time. This includes sports NFT whose value is pegged to player performance data or NFT marketplaces that allow artists to change their digital artwork over time such as an NFT that changes the background of an image according to the weather and time in New York City. An increasingly common way for NFTs and on-chain gaming applications to be augmented by external data is by leveraging verifiable randomness solutions such as Chainlink’s Verifiable Random Function (VRF).
With verifiable randomness, developers can augment their NFT by assigning provably random traits, distributions, and minting activities. One example of an NFT-based platform that leveraged verifiable randomness on the Polygon sidechain is Aavegotchi.
At launch, Aavegotchi’s smart contract called for randomness thousands of times on-chain to determine which Aavegotchi NFTs users received after opening “portals” (which had a limited supply of 10,000). Through this random-based gamification, users could take part in a “rarity farming meta-game” where users try to mint rare NFTs or level up existing NFTs by winning raffles and other games.
Another prime example includes the increasingly popular NFT based on-chain gaming application Axie Infinity that used verifiable randomness to determine the traits of a newly minted Origin Axies. Such Axies can have the chance to possess Mystic parts, which have historically sold for over 300 ETH.
Through the creation of dynamic NFTs, an entirely new user experience with no parallel in the Web2.0 world is introduced.
3) On-chain Audit Trails and Proof of Reserve
As the smart contract ecosystem grows, so too does the amount of stablecoins, wrapped cross-chain assets, and tokenized real-world assets. However, the collateral backing these tokens reside off-chain, meaning smart contracts cannot natively access the data required to audit these tokens and ensure proper collateralization.
The result is new risks related to transparency, undercollateralization, and fractional reserve lending. DONs can be used to overcome this issue through Proof of Reserve (PoR) feeds, which provide the necessary on-chain data to verify a token’s off-chain collateral.
By having an on-demand, on-chain audit trail for tokens collateralized by off-chain assets, users gain access to increased transparency and smart contracts can quickly protect against unforeseen fractional reserve activities by implementing application specific logic that executes when undercollateralization is detected. For example, a DeFi application may pause services temporarily or prevent the minting of more tokens from the specific undercollateralized assets. Proof of Reserve not only helps prevent systemic risks like the 2008 great financial crisis, but also creates a more trustworthy DeFi ecosystem for everyone.
In the case of stablecoins, which are often collateralized by US dollars held in a bank account off-chain, we see Proof of Reserve feeds for both Paxo’s PAX stablecoin as well as TrustToken’s TUSD stablecoin. With the latter, reserve data is provided by Armanino, a top-25 US auditing firm who provides real-time updates that attest to the off-chain USD bank holdings of TrustToken that back the TUSD stablecoin. Given TUSD exists across multiple blockchains, they have launched both Proof of Reserve and Proof of Supply data feeds on Ethereum, which can be cross-referenced by a smart contract application before allowing users to engage in economic activity with the stablecoin.
In addition to USD-backed stablecoins, we are also seeing the inevitable multi-chain reality playing out, where users want to bridge their cryptocurrencies across blockchains, such as bringing their BTC onto Ethereum so it can be used with the DeFi ecosystem. In this case, we have seen both Ren Protocol’s renBTC and BitGo’s WBTC tokens launch Proof of Reserve feeds to audit the true BTC holdings on the Bitcoin blockchain that back these cross-chain tokens. Similarly, smart contracts can reference these feeds before allowing interactions with cross-chain tokens, protecting users from the consequences of unbacked tokens like opening toxic loans or making unfair trades.
The concept of DON-enabled Proof of Reserve feeds goes far beyond these use cases and can allow for the auditing of real world asset backed tokens such as tokenzied real estate. This includes providing verification information regarding both the ownership and cash flows of the properties onto the blockchain, allowing users and smart contracts to analyze the true nature of the assets that back these tokens. As the DeFi economy swallows the traditional economy, the need for on-chain transparency will continue to increase.
4) Off-Chain Computation and Keepers
A common misconception regarding the nature of smart contracts is that they are autonomous, but in reality they are “asleep” by default and must be “awoken” in order to execute any state changes. This requires an on-chain transaction signed and initiated by a private key holder, otherwise known as an Externally Owned Account (EOA). This is acceptable for use cases where the users themselves are interacting on-chain, but there are many smart contract functions that need to be triggered on a standardized time or event-based schedule.
While DONs are well known for providing data delivery services, they can also perform trust-minimized forms of off-chain computation. This includes providing a decentralized transaction automation service in the form of “Keepers,” which monitor the on-chain state of a smart contract and/or real world events to autonomously trigger on-chain functions as required. One implementation of this is Chainlink Keepers, which leverage the same set of reliable oracle nodes that have already proven their reliability through operating decentralized Data Feeds.
An example use case of Keepers is automatically liquidating undercollateralized loans for decentralized money markets such as Aave. Here, Keepers would monitor positions on the platform and trigger the liquidation function on any loans that fall below the specific pool’s liquidation threshold. Aave’s smart contract would then verify the liquidation on-chain by cross-referencing Chainlink Price Feeds and then begin the liquidation process. As a result, the money market would provide users increased guarantees regarding the solvency of the platform through highly reliable liquidation bots.
Given Keepers provide a generalized transaction automation service, any smart contract function can be automated including executing limit orders, harvesting yield, issuing staking rewards, rebasing algorithmic stablecoins, releasing vested tokens, topping up token balances, managing debt positions, changing yield strategies, and much more.
Decentralized Oracle Networks (DONs) expand the capabilities of blockchain networks and smart contract applications, allowing them to achieve their true potential of providing superior digital agreements that execute exactly as expected for a wide range of use cases.
While DeFi is the most clear evidence of this today, it is more than likely that the next major smart contract use cases that become massively adopted will be a direct result of developers having on-chain access to the real world data from DONs.
There are simply an unimaginable number of use cases that are possible and the future has truly never looked brighter.
🔗 If you are interested in learning more about DONs, smart contracts, and the DeFi ecosystem, follow me on Twitter (ChainLinkGod), read some of my content written with my co-author (SmartContent), and take a listen to my podcast on Spotify (ChainLinkGod Podcast).
Understand the need for decentralized oracle networks (DONs)
Level up on more oracle content by subscribing to SmartContent
ChainLinkGod is a Chainlink Community Ambassador and co-author of the independent publication SmartContent. He provides educational resources regarding the Chainlink Network, DeFi ecosystem, and smart contract economy to all who are willing to listen. All opinions are his own
🙏Thanks to our sponsor
Balancer is an automated portfolio manager and liquidity protocol allowing you to deposit capital and earn a passive income on your portfolio. With Asset Managers, Balancer V2 takes this idea to a new level by leveraging smart investing strategies to maximizes your APY at all times. Welcome to the future of programmable liquidity—earn, trade, and build new applications on Balancer V2. Check it out here.
Sponsorship paid for by Balancer Labs🚀
Want to get featured on Bankless? Send your article to email@example.com
Not financial or tax advice. This newsletter is strictly educational and is not investment advice or a solicitation to buy or sell any assets or to make any financial decisions. This newsletter is not tax advice. Talk to your accountant. Do your own research.
Disclosure. From time-to-time I may add links in this newsletter to products I use. I may receive commission if you make a purchase through one of these links. Additionally, the Bankless writers hold crypto assets. See our investment disclosures here.