Cryptocurrencies

What are the basics of Decentralized Finance (DeFi)?

What is DeFi? Does it really change the rules of money? Let's break down how DeFi works, from token swaps on decentralized exchanges to borrowing and lending and explain why these innovations matter.
Guillermo Barco
Guillermo Barco
Product Manager Crypto at Swissquote
Aug 20, 2025
6min
Decentralized Finance

Introduction

Decentralized Finance (DeFi) refers to an ecosystem of financial applications built on public blockchains. The term was used for the first time in 2018 by the Ethereum community.

Unlike traditional finance, DeFi protocols are open, permissionless, and non-custodial, meaning anyone with a crypto wallet can access services such as trading, lending and borrowing without relying on intermediaries. The rules are encoded in smart contracts, ensuring transparency and security.

A key innovation in DeFi is composability, often described as “money Legos”. Because DeFi protocols are open-source and interoperable, users and developers can combine different applications to create new financial products.

Within this ecosystem, decentralized exchanges (DEXs) like Uniswap enable users to trade tokens. At the same time, lending and borrowing protocols like Aave and Compound allow users to earn interest on deposits or access liquidity against their crypto collateral.

Decentralized Exchanges

A Decentralized Exchange (DEX) is a type of cryptocurrency trading platform that enables users to trade digital assets directly on a blockchain, without relying on centralized intermediaries like traditional exchanges or brokers. Instead of custodying funds, DEXs use smart contracts to facilitate peer-to-pool or peer-to-peer transactions, giving users full control over their assets and private keys. Liquidity is provided by users rather than centralized entities.

In this article, we’ll focus in peer-to-pool DEXs. They are far more popular than P2P DEXs because they offer instant execution, easier access, and abundant liquidity, making them the go-to choice for most traders and DeFi users, peer-to-pool dominates DEX trading volume.

Peer-to-pool DEXs

In a peer-to-pool DEX, users trade against a liquidity pool rather than directly with another person. Each pool contains reserves of two tokens. Traders swap one token for another by interacting with the pool. Prices are determined automatically based on the ratio of tokens in the pool, using a predefined mathematical formula. This mechanism is called AMM (Automated Market Maker).

The Constant Product Formula

When a trader swaps tokens, the pool adjusts balances so that k remains constant. This automatically changes the token price: buying more of token A increases its price, selling lowers it.

Liquidity Providers (LPs)

  • Anyone can deposit Token A and Token B at the current ratio in the pool and become an LP
  • LPs earn a share of trading fees from swaps proportional to their share of the pool.

Trading Mechanics

  1. Trader chooses the token pair and amount to swap.
  2. Smart contract calculates the output amount using the pool formula and deducts a small fee (e.g., 0.3%).
  3. Tokens are swapped instantly and the pool balances are updated.
  4. Fees are accumulated for LPs.

Advantages

  • No need for a counterparty; trades are instant.
  • Always available as long as the pool has liquidity.

Uniswap

Uniswap  is one of the most widely used DEXs, the protocol pioneered the AMM model on Ethereum, allowing anyone to swap tokens or provide liquidity to earn fees in a fully permissionless and transparent way.

It is governed by UNI token holders. The UNI token is primarily a governance and ecosystem coordination token. It lets holders influence Uniswap’s development, treasury spending, etc.

Then UNI token is available on SQX, Swissquote’s regulated crypto trading platform that allows clients to buy, sell and custody digital assets securely.

UNIUSD Chart by TradingView

Lending and borrowing protocols

A decentralized, non-custodial lending and borrowing protocol is a blockchain-based financial platform where users can lend their digital assets to earn yield or borrow against collateral without relying on intermediaries. “Non-custodial” means that users always retain control of their funds through smart contracts, rather than depositing them with a central authority. These protocols use transparent, automated rules coded into smart contracts to manage lending, borrowing, interest rates and liquidations, creating an open and permissionless money market.

How It works

Lending (Supplying Liquidity)

  • Users deposit tokens (e.g., ETH, USDC) into a protocol’s liquidity pool.
  • In return, they receive interest-bearing tokens (like aTokens in Aave or cTokens in Compound).
  • These tokens automatically accrue value, reflecting earned interest over time.
  • Lenders can withdraw their funds at any time, subject to liquidity availability.

Borrowing

  • To borrow, users must supply collateral to the protocol.
  • Each asset has a Loan-to-Value (LTV) ratio that defines how much can be borrowed against it (e.g., 75%).
  • If collateral value drops and the health factor falls below 1.0, the position can be liquidated by third parties.

Interest Rate Model

  • Interest rates are normally variable and algorithmically determined by supply and demand.
    • High utilization (more borrowed relative to supplied) = higher rates.
    • Low utilization = lower rates.
  • This dynamic model ensures pools remain balanced and attractive for both lenders and borrowers.

Liquidations

  • If the value of a borrower’s collateral falls too much, the loan becomes undercollateralized.
  • Liquidators can repay part of the borrower’s debt and receive a portion of the collateral at a discount.
  • This keeps the protocol solvent and protects lenders.

Aave

Aave was founded in 2017, originally under the name ETHLend. ETHLend was one of the earliest attempts at decentralized lending, operating as a peer-to-peer matching marketplace where individual lenders and borrowers were directly paired. While innovative, this model faced liquidity and efficiency challenges.

In 2020, ETHLend was rebranded and relaunched as Aave (meaning “ghost” in Finnish). Instead of peer-to-peer lending, Aave shifted to a pool-based liquidity model, where users deposit assets into smart contract pools and borrowers draw from them — making lending more efficient and scalable.

AAVE token powers governance, enabling holders to vote on protocol upgrades and risk parameters, and can also be staked in the “Safety Module” to backstop the system in exchange for rewards.

AAVE token can be purchased in SQX, Swissquote’s crypto-exchange

AAVEUSD Chart by TradingView

Compound

Compound, launched in 2018, is one of the earliest decentralized money market protocols. The native COMP token is primarily a governance token, allowing holders to propose and vote on protocol changes, including the addition of new assets, parameter adjustments and system upgrades.

COMP token can be purchased in SQX, Swissquote’s crypto-exchange.

COMPUSD Chart by TradingView
Conclusion

DeFi has already transformed how users can trade, lend, and borrow in a fully decentralized and permissionless way. Yet this is only the foundation, more advanced innovations such as yield aggregators are building on top of these primitives, enabling users to automate strategies, maximize returns and unlock new forms of capital efficiency. These next layers of DeFi point toward a financial system that is not only open and programmable, but also increasingly sophisticated.

At the same time, challenges remain: in DeFi, smart contracts, backbone of DeFi platforms, might contain bugs, coding errors, or vulnerabilities, attackers can exploit them to drain funds or lock assets permanently. On the other hand, user risks arise from the self-custodial nature of DeFi: losing private keys, sending tokens to the wrong address or falling victim to phishing scams means funds are likely lost forever.

Swissquote clients can securely get exposure to Crypto assets on SQX, our regulated crypto exchange. With the safeguards of a trusted financial institution, we help investors explore this new frontier with confidence.

The content in this article is provided for educational purposes only. It does not constitute investment advice, financial recommendations, or promotional material. Investing in digital assets carries a high degree of risk.

Guillermo Barco
Guillermo Barco
Product Manager Crypto at Swissquote
Follow us
Be in the know

Sign up to our newsletter and receive a monthly selection right in your inbox


Sponsors
UEFA Europa LeagueGenève ServetteZSC Lions

Be aware of the risk

Trading leveraged products on the Forex platform, such as foreign exchange, spot precious metals and Contracts for Difference (CFDs), involves significant risk of loss due to the leverage and may not be suitable for all investors. Prior to opening an account with Swissquote, consider your level of experience, investment objectives, assets, income and risk appetite. Losses are in theory unlimited and you may be required to make additional payments if your account balance falls below the required margin level and therefore you should not speculate, invest or hedge with capital you cannot afford to lose, that is borrowed or urgently needed or necessary for personal or family subsistence. Over the past 12 months, 74.54% of retail investors have either lost money when trading CFDs, experienced a total loss of their margin at the closing of their position or ended up with a negative balance after closing their position. You should be aware of all the risks associated with foreign exchange trading and seek advice from an independent financial advisor if you have any doubts. For more details, including information on the leverage effect, how margins work, and counterparty and market risks, please refer to our Forex and CFD Risk Disclosure. The content of this website represents advertising material and has not been submitted to nor approved by any supervisory authority.

AI-generated content

Some of the visual content on our website has been generated and/or enhanced using artificial intelligence (AI) applications. However, all content undergoes thorough human review and approval to ensure its accuracy, relevance, and compliance with the needs of our users and clients.