What Is DeFi (Decentralized Finance)?
Decentralized finance, or “DeFi,” refers to the emerging blockchain-based ecosystem of permissionless and transparent financial services.
DeFi is one of the most significant advancements enabled by blockchains, smart contracts, and oracles. While DeFi started out as a movement to recreate common financial instruments on decentralized infrastructure, it has rapidly expanded to power an array of entirely new products and markets.
In the DeFi economy, users can access a similar financial application stack as they would in traditional finance but without requiring the involvement of centralized intermediaries. By using open-source protocols running on censorship-resistant and decentralized networks, DeFi applications provide global permissionless access, mitigate counterparty risk, and interoperate with other applications to enable more advanced financial products.
In this article, we outline what DeFi is, how it works, and describe the different financial primitives that currently exist. We then discuss the risks inherent to DeFi and how oracles can help mitigate them, as well as how developers can leverage Chainlink decentralized oracle networks to build feature-rich DeFi applications.
How Does DeFi Work?
The global economy today operates on disparate systems that entrust significant amounts of capital and arbitration to large, centralized financial institutions. This often precludes new users from accessing and participating in financial markets and limits developers from easily creating new financial products. Such a fragmented and high-barrier economic landscape results in a stagnant, opaque, and sometimes unreliable financial system that is unable to keep up with user demand while also taking on systemic risks.
On the other hand, public blockchain infrastructure is rooted in the open-source movement, where anyone with an Internet connection can access a global, decentralized, and peer-to-peer financial system without ever needing to entrust a custodian with their assets. Since DeFi applications run on the same infrastructure (i.e., a blockchain), their underlying logic is enforced by an inherently secure and deterministic environment, providing complete transparency around the rules governing the system and facilitating seamless connectivity between different DeFi applications.
Since the code powering DeFi apps is available for anyone to audit, users have greater confidence that their financial agreements will execute exactly as programmed. Having an open access financial system not only reduces development and compliance costs for developers but also allows for bridges in the economy between what would otherwise be distinct economic segments.
A key property differentiating decentralized finance from traditional financial infrastructure is the design principle of permissionless composability. Composability allows for various different components in the DeFi ecosystem to be combined to create a structure that is greater than the sum of its parts. This allows DeFi developers to focus on their own application’s unique business logic, given they can leverage pre-existing open-source infrastructure for certain components. Since dApp developers can create unique combinations of DeFi protocols without any special permissions, the DeFi innovation cycles generate stronger network effects and move faster than what we have seen in traditional finance. To further understand DeFi, let’s identify the most common use cases.
Overview of DeFi Applications
Stablecoins are a core component of DeFi that allow fiat currencies like the U.S. dollar and other assets to be represented on the blockchain as digital tokens. A stablecoin is a representation of an underlying asset and tries to maintain a 1:1 peg with it through various mechanisms. The desire for relative stability in the often volatile cryptocurrency markets has propelled the aggregate value of all stablecoins to be over $100B.
There are various stablecoin designs that aim to provide different guarantees for maintaining their peg, including fiat-backed stablecoins, decentralized stablecoins, and algorithmic stablecoins. Fiat-backed stablecoins represent fiat currency on the blockchain and are backed by off-chain collateral. For example, TrueUSD (TUSD) is a U.S. Dollar stablecoin backed by USD in an off-chain bank account, which uses Chainlink Proof of Reserve to present continuous on-chain audits attesting to its 1-to-1 collateralization. Decentralized stablecoins, on the other hand, are often issued as overcollateralized loans using crypto collateral for increased resilience and transparency. The peg is maintained through changing interest rates, which encourage more or less borrowing.
Algorithmic stablecoins aim to maintain their peg through various cryptoeconomic mechanisms. An example is Fei Protocol, which effectively functions as an algorithmic central bank where the peg is upheld by the protocol on the open market through a process called reweighting. Users can mint the stablecoin FEI with an equivalent deposit value of ETH, which gets added to the protocol’s reserves to be used as Protocol Controlled Value (PCV). PCV represents all assets that aren’t redeemable by users. If FEI is trading below the peg, PCV is used to buy FEI on the open market to push the price up, and if FEI is trading above the peg, more FEI is minted and sold on the open market to push the price down.
Decentralized Exchanges (DEXs)
Decentralized exchanges allow for any developer launching a token to instantly access liquidity and large existing user bases without having to manage centralized exchange listings. Users can swap between digital tokens without needing the involvement of any centralized entity, interacting only with permissionless and non-custodial smart contracts.
A subset of DEXs called Automated Market Makers (AMM) fundamentally alter the mechanism underlying electronic exchange and are one of the most impactful innovations in decentralized finance. Instead of using a traditional central limit order book (CLOB), where buy and sell orders are paired by the exchange’s matching engine, both sides of the trade are pre-funded using on-chain liquidity pools. Liquidity pools allow users and other smart contracts to instantly swap between the tokens contained in the two-sided pool (e.g., the ETH/USDC pool contains ETH and USDC tokens) in a completely automated and non-custodial manner. Any user can become a liquidity provider and earn passive income from trading fees derived from users making swaps within the pool.
Since pricing is determined by an algorithm instead of transactions in an order book, AMMs allow for immediate liquidity for any digital token. Available in a permissionless manner for anyone with an Internet connection, AMM-based DEXs have contributed significantly to price discovery in what would otherwise likely be illiquid markets. AMMs such as SushiSwap, Uniswap, and more have experienced immense growth in trading volume, number of users, and value locked in their liquidity pools. With continuous improvements to capital efficiency, more customizable liquidity provision parameters, and innovative ways of mitigating impermanent loss, they are primed to attract more capital in the future.
Decentralized Money Markets
Money markets are one of the fundamental components of a well-working economy. They are venues where borrowers and lenders are connected. The ability to borrow funds or earn a yield on idle capital generates a significant amount of economic activity. Money markets have traditionally been facilitated by centralized entities, which grants them significant power over this key segment of the global economy and the funds flowing through it.
Decentralized money markets enable users to borrow and lend digital tokens using blockchain-based smart contracts in a permissionless way without custodians. These decentralized money marketplaces are governed by open-source code that is managed by a community of distributed stakeholders, democratizing the supply and demand side.
Applications like Aave, Compound, and CREAM have seen tens of billions of dollars of value flow through their protocols thanks to their non-custodial nature that reduces single points of failure. Decentralized money markets rely on overcollateralization, where users are required to deposit more collateral than what they intend to borrow. They then use on-chain price feeds supplied by oracles to determine users’ current collateralization ratio—the ratio of users’ collateral value to their outstanding loan value—which is then used to issue fair market loans, liquidate undercollateralized positions, and calculate interest payments.
Synthetic assets are financial instruments that derive their value from an underlying asset or benchmark (e.g. synthetic gold tracks the price of gold). Historically, the creation of these kinds of financial instruments has been the privilege of large institutions since a large degree of trust is required with the involved capital at risk. However, with the permissionless framework of DeFi, anyone can build an open-source financial primitive that is available to the public and provides strong guarantees for its intended execution.
A fundamental aspect of the security of blockchain-based synthetic assets is access to high-quality, tamper-proof pricing data. Since the management of synthetic assets and the settlement of swaps is determined by external data sources for the underlying assets, oracles are foundational infrastructure for providing reliable on-chain valuations when it comes to these blockchain-based assets.
Yield farming (or liquidity mining) is a new primitive enabled by DeFi that can be effective in incentivizing liquidity for a project, launching a fair distribution of a new token, and growing an active and long-lasting community. Yield farming incentives reward users who provide liquidity or otherwise contribute to the health of a decentralized protocol. The two main goals of yield farming are often to incentivize users to bootstrap usage of the project or to distribute newly launched tokens with governance rights over the protocol to a decentralized set of participants.
Yield farming has proven to be an effective way of kickstarting a DeFi ecosystem by cultivating a network effect, bootstrapping supply-side liquidity for a project, and creating a community of stakeholders primarily made up of users of the protocol. Yield farming incentives come in many forms based on individual project goals, but they often involve leveraging existing infrastructure to establish unique reward schemes that are the most effective at achieving their intended purpose. DApp developers have a great amount of creative freedom over what distinct protocol parameters they would like to leverage in their liquidity mining schemes to infuse their ecosystem with a strongly aligned community of active stakeholders.
If you’re a developer looking to build a yield farming dApp, check out how to build a DeFi yield farming application using Chainlink Price Feeds.
While DeFi is already reshaping how transactions happen in the on-chain economy and how value flows between what otherwise would be isolated economic environments, there are inherent risks involved that need to be identified and mitigated.
Mitigating the Risk Factors of DeFi With Chainlink
Blockchains are designed to maintain their consensus security based on data that is already stored on the blockchain (on-chain), such as ownership of tokens. However, DeFi contracts often rely on data that is external to the blockchain (off-chain) to execute, such as asset prices, interest rates, volatility metrics, and more. This data needs to be securely transferred onto and off the blockchain, which requires connecting the on-chain environment with the off-chain world and its abundance of data.
Though smart contracts can unlock new economic opportunities, access to high-quality, tamper-proof data has historically been prohibitively difficult. No matter how well a smart contract is designed, it ultimately depends on the data it receives. This issue is commonly referred to as the blockchain oracle problem, and it concerns most types of DeFi applications.
The blockchain oracle problem has been discussed at length, but the challenge of data quality is an equally important consideration when it comes to DeFi applications. Having dApps source data from premium off-chain data providers is an essential component of maintaining a healthy DeFi ecosystem that is resistant to oracle manipulation attacks (such as flash loan attacks) and numerous other potential outlier events.
Composability allows for faster iteration cycles and interoperable applications by default but also can introduce systemic risk in the DeFi ecosystem if faulty oracles are used. For example, a low-quality external data source from an insecure oracle can have far-reaching consequences when a multitude of DeFi applications are connected to create an exotic financial product. A chain of connected “money LEGOs” is only as strong as its weakest link, and increasing an application’s composability can create edge cases that need to be mitigated against. As a result, high-quality data sources that avoid manipulation are vital to protecting users and mitigating systemic risk within DeFi.
DeFi use cases that already heavily rely on high-quality external data sources through oracles include:
Algorithmic stablecoins like FEI, which need a reference price to maintain the peg.
Money markets like Aave and Compound, which need oracles to calculate the value of collateral, interest rates, and liquidations.
Synthetic asset protocols like Synthetix and dYdX, which need accurate market data to mint, burn, swap, and liquidate synthetic assets.
Asset management platforms like Set Protocol, which need price data to periodically purchase and sell assets to maintain a certain allocation in a basket of assets—a process called rebalancing.
To provide these protocols with a secure source of external data, Chainlink oracle networks serve as secure decentralized middleware for connecting on-chain and off-chain environments. Chainlink allows DeFi developers to give their users the highest data quality, security, and reliability guarantees regarding their smart contract’s correct and timely execution. Ultimately, Chainlink has helped reduce systemic risks in the DeFi ecosystem and has enabled users to trust smart contracts with tens of billions of dollars of value across a multitude of live DeFi applications.
Discover the wide range of smart contract applications that blockchain developers are building with Chainlink oracles, from DeFi protocols to NFTs, parametric insurance, and decentralized identity solutions.
Creating Next-Generation DeFi Applications Using Chainlink Oracles
Blockchains are a highly secure environment for enabling collaboration, as the underlying mechanisms that enforce agreements are executed on a decentralized network of nodes that no individual participant can undermine. As a result, DeFi has opened up new avenues for developers to experiment with innovative forms of economic and social coordination on the Internet. Even though the DeFi economy has already amassed considerable size, it has substantial room to grow and benefit billions of users worldwide via a new standard for economic access, transparency, and fairness.
The long-term vision for next-generation smart contract applications is providing a similar user experience as the Internet applications we are used to in the “Web 2.0.” However, the main difference is swapping the backend computing infrastructure with a global, highly scalable, openly accessible framework made up of digital public goods, reducing the detrimental effects of today’s centralized Internet infrastructure.
Chainlink’s DeFi solutions bridge the gap between on-chain and off-chain code while maintaining decentralized computation guarantees, opening up new avenues for application developers to expand what’s possible in DeFi. By bridging the gap between distinct computing environments using Chainlink decentralized oracle networks, DeFi developers can create feature-rich applications called hybrid smart contracts that combine the unique advantages of both blockchains, oracle networks, and the API economy.
Hybrid smart contracts allow for a broader vision for decentralized systems—far beyond simple token movements—transforming many industries alongside finance, including gaming, digital identity, supply chain, marketing, insurance, governance, and more. Some of the potential new use cases include confidentiality in smart contracts, secure multi-chain transactions using cross-chain bridges, institutional adoption via blockchain middleware, and more.
If you’re a developer looking to create a DeFi application, check out how to develop a DeFi project using Python. If you want to start building hybrid smart contract applications today and need some type of external data or computation, refer to our documentation, ask a technical question in Discord, or set up a call with one of our experts.