The Role of Oracles in Decentralized Lending & Borrowing

Brady Gentile's picture
Brady Gentile
Co-Founder & CEOMarch 21, 2024

Decentralized lending and borrowing protocols have emerged as key drivers of innovation and growth in the world of decentralized finance (DeFi). These platforms enable users to lend and borrow cryptocurrencies directly from one another, without relying on traditional intermediaries like banks. You can learn more about lending & borrowing in this article from the Bonzo Finance DeFi Education series: “A Brief Overview of Decentralized Lending & Borrowing in Web3

For these protocols to function effectively and securely, they require accurate and reliable price feeds for the assets being lent and borrowed. This is where oracles come into play.

Oracles are entities that bridge the gap between blockchain-based smart contracts and real-world data, such as cryptocurrency prices. They play a crucial role in ensuring that the information used by DeFi protocols is up-to-date, accurate, and tamper-proof. In the context of lending and borrowing, oracles provide the necessary price feeds that enable these platforms to determine collateral requirements, calculate interest rates, and execute liquidations when needed.

In this article, we'll take a deep dive into the world of oracles and their significance in the DeFi lending and borrowing ecosystem. We'll explore what oracles are, how they work, and why they are essential for the security and stability of these protocols. We'll also examine some of the leading oracle solutions in the industry, discuss the importance of accurate price feeds, and highlight how platforms like Bonzo Finance are leveraging oracles to provide secure and reliable lending and borrowing services.

What are Oracles?

In the context of decentralized finance (DeFi), oracles are entities that serve as a bridge between smart contracts and the external world. They are responsible for collecting, verifying, and transmitting real-world data to decentralized applications, enabling them to execute smart contracts based on conditions that depend on information outside the blockchain.

Oracles collect and relay real-world data to smart contracts through a series of steps:

  • 1) Data Collection: Oracles gather data from one or more external sources, depending on their type and configuration.
  • 2) Data Validation: The collected data is verified for accuracy and consistency, often through consensus mechanisms or reputation systems.
  • 3) Data Formatting: The validated data is then formatted into a structure that is compatible with the target smart contract.
  • 4) Data Transmission: The formatted data is securely transmitted to the blockchain, triggering the execution of the smart contract based on the provided information.
  • 5) Data Storage: Some oracles may also store historical data for future reference or analysis.

By following these steps, oracle providers enable smart contracts to access reliable, real-world data, opening up a wide range of possibilities for decentralized applications, particularly in the lending and borrowing space.

Several oracle solutions have emerged as leaders in providing accurate, reliable, and secure price feeds to lending and borrowing protocols. Some of the most prominent oracle providers in the industry today include:

  • Chainlink: A decentralized oracle network that leverages a large, distributed network of nodes to provide secure and reliable data feeds to smart contracts across multiple blockchains.
  • Supra: A decentralized oracle solution designed to provide fast, secure, and reliable price feeds for various assets, with a focus on supporting DeFi applications on Hedera.
  • Pyth Network: A cross-chain oracle solution focused on providing high-fidelity, low-latency, and tamper-resistant price feeds for various assets, with a strong emphasis on serving the DeFi ecosystem.
  • Uniswap V3 Oracles: Built-in oracles within the Uniswap V3 decentralized exchange protocol, providing time-weighted average prices (TWAP) for assets traded on the platform.

The Importance of Accurate Price Feeds in Lending & Borrowing

Accurate price feeds are essential for the stability, security, and fairness of decentralized lending and borrowing protocols. These platforms rely on collateralization — ensuring that borrowers provide sufficient assets as security for their loans — and liquidation mechanisms — preventing the accumulation of bad debt by automatically selling a borrower's collateral when its value falls below a certain threshold — to mitigate risks and maintain the health of the lending ecosystem.

These mechanisms are only effective if the price data provided by oracles is accurate. Inaccurate price feeds can lead to issues such as:

  • Over-collateralization: When the reported price of the collateral asset is higher than its actual market value, forcing borrowers to provide more collateral than necessary.
  • Under-collateralization: When the reported price is lower than the market value, allowing borrowers to take out loans with insufficient collateral and exposing lenders to higher default risks.
  • Improper liquidations: Triggered by inaccurate price feeds, resulting in unfair losses for borrowers or exposing lenders to undue risks.

Real-world examples, such as the Compound protocol's liquidation event in November 2020 and the MakerDAO crisis in March 2020, highlight the severe consequences of price feed issues in DeFi protocols. To mitigate these risks, protocols like Bonzo Finance employ robust oracle solutions that aggregate data from multiple reliable sources and use consensus mechanisms to ensure data integrity.

How Oracles Ensure Accurate Price Feeds

To ensure the accuracy and reliability of price feeds, oracles employ various strategies and mechanisms. These approaches help to minimize the risk of manipulation, errors, or failures, providing lending and borrowing protocols with the high-quality data they need to function effectively.

One of the key strategies used by oracles is data aggregation from multiple reliable sources. By collecting price data from a diverse range of reputable exchanges, trading platforms, and data providers, oracles can reduce the impact of any single source's errors or anomalies. This approach helps to smooth out any outliers or temporary discrepancies, providing a more representative and stable price feed.

In addition to data aggregation, oracles also employ consensus mechanisms to validate the collected price data. These mechanisms involve multiple nodes or participants in the oracle network independently verifying the accuracy and consistency of the data. By requiring a majority of nodes to agree on the price feed before it is transmitted to the smart contract, oracles can ensure that the data has been thoroughly vetted and is less likely to be manipulated or corrupted.

Decentralization and redundancy are also critical aspects of ensuring accurate price feeds. Decentralized oracle networks, such as Pyth Network and Supra, rely on a distributed network of nodes to collect, validate, and transmit data. This approach minimizes the risk of a single point of failure or manipulation, as any malicious actor would need to control a significant portion of the network to influence the price feed.

Furthermore, most oracle solutions incorporate redundancy by using multiple independent oracle networks or data sources. By cross-referencing price feeds from different providers, lending and borrowing protocols can further enhance the accuracy and reliability of the data they rely on. This redundancy also helps to ensure that the protocol can continue to function smoothly even if one oracle network experiences issues or downtime.

Bonzo Finance’s Approach to Oracle Implementation

At Bonzo Finance Labs, the team understands the critical importance of accurate and reliable price feeds for lending and borrowing. To ensure the stability, security, and fairness of the Bonzo Finance platform, the team has carefully selected and integrated Supra oracles and are planning to implement Pyth, as well. The teams decision to integrate both Supra and Pyth Network is driven by a commitment to providing the highest level of security, reliability, and accuracy for users.

Supra, a decentralized oracle network, offers fast, secure, and reliable price feeds for a wide range of assets, including Hedera Token Service (HTS) tokens that are native to projects in the Hedera ecosystem. Supra oracles are live on 50+ testnet networks, including Hedera, Ethereum, Aptos, Avalanche, Arbitrum, Polygon, and more.

The HTS assets supported by Supra today include:

  • $HBAR
  • $HBARX
  • $SAUCE
  • $XSAUCE
  • $JAM
  • $HST
  • $DOVU
  • $HELI
  • $CLXY

Supra Oracles revolutionized price feeds for DeFi protocols by leveraging the innovative Distributed Oracle Agreement (DORA) consensus mechanism. DORA ensures high-fidelity data feeds while maintaining decentralization and security. In the next article for Bonzo Finance’s technical deep-dive, we’ll explore how DORA works and the value it offers both DeFi protocols utilizing Supra, as well as users of those protocols.

To further ensure the accuracy and reliability of price feeds, the Bonzo Finance protocol and team employ a range of strategies and best practices, including:

  • Regular monitoring and analysis of price feed data to identify any unusual patterns or discrepancies
  • Continuous evaluation of oracle integrations to ensure they meet a high standard of performance, security, and reliability
  • Ongoing communication and collaboration with oracle partners to address any issues or concerns and explore opportunities for further improvement
  • Transparent communication with users about oracle integrations, including any changes or updates to the approach

Conclusion

Bonzo Finance Labs is committed to contributing to a protocol that offers users a reliable, secure, and user-friendly lending and borrowing experience. By integrating best-in-class oracle solutions like Supra and Pyth Network, the team strives to create a platform that empowers users and fosters the growth of the DeFi ecosystem on Hedera.

We invite you to explore Bonzo Finance, join the community on Discord and 𝕏, and stay updated via newsletter on the latest developments and educational resources as we work together to shape the future of decentralized finance on Hedera.

Share this post on