Decentralized finance

Decentralized finance (DeFi) offers financial instruments without relying on intermediaries such as brokerages, exchanges, or banks by using smart contracts on a blockchain. DeFi platforms allow people to lend or borrow funds from others, speculate on price movements on assets using derivatives, trade cryptocurrencies, insure against risks, and earn interest in savings-like accounts. DeFi uses a layered architecture and highly composable building blocks. Some applications promote high interest rates but are subject to high risk. As of February 2022, the value of assets used in decentralized finance amounted to $200 billion.

History
Decentralized exchanges (abbreviated DEXs) as alternative payment ecosystems with new protocols for financial transactions emerged within the framework of decentralized finance, which is part of blockchain technology and FinTech. Unlike centralized cryptocurrency exchanges (CEXs), such as Coinbase, Huobi or Binance, which use order books to match buyers and sellers on the open market and keep crypto assets in an exchange-based wallet, DEXs are non-custodial and leverage the functionality of self-executing smart contracts for peer-to-peer trading, while users retain control of their private keys and funds. Most recently, DEX aggregators have begun to play a more distinctive part in the DEX segment. DEX aggregators form user-centric hubs that compose to several applications and protocols, also providing tools to compare and rate services, which allow users to perform otherwise complex tasks by connecting to several protocols simultaneously. CEXs, DEXs and DEX aggregators are all built on the multi-layered DeFi architecture or components, where each layer serves a well-defined purpose. (See Figure: Multi-layered Architecture of the DeFi Stack).

While they share common components of the first four layers, such as Settlement layer, Asset layer, Protocol layer and Application layer, DEX aggregators have an additional component or Aggregator layer, which allows them to connect and interact with other DEXs via smart contracts.

The Ethereum blockchain popularised smart contracts, which are the basis of DeFi, in 2017. Other blockchains have since implemented smart contracts.

MakerDAO is a prominent lending DeFi platform based on a stablecoin that was established in 2017. It allows users to borrow Dai, a token pegged to the US dollar. Through a set of smart contracts that govern the loan, repayment, and liquidation processes, MakerDAO aims to maintain the stable value of Dai in a decentralized and autonomous manner.

In June 2020, Compound Finance started rewarding lenders and borrowers with cryptocurrencies, in addition to typical interest payments to lenders, units of a cryptocurrency called COMP. This token, which is used for running Compound, can also be traded on cryptocurrency exchanges. Other platforms followed suit, leading to "yield farming" or "liquidity mining," where speculators shift cryptocurrency assets between pools in a platform and between platforms to maximize their total yield, which includes not only interest and fees but also the value of additional tokens received as rewards.

In July 2020, The Washington Post described decentralized finance techniques and the risks involved. In September 2020, Bloomberg said that DeFi made up two-thirds of the cryptocurrency market in terms of price changes and that DeFi collateral levels had reached $9 billion. Ethereum saw a rise in developers during 2020 due to the increased interest in DeFi.

DeFi has attracted venture capitalists such as Andreessen Horowitz and Michael Novogratz.

The Economist regarded the future of digital finance in 2022 as a "three-way fight" between: Big Tech, such as Facebook with its digital wallet; "big rich countries" that have been testing their own digital currencies; and software developers "building all sorts of applications" to decentralise finance. Handling the risks presented by crypto-assets already valued at $2.5 trillion was a particular challenge for US regulators.

Key characteristics
DeFi revolves around decentralized applications, also known as DApps, that perform financial functions on distributed ledgers called blockchains, a technology that was made popular by Bitcoin and has since been adapted more broadly. Rather than transactions being made through a centralized intermediary such as a cryptocurrency exchange or a traditional securities exchange, transactions are directly made between participants, mediated by smart contract programs. These smart contracts, or DeFi protocols, typically run using open-source software that is built and maintained by a community of developers.

DApps are typically accessed through a browser extension or application. For example, MetaMask allows users to directly interact with Ethereum through a digital wallet. Many of these DApps can be linked to create complex financial services. For example, stablecoin holders can lend assets like USD Coin or Dai to a liquidity pool in a borrow/lending protocol like Aave, and allow others to borrow those digital assets by depositing their own collateral. The protocol automatically adjusts interest rates based on the demand for the asset. Some DApps source external (off-chain) data, such as the price of an asset, through blockchain oracles.

Additionally, Aave introduced "flash loans", which are uncollateralized loans of an arbitrary amount that are taken out and provably paid back within a single blockchain transaction. While there can be legitimate uses for flash loans such as arbitrage, collateral swap, self-liquidation, and unwinding leveraged positions, many exploits of DeFi platforms have used flash loans to manipulate cryptocurrency spot prices.

Another DeFi protocol is Uniswap, which is a decentralized exchange (DEX) set up to trade tokens issued on Ethereum. Rather than using a centralized exchange to fill orders, Uniswap pays users to form liquidity pools in exchange for a percentage of the fees that traders earn by swapping tokens in and out of the liquidity pools. Because no centralized party runs Uniswap (the platform is governed by its users), and any development team can use the open-source software, there is no entity to check the identities of the people using the platform and meet KYC/AML regulations. It is not clear what position regulators will take on the legality of such platforms.

Errors and hacking
Coding errors and hacks are common in DeFi. Blockchain transactions are irreversible, which means that an incorrect or fraudulent DeFi transaction cannot be corrected easily. For example, in 2020, a platform known as Yam Finance took deposits equivalent to $750 million within days of its launch before crashing because of a coding error. Additionally, the code for the smart contracts is generally open-source software that can be copied to set up competing platforms, which creates instabilities as funds shift from platform to platform.

The person or entity behind a DeFi protocol may be unknown, and may disappear with investors' money. Investor Michael Novogratz has described some DeFi protocols as "Ponzi-like".

DeFi has been compared to the initial coin offering craze of 2017, part of a cryptocurrency bubble. Inexperienced investors are at particular risk of losing money because of the sophistication required to interact with DeFi platforms and the lack of any intermediary with customer support.

In 2021, half of cryptocurrency crime was related to DeFi. This rise has been attributed to a combination of developer incompetence and non-existent or poorly enforced regulations. Theft from DeFi can come from either external hackers stealing from vulnerable projects, or "rug pulls", where the developers and influencers promote a project and then take the money, as a form of pump-and-dump.