This is a chapter from the book Token Economy (Third Edition) by Shermin Voshmgir. Paper & audio formats are available on Amazon and other bookstores. Find copyright information at the end of the page.
Decentralized lending protocols use smart contracts to provide a marketplace between lenders and borrowers. Any asset can be tokenized and used as collateral in a decentralized lending protocol, thereby creating a liquid lending market for these assets, surpassing the possibilities of legacy systems and fundamentally changing the dynamics of our global economic system.
Tokenized lending services offer a two-sided marketplace, using smart contracts for credit and lending of tokens. They have lower operational costs than legacy financial services and provide higher levels of trust, as verification of compliance with lending rules and verification of the underlying collateral and payments are executed on the fly on a publicly verifiable infrastructure. In the early years of decentralized finance (DeFi), only specialized lending protocols existed for simple credit and lending. In combination with automated market maker (AMM)-based decentralized exchanges using liquidity pools, decentralized lending protocols have enhanced capabilities and can provide a multi-sided marketplace not only between lenders and borrowers but also between sellers and buyers of tokens.
“MakerDAO,” which launched in 2017, pioneered decentralized lending since the stable token DAI was issued against tokenized collateral, thereby introducing the first lending mechanisms. The first notable lending protocols were “Compound,” “Curve,” “Yearn,” “Aave,” and “Centrifuge,” which embraced the concept of liquidity pools but differed in their token economics, blockchain networks supported, or asset types supported.
In a fully decentralized setup, tokenized lending services only require a Web3 wallet and an Internet connection to participate. Users are in control of their private keys and thus in control of their tokens at all times. The first lending protocols also addressed the problem of dormant capital, which was a big issue at the time, where crypto investors held tokens long-term without using them to earn interest. When lending protocols emerged, these crypto investors converted their under-utilized and dormant tokenized capital into working capital. While the first protocols were designed to be peer-to-peer, they did not resolve the coincidence-of-wants problem needed to match creditors and borrowers. Liquidity pools combined with AMMs resolved this issue. Lenders could lock their tokenized assets in liquidity pools, which borrowers could use to borrow tokens. In the bull run that was triggered by the DeFi summer of 2020, investors were motivated by the high yields promised by many emerging lending protocols. These promised yields were often unsustainable, at least in the medium to long run, and were designed in an attempt to bootstrap a minimum viable economy for their lending protocol, ensuring enough liquidity to outperform other protocols. Various new and somewhat interchangeable terms emerged—“yield farming,” “liquidity mining,” and “liquidity harvesting”—all describing the act of lending existing token holdings to a liquidity pool in exchange for the possibility of earning interest and potentially additional protocol rewards.
Tokenized Lending
In the current financial system, depositors have no real-time control over what happens with their deposited money, such as who the bank lends their money to or whether it is keeping enough assets in reserve to pay customers back when needed. In most countries, depositors cede ownership of their assets to the bank when they deposit money. They often do so unknowingly in exchange for a bank guarantee. A bank guarantee is a type of government-mandated insurance—usually capped around a government-mandated maximum per person and/or per bank account. In Europe, this is EUR 100,000 per person and per bank. While private forms of credit also exist, they are mostly given out by friends and family—typically on a personal trust basis—and are harder to enforce if the counterparty to the private loan fails to fulfill their side of the bargain.
Decentralized financial applications leverage blockchain networks without the need for traditional financial institutions or analog forms of private credit. All transactions of a tokenized loan are brokered by smart contracts that are audited by all nodes in the network, instead of the private ledgers of banks or CeFi startups. The smart contract replaces the functions of a bank, which would usually broker the financial liquidity between lenders and borrowers. Because of the nature of blockchain networks, anyone can track the state of their tokens at all times. Tokens are locked up in an escrow contract as collateral, which automatically pays out periodic interest rates to the wallet of the lender. Due to the publicly verifiable nature of the underlying infrastructure, these collateral assets cannot be over-leveraged through private backdoor deals or embezzlement. This enables a global and transparent credit and lending market for each tokenized asset class. Any token holder, for example, from Africa, could earn passive income on their token holdings through interest paid by a borrower in South America, and vice versa.
Two forms of decentralized lending exist: (i) “P2P lending” and (ii) “liquidity pool lending.” While most protocols started with P2P lending, liquidity pool lending has become the dominant form of lending in most DeFi protocols.
P2P lending: In a P2P lending setup, any individual or institution can lend tokens to another individual or institution directly. The smart contract brokers the tokenized lending and collateral management wallet-to-wallet. However, in such a setup, there is a “coincidence of wants” problem, meaning that matching individuals who need a certain amount of tokens with someone willing to lend at the same time can be challenging.
Liquidity pools: The introduction of liquidity pools resolved the coincidence-of-wants problem of P2P lending. It allows lenders to provide their tokens into a lending pool and earn interest, fees, and other rewards on the tokens they provide (lend) to the liquidity pool for the duration of their loan. Others can borrow the number of tokens they need from the lending pool at the time. Lending pools are designed like the liquidity pools used by decentralized exchanges but come with additional borrowing and lending functions. For example, a person who has USDC tokens that they do not plan to spend in the near future could use a lending protocol such as “Aave” and deposit their USDC into a USDC liquidity pool to earn interest on the tokens deposited—interest that is paid by borrowers taking out USDC loans. The same person who provided the USDC tokens to the lending pool (also known as liquidity providers or creditors) can now use these deposited assets as collateral to borrow other tokenized assets they might need instead. The smart contract brokers the transactions and defines the algorithm that determines borrowing and lending rates. This resolves the coincidence-of-wants problem and, at the same time, creates more liquidity for the supply and demand of a particular token class.
The term “staking” in the context of decentralized lending has become somewhat synonymous with lending tokens and locking them up for some kind of tokenized yield, often in the form of governance tokens issued by a DeFi protocol. The term has been misused by some DeFi protocols that issued their own tokens during the bull years of DeFi. This was likely done to market their protocol tokens to potential buyers and motivate them to lock their newly purchased protocol tokens against the issuance of tokenized rewards.
The original term “staking” is used in relation to a security mechanism—Proof-of-Stake—in blockchain networks. While it has certain similarities to lending, it has very different game-theoretic origins and a significantly different market design than locking up one’s tokens for a lending protocol. The game-theoretic mechanisms of simple lending services are less complex than those of Proof-of-Stake staking.
Tokenized Borrowing & Over-Collateralization
Similar to lending, tokenized borrowing takes two forms: (i) P2P borrowing and (ii) liquidity pool borrowing—both sharing the same trade-offs and dynamics as previously outlined. However, borrowing introduces additional complexities related to identification, reputation, and collateral management.
In the traditional financial system, when individuals or institutions borrow money, they typically provide collateral as a guarantee that can be seized if the borrower defaults on repaying the loan. The required collateral percentage depends on the purpose of the loan, the borrower’s creditworthiness, and regulatory requirements. Creditworthiness is assessed based on owned assets, such as real estate or company shares, which could be liquidated in case of default. Expected future income also plays a role, which is why banks request income statements and employment contracts. Alternatives to bank loans include private lending by so-called “loan sharks,” who often charge exorbitant interest rates in the absence of collateral, or borrowing from family and friends, which relies solely on trust and typically requires no collateral.
Due to the pseudonymous nature of blockchain-based identification, early DeFi protocols operated without personal identification or credit checks, necessitating full collateralization or, in many cases, over-collateralization to mitigate the volatility risks of the collateral assets used. Borrowers had to lock accepted crypto assets in a smart contract before obtaining a tokenized loan, a practice that replaced the lender protection mechanisms of traditional finance, where banks verify borrower identities and rely on credit rating agencies to reduce collateral requirements.
To maintain full collateralization, lending protocols have implemented automated liquidation mechanisms. If the market price of the collateral drops significantly, smart contracts trigger the sale of collateral tokens at a predefined price or via market auction. Market participants who detect under-collateralized contracts can profit by triggering and executing these actions, effectively protecting lenders from counterparty risk in the event of a sudden price collapse of the collateral asset. While this is an effective lender protection mechanism, its reliance on full collateralization makes decentralized borrowing impractical for those in genuine need of a loan, excluding large portions of the population. Consequently, DeFi borrowing has been primarily used by professional traders engaged in arbitrage trading, margin trading, or those who want to leverage crypto assets for tax-efficient investments without liquidating holdings. This dynamic creates barriers to entry, reinforcing wealth concentration while leading to inefficient capital allocation.
With advancements in decentralized identity management and credit-risk assessment, collateralization levels are expected to decline. As governments increasingly classify DeFi platforms as brokers and impose KYC compliance for tax reporting, DeFi protocol developers are exploring alternatives to centralized KYC and credit risk procedures. Potential solutions include:
User-Centric identity systems, which enable borrowers to verify their credentials while maintaining privacy.
Decentralized reputation mechanisms, utilizing blockchain analytics to assess wallet risk based on transaction history.
Privacy preserving encryption practices such as using “Fully Homomorphic Encryption” for “Confidential Transactions,” which would allow verification of creditworthiness without exposing sensitive data, enabling KYC compliant yet private lending.
Decentralized arbitration & payback enforcement mechanisms to ensure trustless dispute resolution and repayment enforcement.
Robust risk management is crucial—not only to protect lenders but also to prevent systemic failures. The Terra (LUNA) collapse in 2022 demonstrated that over-collateralized DeFi lending protocols withstood the market crash, while CeFi startups—which were often mistaken for DeFi protocols by the general public—lacked the same collateralization discipline. These CeFi firms issued under-collateralized loans to individuals and institutions they deemed “good borrowers” while simultaneously overleveraging customer assets held in custody for their own financial gains. This reckless strategy led to insolvency and widespread bankruptcies among major CeFi players at that time.
While some DeFi participants advocate loosening collateralization requirements and lending out locked collateral tokens, such practices would reintroduce the same systemic risks that contributed to the 2007-2009 global financial crisis—risks that Bitcoin and later DeFi were designed to avoid in the first place and which also led to the bankruptcies of major CeFi players in 2022.
Flash Loans & Flash Attacks
Flash loans are a unique type of instant, collateral-free loan that can only be borrowed and repaid within the same blockchain transaction. They allow users to borrow large sums from a liquidity pool without depositing collateral. The borrowed funds, plus fees, must be fully repaid within the same transaction block. If repayment fails, the smart contract automatically cancels the entire transaction, eliminating default risk. Flash loans were first introduced in 2018 by “Marble Protocol,” and later popularized by “Aave” and “dYdX.”
A typical flash loan transaction involves three steps within a single block of transactions: (i) Borrowing tokens from a liquidity pool. (ii) Using the borrowed tokens for arbitrage, trading, or refinancing. (iii) Repaying the loan, including fees, all within the same transaction. Flash loans are primarily used by professional traders for arbitrage, liquidating positions, or refinancing crypto loans. While they offer powerful tools for arbitrage, liquidation, and other financial strategies, they are not without risks. Successfully executing a flash loan requires advanced programming skills, a deep understanding of blockchain mechanics, and knowledge of decentralized exchanges. Mistakes in writing the smart contract logic, misconfigurations, or sudden changes in market prices can cause the transaction to fail, resulting in wasted blockchain transaction fees. Since they typically involve multiple operations within a single transaction and require significant computational resources, a trader might lose considerable money on fees even if the loan transaction fails.
The emergence of flash loans introduced the risk of so-called “flash attacks”—capital-intensive exploits targeting vulnerabilities in DeFi protocols. In February 2020, the decentralized lending platform “bZx” suffered two major flash attacks within four days, resulting in losses for other market participants of nearly 1 million USD. Attackers borrowed large sums via flash loans and manipulated price data from oracles (external data feeds) to exploit weaknesses in bZx's smart contract code. The attackers exploited price discrepancies between decentralized exchanges. Unlike traditional financial markets, where stock prices are sourced from centralized exchanges, crypto tokens are traded across multiple platforms, leading to inconsistent prices. Attackers took advantage of these spreads, borrowed tokens at a lower price, artificially inflated token values, sold them at a profit, and repaid the loan—all within a single transaction. In the end, the bZx flash attacks and subsequent similar events demonstrated both the power and risks of flash loans, emphasizing that while they offer innovative financial tools, they also expose the ecosystem to unique vulnerabilities that must be addressed through better design and oversight, such as: (i) Better smart contract audits to detect vulnerabilities. (ii) Reliable oracle data feeds to ensure accurate price information.
In traditional finance, such a form of market manipulation typically requires significant capital, making it inaccessible to most individuals. Flash loans allow anyone with technical expertise to access vast liquidity for such exploits. While some view flash loans as “democratizing” financial strategies, they remain tools primarily for those with deep technical and financial market knowledge, often at the expense of retail investors.
Challenges & Outlook
At the time of writing this book, decentralized lending services cannot yet compete with legacy financial systems due to usability issues, attack vectors, and inclusion barriers. Tokenized lenders using DeFi protocols must bear significant risks.
Smart contracts vulnerabilities: Since decentralized lending contracts are automatically enforced, they are prone to programming vulnerabilities that may not align with the intended use of a smart contract. Such flaws can be exploited by attackers, as seen in flash loan attacks and other smart contract exploits.
Impermanent loss & liquidation risks: Tokenized lenders face risks such as impermanent loss, where the value of deposited tokens declines compared to their initial deposit value. This can occur due to price fluctuations or vulnerabilities in smart contracts. Liquidation risk arises from the absence of personal identification and reputation systems—if the collateral price drops below the loan value, the loan is liquidated automatically, leading to losses for the borrower.
Inclusion: The requirement for over-collateralization excludes those who need loans for basic survival, as they often lack sufficient tokenized collateral. Additionally, many decentralized lending protocols remain highly technical and not user-friendly, restricting access primarily to tech-savvy and finance-literate users. To address this, CeFi services have entered the DeFi space, offering custodial services for tokenized lending. However, these services are not truly P2P and typically require full KYC compliance, once again excluding billions of underbanked or undocumented individuals—the very people DeFi was initially intended to empower.
Lender of last resort: In traditional finance, central banks and (semi-)governmental institutions serve as lenders of last resort to mitigate financial crises and prevent systemic collapses. In Web3, it remains unclear who or what mechanism could fulfill this role. The question of how a decentralized version of a central bank could function as a lender of last resort remains unresolved.
Once these risks are mitigated and the tokenization of the real economy progresses, borrowers may gain access to a broader range of tokenized real-world assets as collateral—assets that traditional banks do not currently accept. This could include household goods, art, or other previously "non-bankable" assets, transforming them into liquid, bankable funds usable for tokenized borrowing. Such a shift could significantly alter financial market dynamics.
Next: Tokenized Derivatives, Synthetics & Insurances →
Footnotes
[1] The reality in the near future could be more complex due to regulatory requirements which will, very likely, be introduced into this still nascent scene.
[2] Margin trading refers to the practice of borrowing funds to make an investment where one anticipates to make a higher profit off the investment than the interest one has to pay. Borrowed funds are used for leverage, which means that both profits and losses will be big.
[3] "Impermanent loss describes the temporary loss of funds that liquidity providers occasionally suffer due to the volatility of a trading pair. It also illustrates how much more money someone would have if they had simply kept their assets in their wallet instead of providing liquidity. The loss becomes permanent only when a liquidity provider decides to withdraw its tokens from the pool." (Source: https://itsa-global.medium.com/rudy-defi-insight-how-to-hedge-impermanent-loss-f9e8e5295f3f)
[4] Source: https://itsa-global.medium.com/itsa-defi-insight-the-vaults-at-yearn-6ee031bd5575
[5] “Atomicity” or “atomic transactions” are computer science terms that refer to database systems where a series of database operations can be programmed in a way that either all occur, or nothing occurs. Either all transactions (in this case, within the smart contract) execute, or none of them execute. This prevents partial updates to the database system.
[6] “Borrowers on Compound and similar platforms are required to put up collateral before they take out a crypto loan. Such loans are always overcollateralized. One other aspect of taking out a crypto loan is the variable interest rate. Both interest rates and asset prices could play a crucial role in the decision to close a position by quickly repaying the loan. If the price of the underlying collateral drops fast and reaches a liquidation stage, one could lose the collateral and also pay a penalty fee. By using flash loans, one could self-liquidate the loan by losing the collateral while avoiding the penalty fee. In the DeFi ecosystem, the liquidation penalties for loans could range between 3% and 15%, depending on the platform. Avoiding the penalty fee could be a considerable cost saving. Obviously, flash loans also impose fees, but it is much better to pay an under 1% fee for a flash loan than a 15 % penalty fee.” (Source: https://itsa-global.medium.com/defi-insight-flash-loans-8088a627a4ee)
[7] Depending on the market situation, a user might want to refinance a loan by swapping the outstanding collateral assets securing the loan with another asset, without fronting any collateral. A flash loan can be used for such a swap. Let's assume that a loan is denominated in DAI stablecoins. A simple flash loan transaction enables the user to swap their DAI for USDT or other stablecoins without closing their position in the process.
[8] https://samczsun.com/taking-undercollateralized-loans-for-fun-and-for-profit/
[9] https://twitter.com/tayvano_/status/1229708599867232256