How does a DEX work? Guide to Decentralized Exchanges | Rootstock

In this section, We will explore the features of a DEX, such as Lending, Borrowing, Yield Farming, Staking, Liquidity Pools and the Drawbacks associated with DEXes.


A DeFi lending protocol is a platform where users can lend and borrow crypto assets without intermediaries via P2P. In a traditional financial system, banks give loans to the borrower. A DEX platform allows lenders to earn interest for lending their crypto assets. Additionally, these platforms provide ways for long-term investors to earn high-interest rates.

How Lending Works

In DeFi, anyone can become a lender. A lender can loan their assets to others and will be able to generate interests on that loan. This process can be done through lending pools, similar to loan offices in traditional banks. Users can pool their assets and distribute them to borrowers via smart contracts.

Benefits of DeFi Lending

  • Self Custody

The use of Web3 wallets (like Metamask) ensures that users keep custody of their assets and control their funds.

  • Permissionless

DeFi lending allows open, permissionless access, meaning anyone with a crypto wallet can access DeFi applications, irrespective of their geographical location and with a minimum amount of funds.

  • Immutability

This ensures tamper-proof data coordination and increases security and auditability.

  • Transparency

All transactions are broadcasted on the network and can be verified by every user on the network. This transparency level around transactions allows for rich data analysis and ensures verified access to every user on the network.

  • Programmability

Smart contracts are programmable, automate execution and enable the development of new digital assets and financial instruments.

  • Interoperability

The use of an interconnected software stack ensures that DeFi protocols and applications communicate via cross chain bridges and integrations.


Borrowers can choose to borrow from one of these protocols and put down collateral. An important part of these types of loans is that they are over-collateralized. This means borrowers deposit as collateral an amount in crypto more than they borrow. Note that there is a limit to how much funds can be borrowed, this depends on two factors; First is the amount deposited by lenders in the protocol’s funding pool. Second is the quality or “collateral factor” of the coins put down as collateral by the borrower. Borrowers can put down several different coins as deposits each with differing collateral factors. The limit the user can borrow will then be the total sum of these coins amounts multiplied by the collateral factor. It is highly advisable to monitor when to deposit more collateral or maintain a healthy buffer because if the limit is breached, the collateral will be auto-liquidated by the protocol typically at a hefty discount to pay back the loan.

Lending and Borrowing in DeFi explained

Yield Farming

Yield farming, also known as liquidity farming, is a means of earning interest on your cryptocurrency, similar to how you'd earn an annual percentage interest when you deposit money with banks. When investors participate in yield farming, their cryptocurrency value grows over time.

How Yield Farming Works

Yield farming is made possible through decentralized finance lending platforms that are specific to cryptocurrency. Some of these platforms have algorithms designed to facilitate yield farming. Yield farming works by first allowing an investor to stake their coins by depositing them into a lending protocol through a decentralized app, or dApp.

Users can lend or borrow any cryptocurrency on these platforms, set algorithms to automatically borrow cryptocurrency at low rates and automatically lend cryptocurrency at higher rates.

Why Yield Farming?

  • Full transparency
  • No bureaucracy
  • Fast yield on investment
  • No middle
  • Higher returns than traditional banks provides
  • No background or credit checks
  • Cost efficiency
  • Central authority

Yield Farming Protocols on Bitcoin

With Rootstock smart contract platform, users/investors can benefit from yield farming on Bitcoin. Several decentralized exchange platforms exist which enables users to access defi on Bitcoin, they are;


Sovryn enables Bitcoin holders to yield interest on RBTC, XUSD, FISH, rUSDT, MOC, DOC, BPRO, RIF, MYNT, etc. To get started, visit the Sovryn dApp


Staking is a way of earning rewards for holding certain cryptocurrencies. Cryptocurrencies that allow staking use a “consensus mechanism” called Proof of Stake, which is the way they ensure that all transactions are verified and secured without a bank or payment processor in the middle.

Liquidity Pools

The liquidity pools or LPs are basically pre-funded pools of assets, which serve an important role in the working of AMM-based DEXes. It is a crowdsourced pool of cryptocurrencies or tokens locked in a smart contract that is used to facilitate trades between the assets on a decentralized exchange (DEX). Instead of traditional markets of buyers and sellers, many decentralized finance (DeFi) platforms use automated market makers (AMMs), which allow digital assets to be traded in an automatic and permissionless manner through the use of liquidity pools.

Watch How do Liquidity Pools work?

An operational crypto liquidity pool must be designed in a way that incentivizes crypto liquidity providers to stake their assets in a pool. That’s why most liquidity providers earn trading fees and crypto rewards from the exchanges upon which they pool tokens. When a user supplies a pool with liquidity, the provider is often rewarded with liquidity provider (LP) tokens. LP tokens can be valuable assets in their own right, and can be used throughout the DeFi ecosystem in various capacities.

Usually, a crypto liquidity provider receives LP tokens in proportion to the amount of liquidity they have supplied to the pool. When a pool facilitates a trade, a fractional fee is proportionally distributed amongst the LP token holders. For the liquidity provider to get back the liquidity they contributed (in addition to accrued fees from their portion), their LP tokens must be destroyed.

Liquidity pools maintain fair market values for the tokens they hold thanks to AMM algorithms, which maintain the price of tokens relative to one another within any particular pool.


Impermanent Loss

Impermanent loss happens when the price of a token increases or decreases after you deposit them in a liquidity pool. This change is considered a loss when the dollar value of your token at the time of your withdrawal becomes less than its amount at the time of deposit.

What is Impermanent Loss?


Be sure to check out our next article in this guide, about DEXes on Rootstock

If you would like to delve deeper, here are some resources and tools that we recommend.


Receive updates

Get the latest updates from the Rootstock ecosystem