Blockchain makes it possible to exchange assets of value on a peer-to-peer basis without relying on any centralized entity to govern the transaction. But when it comes to purchasing and exchanging crypto assets, users still tend to favor centralized platforms. Decentralized exchanges (DEXs) are, however, gaining in popularity. Yet, just like anything else, DEXs have their pros and cons.

This article outlines how decentralized exchanges work, the different types of DEX, compare them to their centralized alternatives and the benefits and risks they bring to the cryptocurrency ecosystem.

I. What is a Decentralized Exchange?

A DEX (decentralized exchange) is a peer-to-peer marketplace where users can trade cryptocurrencies in a non-custodial manner without the need for an intermediary to facilitate the transfer and custody of funds. DEXs substitute intermediaries traditionally, banks, brokers, payment processors, or other institutions—with blockchain-based smart contracts that facilitate the exchange of assets.

DEXs practice the same process, with the core difference being that they mimic centralized trading platforms. Their goal is to provide a blockchain-powered platform that offers trading services and liquidity to crypto investors, just like Binance or Coinbase does.

DEX achieves that feat by using smart contracts - a bundle of code that is automatically and autonomously executed once certain conditions are met. Such a structure allows DEX operators to automate withdrawals, deposits, and trades without having to authorize or initiate any actions.

DEXs are a cornerstone of decentralized finance (DeFi) and serve as a key “money LEGO” upon which more sophisticated financial products can be built as a result of permissionless composability.

Source: TheBlock

II. Decentralized vs. Centralized Exchanges

Compared to traditional financial transactions, which are opaque and run through intermediaries who offer extremely limited insight into their actions, DEXs offer complete transparency into the movement of funds and the mechanisms facilitating exchange. In addition, as user funds don’t pass through a third party’s cryptocurrency wallet during trading, DEXs reduce counterparty risk and can decrease systemic centralization risks in the cryptocurrency ecosystem.

Let’s say you want to buy some Bitcoin.

For CEXs, you go to an exchange, sign up and complete the KYC process with personal identity and deposit some cash on your wallet on the exchange, which is actually an exchange wallet. The exchange will show those Bitcoins in your account, and you can trade for other tokens on the exchange. But in fact, you don’t really assess any Bitcoin, you’re entrusting the exchange to act as a custodian on your behalf. Any trading you do isn't occurring on blockchain, but within the exchange’s database.

For DEXs, DEXs handle everything transaction in automated manners, and their participants (users) are often involved in the process of decision-making.

On the other hand, centralized exchanges are generally far easier to use for newcomers, and they can often offer fast trading because they’re not beholden to blockchain infrastructure. This has been CEXs’ biggest achievements: making itself the household name for crypto-curious folks looking to dip a toe into buying crypto, but intimidated by the process. For those people, letting Binance/Coinbase (or any other centralized exchange) act as custodian of their funds is just fine.

In fact, the trading volume on CEXs is many times larger than that of DEXs, because literally, CEXs are the place where the most liquidity is gathered. That's also one reason why DEX has not really attracted many users both retailers and funds. However, as mentioned at the beginning of the article, DEX will be the first place to receive money in "DeFi Legos", so we can still see DeFi's liquidity problem will improve soon when there are many continuous improvements. move towards a liquidity pool model and quotes fetching.

Although the DEX model officially has a product from 2019, it still cannot match the long history of the centralized exchange. DEXs are still in the early development stage, but they undoubtedly implement an innovative concept that is demanded by cryptocurrency markets.

III. How Does a DEX Work?

It’s worth mentioning, though, that in reality, many online exchanges calling themselves decentralized are not absolutely decentralized. They use their own servers to store the trading data, though they don’t have access to users’ private keys.

There are several DEX designs, each offering different benefits and trade-offs in terms of feature-sets, scalability, and decentralization. The two most common types are order book DEXs and automated market makers (AMMs). DEX aggregators, which parse through multiple DEXs on-chain to find the best price or lowest gas cost for the user’s desired transaction, are also a widely used category.

One of the main benefits of DEXs is the high degree of determinism achieved by using blockchain technology and immutable smart contracts. Whereas in centralized exchanges (CEXs), such as Coinbase or Binance, the platform facilitates trading using the internal matching engine of the exchange, DEXs execute trades through smart contracts and on-chain transactions. Furthermore, DEXs allow users to maintain full custody of their funds via their self-hosted wallets during trading.

DEX users are typically required to pay two types of fees—network fees and trading fees. Network fees refer to the gas cost of the on-chain transaction while trading fees are collected by the underlying protocol, its liquidity providers, token holders, or a combination of these entities as specified by the design of the protocol.

The vision behind many DEXs is to have permissionlessly accessible, end-to-end on-chain infrastructure with no central points of failure and decentralized ownership across a community of distributed stakeholders. This typically means protocol administrative rights are governed by a decentralized autonomous organization (DAO), made up of a community of stakeholders, which votes on key protocol decisions.

However, maximizing the decentralization of the protocol while keeping it competitive in a crowded DEX landscape isn’t an easy feat, as the core development team behind the DEX is generally able to make more informed decisions about mission-critical protocol functionality than a distributed set of stakeholders. Even so, many DEXs opt for a distributed governance structure in an attempt to increase censorship resistance and long-term resiliency.

IV. Types of DEXs

DEXs handle in one of three classic ways: an on-chain order book, an off-chain order book, or an automated market maker approach, and a new hybrid solution: request-for-quote.

Off-Chain Order Book

Exchanges with off-chain order books take decentralization down a notch by using a centralized system to host their order books. Rather than being stored on blockchain networks, orders on this type of exchange are processed by an offline entity that is not decentralized. Nevertheless, the trades themselves are still executed on-chain.

On-Chain Order Book

An order book—a real-time collection of opening buy and sell orders in a market—is a foundational pillar of electronic exchanges. Order books allow an exchange’s internal systems to match buy and sell orders.

Fully on-chain order book DEXs have been historically less common in DeFi, as they require every interaction within the order book to be posted on the blockchain. This requires either far higher throughput than most current blockchains can handle or significant compromises in network security and decentralization. As such, early examples of order book DEXs on Ethereum had low liquidity and suboptimal user experience. Even so, these exchanges were a compelling proof of concept for how a DEX could facilitate trading using smart contracts.

With scalability innovations such as layer-2 networks like optimistic rollups and ZK-rollups and the launch of higher-throughput and app-specific blockchains, on-chain order book exchanges have become more feasible and now attract a considerable amount of trading activity. Additionally, hybrid order book designs have become more popular, where the order book management and matching processes take place off-chain while the settlement of trades occurs on-chain.

Some popular order book DEXs include 0x, dYdX and Loopring DEX.

Automated Market Makers (AMMs)

Automated market makers are the most widely used type of DEX as they enable instant liquidity, democratized access to liquidity provision, and in many cases, permissionless market creation for any token. An AMM is essentially a money robot that is always willing to quote a price between two (or more) assets. Instead of an order book, an AMM utilizes a liquidity pool that users can swap their tokens against, with the price determined by an algorithm based on the proportion of tokens in the pool.

Since they’re always able to quote a price for a user, AMMs enable instant access to liquidity in markets that otherwise may have lower liquidity. In the case of an order book DEX, a willing buyer has to wait for their order to be matched with the order of a seller—even if the buyer posts their order to the “top” of the order book close to the current price, the order may never execute.

In the case of an AMM, the exchange rate is determined by a smart contract. Users can get instant access to liquidity, while liquidity providers (depositors into the AMM’s liquidity pool) can earn passive income via trading fees. This combination of instant liquidity and democratized access to liquidity provision has enabled an explosion of new tokens being launched through AMMs and unlocked new designs that focus on distinct use cases, such as stablecoin swaps. If you’d like a more detailed exploration of AMMs, read this post covering how AMMs work.

While most current AMM designs deal with cryptocurrencies, AMMs could also be used to facilitate swaps of NFTs, tokenized real-world assets, carbon credits, and much more.

Some popular AMM DEXs include Bancor, Balancer, Curve, PancakeSwap, Sushiswap, Trader Joe, and Uniswap.

Request-For-Quote

A request-for-quote is a standard financial process whereby suppliers are invited/requested to start a bidding process, leaving to bidding on specific services and products. More detailed specifications about the asset will result in a more reliable demand factor. Quote trading will involve investors requesting quotes on spreads offered, commission/transaction fees and prices.

By using a RFQ model to allow professional market makers to manage liquidity pools, the protocol solves these issues. In turn, traders and liquidity providers (LPs) gain access to enhanced efficiency, security, and products previously impossible in DeFi.

In other words, a hybrid approach, where institutional-grade market makers with deep experience in efficiently managing capital, like CEXes, are aggregated to provide automated quotes through a permissionless front-end whereby users benefit from lower trading fees and retain the security of on-chain settlement and self-managed custody of DEXes.

Just one RFQ DEX so far is Hashflow.

V. Pros and Cons of Decentralized Exchanges

No doubt, DEXs have been a breath of fresh air to the world of online exchanges, but they have both advantages and disadvantages. Since DEX trades are facilitated by deterministic smart contracts, they carry strong guarantees that they will execute in exactly the manner the user intended, without the intervention of centralized parties.

Benefits of DEXs

Anonymity

Decentralized exchanges provide complete anonymity for their users. In the majority of cases, they don’t require any form of sign-up process. That is why no personal data is collected. Investors don’t have to pass KYC and AML compliance procedures or other identity checks.

There are some legal requirements that cannot be neglected by central authorities, but they don’t work in the case of a truly decentralized platform. Of course, the legislative system will adapt to this kind of exchange with time, but now, thanks to DEXs, it is possible to trade in a completely anonymous manner.

Security

Perhaps the biggest problem with centralized exchanges is the risk of being hacked, as the central storage of users’ funds turns into a honeypot for any attacker that manages to get through. The news about hacking attacks on popular platforms shows up in the media regularly, despite all the security measures put in place.

This results from the custodial nature of centralized exchanges, which means that they hold their investors’ assets themselves. Decentralized exchanges, on the other hand, are noncustodial. They allow users to integrate directly with their wallets. There is no single access point to all the assets and users’ data. This makes hacking more difficult and less profitable because an attacker would have to break into every individual account, instead of stealing from a central hub.

Self-custody

DEXs have no access to users’ funds, which not only lowers the risks of hacking attacks, but also lessens interference from the third parties, either from the management of the exchange or the local authorities. The funds will not be frozen, the withdrawals will not be delayed or denied, and the exchange will not be blocked by legislative authorities.

Cheaper

The absence of third parties makes the transactions much cheaper, compared to their centralized counterparts. While centralized exchanges usually impose taker and maker fees, with DEXs users only have to pay a network fee. Thus, decentralized exchanges provide users with a much cheaper and safer solution, compared to their centralized alternatives.

No regulation

One of the main difficulties connected with the regulation of decentralized exchanges is that in most cases, they are not controlled by a definite legal entity or person. This leads to problems with the definition of a responsible person if violations are found. There can be considerable difficulties with regard to the regulation, per se, of trading activities. That is why it is impossible to apply measures and rules to them that are applicable to centralized exchanges.

DEXs Risks and Considerations

The same peculiarities of the decentralized exchanges’ architecture and full users’ control that result in the advantages mentioned above lead to a number of disadvantages and problems.

Bad UI/UX

Many trading options such as stop losses, margin trading, technical analysis tools and lending are not available on the most decentralized exchanges. To begin trading, it is necessary to become familiar with browser extensions and smart contracts  and the interfaces are often not user-friendly. Decentralized platforms rarely support fiat currencies, and the process of depositing funds may turn out to be rather confusing and complicated.

Poor Liquidity

Decentralized exchanges struggle with liquidity. They support diverse trading pairs, while the number of users is much lower. Their liquidity mainly depends on the number of participants actively trading on the platform, which makes things more complicated since centralized exchanges remain more popular these days.

Frontrunning Risk

Due to the public nature of blockchain transactions, DEX trades may be frontrun by arbitrageurs or maximal extractable value (MEV) bots trying to siphon value from unwitting users. Similar to high-frequency traders in traditional markets, these bots try to exploit market inefficiencies by paying higher transaction fees and optimizing network latency to exploit ordinary users’ DEX trades.

Token risk

As many DEXs feature permissionless market creation—the ability for anyone to create a market for any token—the risks of buying low-quality or malicious tokens can be higher than in centralized exchanges. DEX users need to consider the risks associated with participating in early-stage projects.

Low Transaction Speed

The distribution of blockchain nodes means low throughput. Centralized platforms demonstrate higher indices because they have centralized servers. That is why the average order execution of centralized cryptocurrency exchanges is much faster. Slower performance on DEXs may lead to so-called “price slippage” when a transaction cannot be executed, due to changes in the prices of the cryptocurrencies that are swapped.

Difficult in Customer Support

DEXs don’t have customer support that is able to influence the transactions or the users’ accounts. If anything goes amiss, users will have no one to assist them. Despite these obstacles, DEXs are still much more reliable and safer when compared to centralized platforms. Moreover, they are a much better fit for experienced users who understand the risks and are ready to take responsibility for their activities there.

VI. The Bottom Line

DEXs are a foundational pillar of the cryptocurrency ecosystem, letting users exchange digital assets in a peer-to-peer manner without the need for intermediaries. DEXs have experienced increasing adoption in the last few years due to the instant liquidity they can enable for newly launched tokens, their seamless onboarding experience, and the democratized access to trading and liquidity provision they provide.

It remains to be seen if the majority of trading activity will migrate to DEXs and whether current DEX designs will support long-term growth and institutional adoption. However, DEXs are expected to remain vital infrastructure for the cryptocurrency ecosystem and will continue to see improvements in transaction scalability, smart contract security, governance infrastructure, and user experience.

We have yet to see whether the new wave of exchanges will achieve that goal, as many obstacles still exist. Fees are unbelievably high, trading interfaces are primitive, and they are nowhere near reaching the level of liquidity that centralized platforms offer. Once the DeFi sector matures and developers focus more on building rather than marketing during a euphoric environment, we will surely see a positive shift in tone.

DEX advocates mostly agree: "those are the tradeoffs for true decentralization."