Academy Icon

Academy

BasicsDeFiTrading

What Is a Decentralized Exchange (DEX)?

Oct 19, 2022
10m
Yavor Kaludov Ariel Monjes

Cryptocurrency exchanges are a vital source of liquidity for the global cryptocurrency market. They’re responsible for supporting billions of dollars in daily trade volumes.

Alongside traditional centralized exchanges (CEXs), decentralized exchanges (DEXs) have grown in popularity in recent years – for a number of reasons. Fast, private, and available for use by everyone, users have the option to trade and invest in otherwise inaccessible crypto-based financial products and assets. 

A Simple DEX Definition

A decentralized exchange is a peer-to-peer (P2P) market. It’s a tool that allows people to trade crypto without entrusting their assets to an intermediary or custodian. To enable such transactions, smart contracts are used. These are self-executing agreements written in code running on the blockchain. 

Instead of using intermediaries to clear transactions, DEXs offer an alternative way to buy and sell digital assets. They do so by relying on self-executing smart contracts to facilitate quick trading. What’s more, they often cost less than CEX trades and don’t require users to give up custody of their assets. 

Important: Having direct access to your funds without the need for intermediaries (ie. self-custody) is an integral part of Decentralized Finance (DeFi). Discover how non-custodial crypto wallets work – and the advantages they provide. 

Types of DEXs

Platforms use different implementations of order books, liquidity pools, and other decentralized finance (DeFi) approaches. These include aggregation tools that offer unique and experimental financial products.

The three main types of DEXs are: 

  • DEX aggregators

  • Order book DEXs

  • Automated Market Makers (AMMs) 

Each uses smart contracts that allow users to trade directly with each other. In fact, smart contracts are at the core of every DEX operation. Blockchains require computational resources to function and record transactions. Therefore, each cryptocurrency transaction on a DEX comes with a “gas fee” (which we discuss a bit further down the article). 

 

1. Decentralized Exchange Aggregators

Decentralized exchanges employ a range of protocols and strategies. This creates a market where liquidity is low and resources are spread thin across multiple exchanges. 

Liquidity: In the context of stocks and crypto, liquidity refers to an asset’s ability to be quickly traded for another, as well as the number of assets present in a market at any given time. If you wanted to sell a crypto asset, someone else should be ready to purchase it. If there’s no interest, this market has low liquidity (ie. it’s illiquid).

A lack of liquidity may deter institutional investors and wealthy individual traders (who tend to purchase large amounts of digital assets). To address this issue, DEX aggregators have developed ways to deepen asset liquidity pools across decentralized crypto exchanges. 

To deliver the best possible trade price, these services aggregate data from many different decentralized exchanges. Other benefits include offering the option to split trades between different platforms and protecting traders from excessive slippage (due to low liquidity levels) on any single exchange. 

2. Order Book DEXs

When it comes to ordering and matching “buy and sell” orders, Order Book DEXs function just like traditional CEXs. 

In this situation, a “buy” order reflects a trader's readiness to purchase an asset at a certain price while “sell” orders reveal how eager a trader is to sell the item at a specific price. These factors  – and the total number of open orders – define the order book's depth and the asset’s market price.

How Do Order Books Work?

For traditional order-book-based exchanges, buyers and sellers place bids on the price at which they’d like to do their trades. These bids are usually displayed in two columns: one for buyers and another for sellers. The platform automatically executes trades by matching bids.     

3. Automated Market Makers (AMMs)

To address liquidity issues, an automated market maker (AMM) system was created based on smart contracts. These exchanges were influenced by Ethereum co-founder Vitalik Buterin's post in 2017, which detailed how to conduct trades on the blockchain via token-holding contracts.

Instead of matching “buy” and “sell’ orders, AMMs utilize liquidity pools (ie. pre-funded pools of assets). Rather than waiting for a counterparty to trade with, AMM users trade directly with this pool of funds. 

Other users contribute to the pool and are entitled to earn money on transaction fees. Other than trading, liquidity providers can earn money from their cryptocurrency holdings by depositing an equivalent amount of each asset in the trading pair (also known as “liquidity mining”).  

How Are Prices on AMMs Determined?

The price of assets traded on AMMs is determined by balancing the total price of each asset in the trading pair. 

For example: If traders sell more of Asset A from a trading pair, the liquidity pool will fill up with more of that asset. Its price would need to be lowered to keep the overall value of assets A and B equal. Likewise, if more of Asset A is purchased, the supply would go down and the price would need to be increased to keep this balance. 

Is it Illegal to Use a Decentralized Exchange?

No. It is perfectly legal to use a DEX. 

A DEX is just open-source software and isn’t owned by anyone. Trading on a DEX is the closest digital equivalent to exchanging funds by hand in real life. It’s peer-to-peer, meaning that every transaction is either between you and another person or you and a smart contract. There are no middlemen or legal entities like companies to take responsibility for what happens when you use a DEX. 

What matters is what you trade and why. For example, some coins and tokens are banned by some governments. What’s more, if you engage in transactions of a criminal nature – like purchasing illegal substances – that would, of course, be against the law. 

What Are the Benefits of a DEX?

There are plenty of reasons to choose a DEX for your crypto trades. 

1. Asset Ownership

Unlike a CEX, when you conduct trades on a DEX, you never hand over cryptocurrency ownership to anyone. Your crypto stays securely in your personal wallet until the transaction is approved. For the end user, the risks of hacking via reputable DEXs are minimal (unless you directly interact with a scam project). 

2. Anonymity

You aren’t required to provide any personal information to use a DEX.

3. Trade Opportunities

If you're searching for a hot token in its early stages, DeFi is the place to go. DEXs contain an incredible amount of tokens, ranging from well-known and relatively stable to completely new and unpredictable. 

This is because anybody can create and deploy a token smart contract and liquidity pool with relative ease. However, it’s always important to protect yourself from scams. 

4. Dependability

DEXs have grown in popularity in developing countries where dependable financial infrastructure is lacking. In countries like Venezuela and India, various economic and government factors can make exchanging traditional currencies impractical (or even impossible). Citizens have leaned into peer-to-peer trading and DEXs to trade crypto instead. 

Since you only need a computer/smartphone and an internet connection, it’s never been easier to use peer-to-peer lending and rapid transactions – autonomously and anonymously.

What Does DEX Trading Cost?

To trade on a DEX, two types of fees must be paid: a gas fee (which depends on the blockchain) and the exchanges’ own fees (which are typically very small).

What Is a Gas Fee? 

DEXs facilitate cryptocurrency trading via smart contracts. Every time a trade is made, a contract is executed on the blockchain and new balances are assigned to the addresses that made the trade. 

This operation requires computational resources that are expended by the validator nodes which keep the blockchain network running. To pay for their effort, the blockchain is designed to take a small amount of cryptocurrency from a transaction. Also called a “gas fee”, this transaction is awarded to the validators. 

On popular networks like Ethereum, during moments of high usage, the price of gas can spike dramatically (there are databases that display gas fee trends).

How Does a DEX Make Money?

In addition to gas fees, users must also pay predefined fees set by the exchange's smart contract developers. 

Remember: Smart contracts are just programs running on the blockchain. They’re completely customizable and can be configured for whatever fee the developers choose. That’s why it’s important to use trustworthy exchanges – and always check what the fees are in advance. Reputable exchanges always show their transaction fees before trades are placed. 

A DEX, or rather its owners, makes money by collecting these fees in wallets that its developers own and control. 

Note: Some DEXs offer fee revenue sharing to users that contribute a stake in their official liquidity pools).

What Is the Best Decentralized Crypto Exchange?

Simply put, there’s no single “best” decentralized exchange for crypto. 

Security should be your first consideration and your top priority.  The most popular DEXs are some of the oldest and have the longest track record. Many have been hacked in the past, leading to greater security fixes. 

Because different exchanges offer a variety of options, you may want to consider one of the following: 

Uniswap

Uniswap is the most popular and trusted automated market maker (AMM) for ERC20 tokens (Ethereum-based-tokens). Built on the Ethereum network, Uniswap gives users the opportunity to provide liquidity to trading pairs (earning them interest in the process). As a decentralized exchange, Uniswap users can govern the protocol directly using its native token UNI. This is done by voting on proposals put forward by developers and the community, effectively making Uniswap a DAO. 

Pancake Swap 

Built as a nearly identical copy of Uniswap, Pancake Swap was developed for the BNB Chain (previously Binance Smart Chain). It offers many of the same opportunities to trade and earn as Uniswap, but only for BEP20 tokens (BNB Chain’s native token standard). 

1Inch

Aggregating token prices from multiple DEXs (and across many blockchains) provides traders with the best quote possible. 1Inch has its own AMM-based liquidity protocol, offering rewards in its native token to users who stake their funds. Just like the other DEXs in the list, 1INCH users can also participate in decentralized governance by voting on proposals via the protocol’s native currency. 

DEXs Have a Bright Future

Since CEXs provide security, regulatory supervision, and insurance, they account for the bulk of market activity. However, the rise of DeFi has sparked the creation of decentralized crypto exchange protocols and aggregation tools. They’ve quickly become a very viable, competitive alternative for millions of users. 

And as innovative protocols, supporting mechanisms, user experience (UX), and security improve these markets, it’s a sure bet that more people will flock to DEXs. 

DEXs are essential to the crypto ecosystem but many suffer from poor UX, steep learning curves, and security issues. It’s Sonar’s mission to make crypto more accessible for everyone. That’s why we’re introducing innovative trading functions to Sonar Studio. 

To stay updated on our progress – and be the first to trade on our platform – share your email with us.  

Watchlist
Save tokens you want to track over time
Beta Version: 0.5.4.1