Overview - The Complete Guide to Decentralized Exchanges (DEX)
Tags: blockchain, cryptocurrency, dex
Published: 2022-09-20 08:28:48

![decentralized exchange](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e8qlymifrcitkprx01gf.jpeg)

In this guide, you will learn about decentralized exchanges (DEX), types of DEXes, features of a DEX - lending, borrowing and yield farming. We will explore the differences between a centralized exchange(CEX) and a DEX, On-chain order books, Off-chain order books, Automated Market Makers (AMM), and the different types of DEXes oN RSK.

## Overview

## What is a DEX?

A decentralized exchange, also known as DEX, is a peer-to-peer trading platform where cryptocurrency holders and traders make transactions directly without handing over management of their funds to an intermediary or a custodian. DEXes have become a pivotal element in the crypto world by enabling trading with considerable improvements in crypto volume. 

## How DEXes Work

A decentralized exchange (DEX) excludes the need for any centralized authority, supervision, and authorization of transactions on exchanges. DEXes allow for peer-to-peer cryptocurrency trading by linking crypto buyers and sellers together. DEXes are both custodial and non-custodial in nature. A non-custodial exchange platform means users have control and ownership of their private keys. 

## Types of DEXes

### Order Book DEXes

Order books maintain records of all the open orders for purchasing and selling assets for specific pairs of assets. The *buy orders* imply a trader’s interest in purchasing or bidding for an asset at a particular price. While, *sell orders* show that the trader is prepared to selling by asking for a specific price for the concerned asset. 

#### On-chain order books

These DEXes store their open order information on the blockchain, and are referred to as on-chain order book DEXes. On-chain order book DEXes could help traders in leveraging their positions by using funds from lenders on their platform.

#### Off-chain order books

Off-chain order book DEX platforms store the order books outside of the blockchain networks. The off-chain order book DEXes only perform transaction settlement on the blockchain, thereby offering the value of centralized crypto exchanges. 

The notable examples of order book DEXes on RSK include: 

## DEX Aggregators

These are trading protocols that work by sourcing and routing liquidity throughout multiple DEXes according to specified requirements. DEX aggregators don’t have any need for servicing traders exclusively from their own liquidity pools. This enables DEX aggregators to play a crucial role in delivering efficient approaches for crypto trading.

## Automated Market Makers

The automated Market Maker (AMM) system uses smart contracts efficiently to address the liquidity problem. Rather than matching the buy orders and sell orders, the smart contracts in AMM-based decentralized exchanges could leverage liquidity pools. The liquidity pools are basically pre-funded pools of assets, which serve an important role in the working of AMM-based DEXes.

AMMs leverage blockchain-based services for obtaining information from exchanges and other platforms for setting the price of traded assets. These price feed services are provided by blockchain oracles like [Chainlink](https://developers.rsk.co/solutions/chainlink/), [API3](https://developers.rsk.co/solutions/api3/), [Chainbeat](https://developers.rsk.co/solutions/chainbeat/),
and [Oracle MOC](https://github.com/money-on-chain/Amphiraos-Oracle/blob/master/README.md)

Users provide funding for the liquidity pools and get rewarded with transaction fees allocated for trades on the concerned pair. Such types of users, also known as liquidity providers execute orders. Traders could also earn interest in a trustless and permissionless manner. AMM-based DEXes are generally ranked on the basis of the total amount of funds locked in their smart contracts. 

The AMM-based DEXes can encounter *slippage*, which emerges due to a lack of liquidity. Slippage is  evident when the lack of liquidity leads to the buyer paying more than the market price on their orders. In such cases, the larger orders are more likely to encounter higher slippage. Furthermore, liquidity providers could also face the risks of impermanent loss due to the volatility of one asset in trading pairs. 

The notable examples of AMM DEXes on RSK include [Sovryn](https://www.sovryn.app/), [Blindex](https://app.blindex.io/), and [RSKSwap](https://app.rskswap.com/).

## Next

Be sure to check out our next article in this guide, about [The difference between a Centralized and a Decentralized Exchange](https://developers.rsk.co/guides/dex/dex-vs-cex/) on the RSK Developer Portal. 

[This article was originally posted on the RSK Developer Portal](https://developers.rsk.co/guides/dex/overview/).