A Deep Dive into Decentralized Exchanges (DEXs)

Let's explore how DEXs work. In this article, we will be taking a closer look at Decentralized Exchanges, one of the essential pillars in the world of Decentralized Finance.

A Deep Dive into Decentralized Exchanges (DEXs)

Let's explore how DEXs work. In this article, we will be taking a closer look at Decentralized Exchanges, one of the essential pillars in the world of Decentralized Finance. If you haven't read our DeFi 101 guide yet, we recommend doing so first.

What are Decentralized Exchanges?

DEXs (Decentralized Exchanges) are cryptocurrency platforms where transactions are conducted without the involvement of an intermediary. Trades are carried out through smart contracts, which are self-executing programs running on the blockchain. Essentially, DEXs act as marketplaces where people are paired with other individuals looking to trade tokens. No custodial service is involved, meaning all assets move directly from one wallet to another.

DEXs are different from CEXs (Centralized Exchanges), which also offer cryptocurrency trading. The main difference is that with CEXs, buyers and sellers relinquish custody of their assets to a centralized organization in order to execute trades. CEXs account for the majority of crypto trading volume because they are easy to use and offer a sense of security due to being regulated entities. However, many people utilize DEXs (in conjunction with CEXs) as they offer advantages like a more comprehensive selection of tokens, anonymity, and self-custody.

Although volume indicates that traders still tend to favor centralized exchanges, DEX activity has grown tremendously in recent years. DeFi giant Uniswap, a DEX in the Ethereum ecosystem, has seen a $500 billion increase in trading volume since the fourth quarter of 2021. As you can probably guess, it's a good idea to be familiar with DEXs if you're serious about diving into the world of DeFi and taking control of your own assets.

How Do DEXs Work?

DEXs are dapps (decentralized apps) built on top of blockchain networks. They operate using smart contracts to conduct autonomous, peer-to-peer transactions. Unlike with CEXs, ownership is immediate; once a trade has been finalized, your new tokens are instantly available in your own wallet. Simply put, DEXs are facilitators, connecting two different parties who want to exchange token A for token B.

There are two main types of DEXs: order book-based and AMMs (Automatic Market Makers). We will be focusing on these two as they are the most popular, though there are other types, such as hybrid platforms and DEX aggregators, which aggregate liquidity from different DEXs for their users.

Order Book DEXs

CEXs (and virtually every TradFi stock trading service) operate using an order book model, so order book DEXs should feel familiar to traders accustomed to using a traditional brokerage platform.

The term "order book" refers to a log of buy and sell orders within an exchange, updated in real-time. In an order book DEX, you can make a market order or a limit order. Market orders are immediate because they are executed at the most current market price by pairing trades at the top of the book. The market price of an asset is determined by the highest bid (order to buy) and the lowest ask (order to sell).

Limit orders are bids and asks at specified prices. Traders set a target price, and their limit order sits in the book until the target price becomes the market price. As such, limit orders are not guaranteed to execute. A limit order will not be filled if the set target price never reaches the top of the order book. For example, if you set a limit order to buy 100 units of coin "x" at $1, but other traders keep placing bids higher than $1, your trade may never be conducted.

There are two types of order book DEXs: off-chain order books and on-chain order books. As the name implies, off-chain order book DEXs are not entirely operating on a blockchain. The order book is run on a centralized server, and only the trade settlement happens on-chain. The advantage to an off-chain order book DEX is increased speeds and reduced gas costs, as other blockchains are not as efficient as the Internet Computer Protocol. However, due to the element of centralization, off-chain order book DEXs must rely on a relayer/server, which presents a point of failure.

With on-chain order book DEXs, everything is conducted on the blockchain. While you lose the speed and reduced cost of using an off-chain order book, there are several upsides to keeping everything on-chain. There is no centralized point of failure, and because all data is viewable on-chain, every market participant has access to important data—this reduces the likelihood of front-running, which can occur with off-chain order books. On-chain order books also have fewer spoof offers because every action, including making a trade offer, costs gas.

The primary advantage of the order book model, whether on-chain or off-chain, is that it enables more complex order types than are generally possible on AMMs, such as setting stop losses. However, order book DEXs are more vulnerable to a variety of market manipulation tactics like false signals (in the form of large buy/sell walls in the order book). Furthermore, even when assuming that all traders will behave ethically, order book DEXs can suffer from liquidity issues. In fact, the liquidity problem was the primary motivator behind the development of AMMs.

Automatic Market Makers

AMMs are an innovation born from DeFi; there is no TradFi equivalent. Most popular DEXs fall under this category—UniSwap, PancakeSwap, and Bancor are all AMMs. Rather than relying on an order book to determine market prices, AMMs use pricing algorithms. Instead of matching buy and sell orders with an order book, AMMs use pre-funded pools of assets governed by smart contracts, called liquidity pools. As you can probably surmise, AMMs are not strictly peer-to-peer but rather peer-to-contract. In essence, however, both AMMs and order book DEXs function similarly, with no entity acting as a middle man but instead relying on smart contracts to pair buyers and sellers.

Pricing algorithms differ across AMMs. Some, like Bancor, make use of oracles (secure data feeds) which provide information from other platforms to determine reference prices of assets. Others rely solely on their algorithms to set market prices. UniSwap, for example, provides an oracle for other AMMs to reference but does not use oracles themselves.

The primary reason AMMs have become so popular in DeFi are liquidity pools and the twofold advantages that they provide. First, it solves the illiquidity issue common to order book DEXs. With AMMs, liquidity exists as long as a liquidity pool exists for a particular trading pair. Second, market-making becomes a more open and democratized process—anyone can become a liquidity provider by contributing to a liquidity pool and earning fees from trading activity. Of course, liquidity pool participation is not without its risks. Impermanent loss can mean a loss in opportunity costs and an eventual, realized (permanent) loss.

Traders who want to utilize AMMs effectively must have an understanding of slippage as well. Slippage is the difference between the expected price of an order and the actual price of the asset when the order executes. Low liquidity in a liquidity pool can mean increased slippage, which is why it's crucial to have a grasp on slippage tolerance (what percentage of price difference one is willing to accept) while trading. Large orders must also factor in the increased slippage they may have to tolerate, as any significant impact on a liquidity pool means an impact on token price.

Advantages of Using a DEX

Whether you prefer the order book model or AMMs, DEXs offer a lot of distinct advantages over Centralized Exchanges:


DEXs provide anonymity, unlike CEXs, which have KYC (Know Your Customer) identification processes in place. While some traders may not have an issue with relinquishing their anonymity, the original culture of cryptocurrency is antithetical to this practice. Plus, others may feel uncomfortable uploading their personal information and identifying facial photos to a centralized entity out of security concerns, like hacks.

Greater Token Availability

Centralized Exchanges have their own vetting process for new tokens. Their criteria are higher and more specific than DEXs, which generally tend to follow an open and democratic process for token listing. Because of this, DEXs offer a much wider selection of tokens for trade.

Many cryptocurrencies start by listing on a DEX first, then as a project grows and becomes more popular, it gets listed on a major CEX. This means that early investors in a particular token can turn a huge profit once it gets listed on a CEX (the positive price action correlated to a coin getting listed on Coinbase, one of the biggest Centralized Exchanges is even dubbed "the Coinbase effect").

Self Custody

Recent market turbulence is demonstrative proof that self-custody should be a high priority for crypto holders. As the saying goes, "not your keys, not your crypto." Even with a CeFi giant like Coinbase, your assets are at risk if the company becomes insolvent, as they could be locked and seized due to no fault of your own.

While self-custody can be burdensome, it also mitigates the bulk of counterparty risk: you will never be at the mercy of another entity if you manage your own wallet directly. Crypto.com's reversal of profitable LUNA trades from May 12, 2022, is an excellent example of why self-custody is so important.

The Disadvantages of DEXs

Of course, DEXs present their own set of challenges. For one, they do not provide an on-ramp for fiat, making the use of a CEX unavoidable for the majority of cryptocurrency traders. There are also significant gas fees on chains like Ethereum for every transaction made, meaning that high volume/high-frequency traders are financially better off staying on a CEX.

Another major hurdle for DEXs is the higher learning curve required to manage trades and security risks effectively. Due to the more lax vetting process of listing on DEXs, there can be malicious token contracts (as was the case with $SQUID, an unofficial "Squid Game" token that let people buy in but would not let them sell).

Rug pulls are not uncommon in the space, even if a token contract is legitimate. Because there is no accountability with anonymously-run projects, bad actors may pump up the price of a token and then dump their holdings suddenly, leaving an illiquid market and real investors holding the bag. While savvy traders can avoid these pitfalls, these are all disadvantages that can deter newcomers.

InfinitySwap: A Next-Generation DEX Built on the Internet Computer

The Internet Computer is a technologically advanced blockchain that solves many of the problems inherent to DEXs built on other chains. InfinitySwap takes the unique capabilities of the Internet Computer to build a revolutionary DEX and AMM.

Introducing Infinity Swap: The Next Generation of DeFi
InfinitySwap is a DeFi platform co-founded by Max Chamberlin and Alessandro (Alex) Rietmann. Both are Cambridge graduates.

Negligible gas fees and true scalability mean that DeFi on the Internet Computer will be faster and cheaper than on other blockchains. Native Bitcoin integration is on the horizon, which will allow Bitcoin holders to interact with DeFi securely, unlike on other chains where Bitcoin must be "wrapped" and held in an escrow account, leaving funds vulnerable to hacks. The DFINITY Foundation is also committed to native Ethereum integration in the future, which will open up the largest DeFi market to the Internet Computer ecosystem.

InfinitySwap takes the groundwork laid by its predecessors, like UniSwap, and improves upon it to better serve all market participants. We provide a full suite of DeFi tools, including our advanced IS20 token standard (which is compatible with ERC20, the most commonly used token standard in crypto), our SocialFi-enabled InfinitySwap wallet, bootstrapping liquidity pools (specialized liquidity pools that make token launches more efficient for teams), a decentralized bidding market for Cycles (computational units unique to the Internet Computer) and more.

InfinitySwap - The IS20 Token Standard: Decentralized and Interoperable
Token Standards have been a sticky subject for the Internet Computer community. Everyone agrees on their importance, but with so many possibilities for their design, it has been a struggle for the ecosystem to reach a consensus and deliver on one.

Furthermore, the InfinitySwap team is committed to education and becoming a helpful resource during this time of DeFi evolution. Our blog strives to keep market participants informed and prepared for the future we are spearheading. Don't forget to stay up to date by subscribing to our newsletter and following us on social channels!

Interview with Max Chamberlin: CEO of InfinitySwap
We wanted to get to know Max Chamberlin, CEO of InfinitySwap. In this interview, we ask about the overall vision shaping the project, thoughts on the Internet Computer technology on which the project is built, and where the future lies in relation to decentralized finance.

Connect with InfinitySwap

Twitter | Website | Telegram | Discord | Github

Twitter | Website | Telegram | Discord | Github

*Disclaimer: While every effort is made on this website to provide accurate information, any opinions expressed or information disseminated do not necessarily reflect the views of InfinitySwap itself.