The State of DEXes

Decentralizing exchanges

CEX vs. DEX, fight!

  • Ownership of credentials: This was briefly introduced above, and is the most obvious difference. While in CEXes the exchange is the custodian of your keys and your funds, in DEXes every order and every transaction is done directly by the user. Consequently, DEXes support the use of hardware wallets, and give you full control and responsibility over your keys. But with great power comes great responsibility, which means that if you lose control of your keys or your seed phrase, you immediately lose access to your funds without anyone being able to recover them.
  • Liquidity: Traditionally, CEXes have been more liquid than DEXes, although this is gradually changing. For now though, CEXes have more users than DEXes, which translates into them having more liquidity in their platforms. Also, when trading on a CEX you’re only allowed to trade the tokens listed by the platform, which makes it easier to match orders, and for the corporation behind the exchange to provision the system with additional liquidity if needed by adding funds for their hot wallets.
  • That said, the gap between CEX and DEX liquidity is narrowing, because increased interest in DeFi has resulted in a spike in DEX users. Also, many DEXes are becoming what we call “Automatic Money Makers”, which make use of liquidity pools, making liquidity less of a problem.
  • Token pairs: DEXes enable true peer-to-peer exchanges between their users. As long as two users are willing to exchange one asset for another, these token pairs will be supported by the exchange. On a CEX, however, tokens need to be explicitly listed for users to be able to trade them. CEXes need to implement the pair exchange to support these token trades, limiting the tokens that can be traded on them.
  • Ease of use: CEXes are full-fledged trading platforms. They are an interface between the different blockchains and their users. The fact that there is a single entity operating the platform and orchestrating orders and transactions with the market means that they can build features that are hard to code in a decentralized manner, using smart contracts (such as limit orders, stop losses, and other cool features from traditional financial markets).
  • Also, through their centralized platforms CEXes usually offer the direct purchase of tokens using fiat money. This is why they are so convenient for users looking to make their first crypto investment. In spite of there being ways to achieve this, DEXes in general do not support exchanges between crypto and fiat, which implies that someone looking to use a DEX needs to already own some crypto.
  • Security: This is a huge win for DEXes. It’s no secret that centralized exchanges have been hacked multiple times. Delegating the custody of your keys to the exchange lightens the burden of key management from you, but increases the risks (and the rewards) in the centralized exchange. While with DEXes an attacker needs to compromise the keys of every user to gain access to their funds, in centralized exchanges an attacker can gain access to all the funds in the exchange just by being able to hack the platform and compromise the keys of the hot wallets used to manage and guard users’ funds.
  • Privacy and KYC: Regulators have an easier time regulating CEXes when compared to DEXes, because as their name implies they’re run by a single central entity. Regulators in almost every country in the world force CEXes to impement KYC (Know Your Customer) protocols for users to prevent money laundering and other illegal activities. Thus, in CEXes you are not trading privately anymore: the exchange knows each and every transaction you make, and may even need to inform the state of all your transactions. This is not the case for DEXes, where all you need to start trading is an identity in the blockchain and some tokens to exchange.
  • Fees: CEXes are significantly more expensive than DEXes. For DEXes the blockchain is their main infrastructure, while CEXes need to operate their own system which is also the one responsible for keeping your keys safe. These services need to be paid for in some way, which jacks up the size of the fees they charge,

How to build a DEX

  • Using an on-chain order book. In this design, every transaction is written in the blockchain. Not just the actual purchase or exchange between user balances, but also user orders, i.e. user requests to buy or sell. It is the ultimate decentralization of exchange platforms. However, every operation needs to be completed on-chain, with its corresponding high cost and scalability limitations. Some examples of DEXes that use an on-chain order book are Bitshares and StellarTerm.
  • An alternative to this is to use off-chain order books. In this case, user orders are collected and matched off-chain, while the final transaction is settled on-chain. Since orders aren’t stored on-chain, this method can run into some of the security risks of centralized exchanges, but it doesn’t have the limitations of on-chain order books. In this approach, we trade performance and cost for decentralization (often a huge dilemma in the blockchain and crypto space). Examples of DEXes that use off-chain order books are Binance and EtherDelta.
  • Finally, we have the new sheriffs in town, Automated Market Makers (AMM), which forgo order books all along. With order books if someone wants to exchange token A for token B, there needs to be someone with A that is willing to trade B for an agreed-upon price. Without enough volume in the exchange this can be extremely hard. AMMs remove the need of counter-parties for orders to match, and introduce algorithms to set the price, letting you trade A for B regardless of whether there’s someone on the other end of the trade. This is facilitated through the liquidity pools we mentioned above. Briefly, platforms that use liquidity pools pay their users interest in exchange for keeping their funds in the smart contract that operates the exchange, so they can be tapped for trades. In this approach, individual users are playing the role of financial institutions in traditional markets, where they ensure that the market stays liquid at all times.

DEXes in action!

But there’s still more… L2 DEX

  • It’s built on Metis’s L2 platform, so instead of having to commit every swap transaction to the Ethereum mainnet and pay its corresponding fees, you can trade over L2 and pay Metis’s typical transaction fees of about 1 cent, with the enhanced performance and transaction throughput of a L2 platform. These transactions will eventually be committed on-chain through Metis’ Optimistic rollup, but this is transparent to us, which makes it really convenient to us.
  • Metis has built-in support for DACs (Decentralized Autonomous Companies), which are able to seamlessly create their own tokens. So if you are looking to launch your own crypto project and you want to allow your users to exchange your tokens, you don’t have to worry about creating your own ERC20, having your token listed on an exchange, or waiting for there to be enough liquidity for your token to be exchanged. With MetisSwap, you can create your own token in a few clicks, and start exchanging it for other tokens over L2 without having to write a single line of code.

Closing words

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store