One of the biggest activities in finance is trading which used to be done on central limit order books (CLOB). However, trading traditionally involves having your assets on a central platform while they partner with large market makers that provide and control liquidity.

Other problems that come with relying on a centralized party include having your assets on the platform which is subjected to hacks, reduced privacy on trades and orders, potential insolvency and asset freezes from mismanagement, and more.

The contagion that happened to CeFi platforms in June of 2022, from withdrawals being paused to insolvency with undercollateralized lenders, is an important reminder that problems exist in the current TradFi model we have today.

DeFi and Dapps were created to solve some of these problems. One of the most popular types of Dapp right now is trading, which can be done via decentralized AMM or order book platform.

Let’s explore the pros and cons of each method and which approach Demex has chosen.

What is a decentralized exchange (DEX)?

A decentralized exchange (DEX) is a marketplace where users can trade cryptocurrencies asset peer-to-peer on the blockchain, and provide liquidity with their assets, all without an intermediary or third party to facilitate the transfer and custody of the assets.

This transfer is done through the use of smart contracts and prices are determined depending on the type of DEX, such as an automated market maker (AMM) DEX or an order book DEX. Note that although DEXs are commonly AMMs, DEXs can also be order book based.

One key advantage against CeFi and Tradfi is that all DEXs are non-custodial and permissionless, so your assets are always yours and can’t be seized or frozen by the exchange, reducing counterparty risk.

As the saying goes, 'Not your keys, not your coins'.

Another advantage is that DEXs usually offer greater transparency into the liquidity, movement of funds, and trades that take place.

In DEXs, protocols can also be composable, allowing others to build on top of them permissionlessly, fostering innovation, such as building a lending protocol on top of a DEX that allows users to use their provided liquidity as collateral to borrow against.

DEXs can come in two forms, an automated market maker (AMM) or a central limit order book style (CLOB). Let's explore the differences.

What is an automated market maker (AMM)?

An AMM is a type of exchange platform that has an automated market maker. This is done by having the AMM use liquidity pools, which are baskets of two or more assets, to determine the exchange rate between those assets.

They are often held by a smart contract and are often permissionless, meaning that anyone can provide liquidity or create their own liquidity pool from scratch, receiving a liquidity provider (LP) token which determines how much share the trader owns in the liquidity pool.

The benefit of AMMs is that liquidity pools will spread the liquidity on both sides, allowing traders to see the price and able to trade at any size even if the pool has low liquidity.

In terms of order types, most AMM DEXs only offer market orders and usually do not come with other common types of orders like limit orders, stop losses, buy- stop orders.  

Uniswap's 'Market Order' Swap feature

In order to get prices to match with other exchanges, arbitrage is used as a stabilizing mechanism, which incentivises traders to push the price determined by the AMM exchange closer to the spot price present in other exchanges.  

Popular examples of AMMs are Uniswap which uses the constant product curve of xy = k and Curve which is a stableswap DEX that uses an in-between of the constant product curve and the constant sum curve of x + y = k.

Constant Product Curve

Source: Curve Whitepaper

What is an order book?

An order book, or a Central Limit Order Book (CLOB), is made up of buy and sell limit orders from market participants.

FTX Central Limit Order Book

Source: FTX

The market price for an asset is the lowest asking price (sell order) or the highest bidding price (buy order). Placing a market order means a trader would buy or sell at the market price instantly, taking away liquidity from the order book, hence they also often pay a taker fee.

Another popular type of order is a limit order, where traders would specify the price where they would want to buy or sell a token. This usually means the order would sit on the order book while it is waiting to get filled. A limit order thus makes the liquidity of the order book thicker, hence they often receive a maker fee or rebate for this type of order.

This order book matching mechanism essentially matches active buyers and sellers at a specified price, providing more control to traders.

What about liquidity? For centralized order books, this is usually provided by permissioned market makers where they provide liquidity by placing a whole range of limit orders on both sides of the markets. However, the lower the trading volume, the lesser the need of adding liquidity at every price level, and hence the wider the spread.

For decentralized order books, liquidity can be provided by permissioned market makers or permissionless liquidity pools, and whether the liquidity is on-chain or off-chain matters too.

Popular examples of centralized order books are FTX and Binance, while in the decentralized arena we have dYdX, Serum, and Demex.

On-chain vs off-chain order books

Order books can be on-chain or off-chain.

On-chain order books, like Demex, have their order placement, leverage, matching, and settlement engine done on-chain, with transactions verified by validators. Index prices are also determined by validators who act as price oracles, submitting last traded prices from various exchanges via "votes" to the chain for the oracle to determine the index price of a market.

Off-chain order books, like dYdX, uses off-chain logic to handle trades, transactions, liquidations, index price, etc.

​​​​Pros and cons of AMMs vs Order books

Now that we understand more about AMMs and order books, let’s explore their pros and cons.

Exploring popular order book DEXs

What is Serum?

Serum is also a fully on-chain permissionless decentralized trading exchange that allows other third parties to integrate with it, and is the main DEX on Solana.

Composability is the main thing in Serum as it allows other DEXs to build on top of Serum’s liquidity on the backend, and create their own frontend GUI.

This composability allows most of the liquidity on Solana to concentrate on Serum, providing deeper liquidity, lower slippage, cheaper fees, and an overall better trading experience to users on Solana.

What is dYdX?

dYdX is an off-chain decentralized orderbook trading platform that focuses on perpetual swaps. It allows traders to use leverage and margin, and is able to achieve high throughput trading, reaching volumes that match centralized exchanges.

dYdX offers deep liquidity and their liquidity comes from their own exchange, enabling liquid, and low slippage trading experience for the DeFi users, which is unlike AMM models.

What is Uniswap?

Uniswap is the most popular decentralized AMM DEX in DeFi right now. They popularized the constant product curve and uses an AMM instead of order books.

Uniswap is a special entry because although they are an AMM DEX, they can function as a limit orderbook with their concentrated liquidity.

Uniswap v3 was launched on May 2021, featuring concentrated liquidity, which is the ability to create a liquidity pool in a specific range. With this, a user can set a pseudo limit order by providing a single asset as liquidity at a specific price. This is known as a range order.

Unlike some markets where limit orders may incur fees, the range order maker generates fees while the order is filled. This is due to the range order technically being a form of liquidity provisioning rather than a typical swap, thus earning liquidity provision swap fees.

You can read more about range orders here.

What is Demex?

Demex is a fully on-chain permissionless decentralized orderbook derivatives trading platform that supports all kinds of financial instruments from futures to even options.

Demex is built for performance on the scalable Layer-2 blockchain, Carbon. Carbon is capable of handling bursts of up to 10,000 transactions per second.

Demex’s robust architecture further avoids the problems that have plagued many decentralized exchanges, allowing traders to take positions of up to 150x leverage, while minimising socialized losses and auto de-leveraging, similar to on centralized exchanges like FTX.

This efficiency means that traders can save more, and earn more. Uncompromised decentralization Demex’s order placement, matching, and settlement system is on-chain, and transactions are verified by a max validator set of more than 20.

Users can trade  immediately and anonymously, via Keplr, Ledger, MetaMask, and other self-custody wallets. Users stay in control of your funds throughout the trading process.

How does Demex differentiate between other DEXs such as dYdX, Serum, and Uniswap?

dYdX vs Demex

dYdX and Demex are similar in that both are orderbook based DEXs with similar oracle methods and can trade with high TPS and offer leverage.

However the main difference is that Demex is fully on-chain compared to some aspects of dYdX which are off-chain, mainly in the areas of liquidity provision and asset listing.

dYdX liquidity comes from market makers creating limit orders, as well as from professional market makers who are permissioned by dYdX to use liquidity from the USDC liquidity pool which is a permissionless USDC pool. Both forms of liquidity provision receive dYdX rewards.

Demex combines the best of both worlds, allowing for fully decentralized and automatic liquidity provision  where anyone can create their own liquidity pools and earn SWTH incentive rewards at the same time. The Demex engine uses the liquidity from the pools and spreads it on both sides of the order book, using the Uniswap constant product pricing function.

On top of this, users can also set limit orders on the trading platform UI directly, creating additional maker order liquidity.

Additionally, asset listing is currently centralized by the dYdX Trading Team and they are still creating a process for dYdX holders to request new assets to be listed.

For Demex, asset listing is completely open and permissionless and the team is working hard on a bridge module that would enable anyone to bridge assets across all supported chains in one transaction, even without a Carbon account.

Previously, users will need to submit a governance proposal to list new tokens, but with the permissionless token import feature, anyone can add their desired token on Demex supported chains effortlessly by just selecting the desired blockchain and token address, giving users full control over what token is being listed.

dYdX only accepts USDC as collateral which limits the user’s capital efficiency as they are unable to use other assets like BTC and ETH as collateral for margin trading.

Demex will soon enable any IBC asset as collateral, which will improve the user’s capital efficiency and allow for more flexible trading strategies such as buying BTC and using the BTC as collateral to short BTC, creating a synthetic short position all on one platform.

Serum vs Demex

Serum and Demex are similar in that both are fully on-chain, high-speed, orderbook based DEXs and can trade with high TPS.

Serum relies exclusively on getting other DEXs to integrate with Serum for liquidity while these third party dapps focus on providing their own GUI and DEX features such as swaps, margin, and leverage. This means that users are not able to interact with Serum directly and have to rely on third party dapps to trade.

This allows for a wide variety of dapps with different features being built on top of Serum, such as Mango Markets offering multiasset collateral and leverage, Raydium offering both an AMM swap feature and a limit order book DEX, etc.

This is similar to Carbon being the blockchain infrastructure for financial instruments that other third party developers can build on. As an example, Demex is a CLOB DEX that is built on the Carbon blockchain infrastructure.

Serum’s transactions can actually be frontrun by bots despite the lower risk on Solana due to their Proof of History consensus mechanism. In fact, someone has claimed they made $1.4m from front running on Solana.

Demex prevents frontrunning using batch auctions. On Carbon, each block is like a mini auction, and all orders within a block are treated as the same price until they enter the orderbook.

For example, for an ask at 3k, if one trader bids at 4k and another at 3.5k, both bids will clear at the unit order price at 3k but the amounts will be prorated and divided up equally between the parties bidding for that quantity.

You can read more about how Carbon prevents frontrunning here.

Uniswap vs Demex

Uniswap and Demex are similar in that they are both on-chain and fully permissionless DEXs, but their similarities end there.

Uniswap is an AMM DEX that does not offer derivatives and leverage whereas Demex is a orderbook based DEX with derivatives and leverage which is a lot more suitable for traders.

For a summarized view of the differences, you can take a look at this table:


DEXs are one of the key pillars of DeFi and crypto, as a decentralized network needs a decentralized exchange to trade assets.

AMM DEXs have thus far been the most popular and widely used dapp, offering spot trades with a cumulative volume higher than limit order DEXs. dYdX has achieved $308b of cumulative volume for dYdX since the start of 2022 to the end of June 2022, while Uniswap has achieved roughly $330b of cumulative volume in the same time period.

Traditionally, derivatives should have a far higher volume compared to spot market orders due to the leverage that often comes with derivatives.

We believe this is because derivatives and limit order DEXs are still new and that eventually limit order derivative DEXs will eventually grow and be bigger in volume than AMM DEXs as is the case in TradFi.

Limit order DEXs offer a similar UIUX to traditional brokerages which should be easier to onboard new users compared to AMM DEXs, and DEXs are also likely to continue to gain market share against CEX due to custody reasons that have happened recently.

We believe Demex’s order book DEX will offer the best of both worlds, the security, custody, and DeFi features of a DEX, coupled with the speed, ease of use, and derivative products of a CEX.

About Switcheo Labs

Switcheo Labs is a creative and experimental think tank that guides and nurtures decentralized ecosystems in the DeFi space. Founded in 2018, Switcheo Labs was born out of a simple desire to make finance accessible and trust optional. Recognizing the financial challenges that currently exist, Switcheo Labs innovates on robust alternatives to put power back where it rightly belongs, in the hands of the people.

For more information on Switcheo Labs: