CEX and Common Types of DEXs

Check out our new platform 🚀 https://thecapital.io/

Photo by Austin Distel on Unsplash

The first crypto exchanges appeared a little over ten years ago, and their number is increasing each month. CoinGecko registered more than four hundred crypto exchanges (362 for spot trading, 57 for DEX, 42 for derivatives); meanwhile, Cryptowisser listed over 570 crypto exchanges on their website. According to statistics from Nomics, in September 2020 the total trading volume of crypto exchanges was over $80 billion. Dune Analytics shows that DEXs’ trading volume increased by 83.5 times year-on-year between 2019 ($281 million) and 2020 ($23.5 billion). With the widespread adoption of smart contracts and the development of decentralized finance (DeFi) in the past few years, decentralized exchanges (DEXs) became a significant trend in the crypto industry. Nowadays, Github lists more than two hundred DEXs and their protocols of original architecture; around one hundred of them are used for testing or deployed to mainnet. Following the DEX movement, many CEXs have also been developing their own DEX applications to enhance their potential by effectively using the advantages of decentralized trading models.

In this article, we will consider several DEX models that are currently available or being in the final stages of development.

Above all, before turning to DEXs, we will identify the key features of centralized exchanges (CEXs).

Centralized Exchange

  • A centralized crypto exchange is an online platform (to buy and sell crypto assets and their derivatives on demand) that is run on centralized servers, managed, and fully controlled by a specific entity.
  • A CEX is a middleman facilitating the trading process. For trading purposes, users deposit their cryptocurrencies and tokens to the CEX. The CEX becomes a custodian of their users’ crypto assets: it consolidates their deposited assets into a few high-value wallets and holds the private keys to these assets for users. At the same time, the CEX issues IOUs corresponding to the value of deposited funds with which users can conduct trades on the CEXs.
  • During the trading process on CEXs, the transactions are not broadcasted over the blockchain network. As a result, the transactions are executed almost instantaneously.
  • A CEX identifies their users’ personal details (e.g., by their email addresses) and in some cases can require their KYC documents.
  • On a CEX liquidity is organized by the exchange by having more people trading on it and by cooperating with market makers or liquidity providers. To that end, for the purpose to keep liquidity high, on some CEXs there are lots of pairs composed of BTC or ETH, while trading pairs of other assets are significantly limited. However, decentralized liquidity features, like AMM (see below), began to appear on centralized exchanges; for instance, Binance launched a decentralized feature on its platforms — Binance Liquid Swap — in which liquidity is provided by crypto users adding their assets in a pool.
  • A CEX is set up for making a profit and directly earns fees determined by them which are paid by users.
  • To be traded on CEXs, cryptocurrencies and tokens need to get listed on these exchanges. Large CEXs have developed their own review processes and listing criteria (e.g., an examination of compliance with AML and securities laws, market supply and market demand, the core team’s experience, strategic vision, use cases).

Decentralized Exchange

Nowadays, there is a variety of DEX models implementing different technologies and features, as well as a plethora of definitions given to a DEX. Peter Van Valkenburgh in his article “There’s no such thing as a decentralized exchange” put forward an interesting idea that is to shift from the defining of DEX as an object to describing it as an action: “We have this habit of saying that a DEX is a thing rather than an action because we are stuck in a centralized services frame of mind…There are no DEXs; there is just decentralized exchange, the action, taking place using software tools, open blockchains, and the internet.” Broadly speaking, a decentralized exchange is an action expressed in the engagement of the parties treated equally in the process of swapping, whereas the decentralized exchange platforms are the tools which facilitate this process.

Generally, the process of decentralized exchange involving DEX platforms has the following properties:

  • Users make transactions with no intermediary managing their crypto assets (like CEXs); the role of DEX platforms is only to connect them in one way or another.
  • Interacting with DEXs, users always remain in control of their crypto assets, stored in the users’ wallets, or locked in smart contracts.
  • Transactions are carried out via automated mechanisms (such as smart contracts). However, some DEX platforms are operated semi-automatically with the involvement of the platform’s operators.
  • DEX platforms operate with pseudonymous data of users (public addresses) and, as a rule, do not store their personal details.
  • The liquidity is provided by users. As such, often there are no listing requirements and processes set by DEX’ teams; initial liquidity is added and subsequently removed under the same model mechanisms (yet, some DEXs, like Kyber and Binance DEX, do not give authorization to anyone interested in providing liquidity).
  • Trading fees are distributed among participants of DEXs or blockchain operators (liquidity providers or nodes).

More specifically, Komodo defines a true DEX by giving four core requirements a DEX must meet: non-custodial, both on-chain and cross-chain, permissionless, and asset agnostic. Let’s consider every requirement in detail.

Non-custodial

A DEX must not hold users’ funds; only users control their private keys and funds during the entire trading process. On some DEXs, users need to deposit the amounts corresponding to their orders in advance to be locked in smart contracts. It does not seem to diminish the non-custodial nature of such DEXs, as those smart contracts are neither funded nor controlled by any entity.

On-chain and cross-chain

On an on-chain DEX, all transactions are submitted from each users’ personal wallet, verified by miners as part of a new block, and then recorded on each blockchain involved.

A cross-chain DEX allows swaps between different independent blockchains (e.g., to swap BTC for ETH). Nowadays, on many exchange platforms run on a particular blockchain (e.g., Ethereum, EOS, Tron), users can make transactions only with tokens created on that blockchain.

Permissionless

To trade on a DEX, users do not need to obtain permission from any authority or to be registered. A DEX can be used by anyone, regardless of their geographic location or nationality. A DEX does not require users to provide their personal details or KYC documents.

Asset agnostic

On a DEX, users may freely make any trading pairs of listed crypto assets. By contrast, on many CEXs, there are lots of trading pairs in which one asset is always BTC or ETH, while the direct exchange between other tokens is limited to several pairs.

The stated requirements for DEXs are some kind of purely aspirational ideas desirable to achieve, as in practice it is unlikely to find an operating DEX that completely fulfills all of them. Many DEXs still have some centralized elements and maintain control functions. Moreover, the ability to make transaction settlement on-chain and cross-chain interoperability is difficult to develop and are met by only a few DEX platforms.

Below we will consider some common types of DEXs.

1. Automated Market Maker Protocols

Automated market makers are smart contracts that hold a liquidity pool, i.e. an aggregation of tokens (it can consist of a pair of tokens of equivalent value; e.g., BTC/ETH), where the entire exchange process is automated by mathematical formulas. Liquidity is secured by liquidity providers — anyone who deposits assets into a pool. In return, a liquidity provider can receive a pool token representing his share of the total funds in the pool. This model does not imply an order book like in a traditional exchange. Hence, traders do not interact with each other; instead, their ‘counterparties’ are readily available pools trading assets at a price determined by an algorithm. Transaction fees paid by the traders dealing in the pool are distributed among the liquidity providers in accordance with their contribution to the pool.

The most popular AMMs are Uniswap, Balancer, and Curve. They aggregate assets into liquidity pools allowing liquidity providers to earn trading fees. On Uniswap users may deposit only a pair of ERC-20 tokens per a pool in an exact 50% ratio between two assets, where the balance ratio between them fully determines the price of these tokens, and a fee for swapping is set at 0.3%. Balancer is much like Uniswap, offering additional features such as multi-token pools (up to 8 tokens in a pool), adjustment of pool ratios and swap fees (from 0.0001% to 10%). Curve’s liquidity pools are designed only for stablecoins (like USDC or DAI), a great advantage of which is a possibility to swap assets at lower slippage. At the same time, Curve’s liquidity providers can earn trading fees (0.04%), and multiply their CRV tokens by vote locking.

2. Reserve System

Reserve system is similar to AMM protocols, except the latter is entirely operated by an algorithm, while the reserve system implies a possibility of governance by some actor. For example, in Uniswap’s liquidity pools, the price is automatically set and adjusted by smart contracts. It enables them to keep liquidity more stable, but market makers are limited to manipulate the market in case of price fluctuations, which may result in so-called “impermanent loss” and high slippage in large transactions. While swapping, we might face a situation where if within the transaction deadline, the price of a token goes beyond a slippage tolerance selected, the transaction will be rejected, but a gas fee may be written off.

Kyber Network, an on-chain protocol collecting smart contracts operating atop of any blockchain, mitigates the risks by introducing Reserves. Reserves are various liquidity providers supporting ERC-20 tokens from which Kyber Network protocol aggregates liquidity. Some of Kyber’s Reserves (professional market makers) determine and control the prices based on their own rules. This fact allows Reserves to manage the risks adapting their prices to the market conditions and where necessary set relatively low slippage for large-scale deals (Kyber also provides Reserves with an automated price functionality — the same as Uniswap). To become a Reserve, a person, offering liquidity to the platform, needs to obtain approval from the Kyber’s Maintainers. Kyber Network also integrated liquidity pools from other platforms, like Uniswap, to have more liquidity for assets in high demand and offer the best rates for the trading pairs. Other participants of the exchange process are Takers (e.g., any user address, DEX, smart contract) that take the liquidity provided by the Reserves. Although there is no order book as in a traditional exchange, Kyber Network introduced a limit orders tool allowing users to determine a price at which they want to trade their assets.

3. Peer-To-Peer DEXs (Order-Matching System)

A peer-to-peer based DEX is an online platform allowing two users to handle cryptocurrency transactions with one another, directly using their crypto wallets in a trustless fashion. On DEXs implementing an order matching system, their users create orders (to buy or sell crypto assets) which are then matched with other users’ orders. We can divide order-matching DEXs into several subgroups.

a. On-Chain Atomic Swaps

Atomic swaps DEXs are initially designed to fall completely within the listed criteria of a true DEX. Atomic swaps are peer-to-peer trades made directly from one user’s personal wallet to another user’s wallet, without any kind of a mediator. The term ‘atomic’ implies that the trade either completed entirely or not at all, and both parties remain with their initial funds.

In 2018 Komodo developed the first atomic swaps, AtomicDEX, for mobile devices. AtomicDEX is a non-custodial, on-chain exchange that provides direct cross-chain trading pairs between 95% of all the coins and tokens in existence (e.g., a BTC-based cryptocurrency to an ERC-20 token). AtomicDEX collects trading fees in the amount of 0.15% paid by takers. Albeit AtomicDEX was initially launched as permissionless, the Komodo’s team has informed about forthcoming integration of KYC/AML compliance into the platform. The decision was based on changes in compliance laws and regulations in the EU and USA as well as recent legal actions against the developers associated with some crypto exchanges (e.g., BitMEX case).

Source: https://medium.com/veruscoin/verus-superior-defi-for-community-driven-liquidity-e2592b251146

Another project — the Decred DEX — being under development so far, if functions as intended, may be an outstanding example of atomic swaps DEX. The Decred DEX is a non-custodial, permissionless platform for cross-chain exchange. It implements on-chain settlement, and its simplistic matching method (an order book with market and limit orders) does not imply any intermediary coins or tokens. Notably, the Decred DEX has no trading fees, instead, the DEX provides for a one-time registration fee. It would help to exclude specific spam attacks and cover operational costs. Besides, the Decred DEX introduces a reputation system where bad actors can be identified and subsequently banned, and proof of their misbehaviour is publicly available.

b. Subatomic swaps

An original subatomic DEX on a DEXP2P network developed by Pirate Chain — ‘Shurli’ — is currently in the testing phase. It uses the core peer-to-peer principles of atomic swaps, offering several unique features. The DEXP2P based communication (which does not imply blockchain messaging) provides much faster trades and a possibility to trade in microtransactions. The subatomic DEX is supposed to allow users not only to make transactions with tokens but also to sell their files (e.g., video files) for a set price. However, even though atomic swaps are completely trustless, a subatomic DEX requires trust (because in a swap one has to send an amount and then to wait when the other does the same). In this case, a trader places trust in a specific public address with which he interacts, or he can mitigate risks by trading in small amounts. For example, if a trader wants to swap $100 for a token, he can do it by a $1 swap made 100 times, so, as Pirate suggests, “the most that is at risk at any time is $1.” However, there is no need to execute so many trades manually, as the DEX automatically performs them and checks if the other amounts were sent.

c. Off-chain matching and on-chain settlement

On DEXs of this type, an order book is off-chain. It means that away from the main blockchain, there are some platform operators (e.g., centralized order-matching nodes) that help to manage the trading process by matching and filling orders before broadcasting transactions to the network. After having matched the orders, the performed transactions are eventually recorded on-chain.

One of the widely used examples of such DEXs is 0x, an open-source protocol that has a set of smart contracts executing trades with ERC tokens on the Ethereum blockchain. Atop of the 0x protocol any crypto project can build a ‘relayer’. According to 0x docs: “A ‘relayer’ is any entity that helps traders create, find and fill 0x orders.” In this process, all orders are stored off-chain, and only settlement is completed on-chain. Being run on the single 0x protocol relayers (e.g., DDEX, Tokenlon) have a great advantage — the possibility to share liquidity pools. The 0x protocol has its own ZRX token used to pay trading fees in the relayers.

Another popular and well-developed DEX is Waves (Waves.Exchange), run onto its native Waves blockchain. Waves issued its own token ‘Waves,’ which is an essential component of this platform; users use it to pay fees and create their own tokens, which automatically get listed on the platform. To start trading, users need to transfer their external crypto assets to the Waves using the exchange’s ‘gateways.’ For instance, a user deposits Bitcoins to his personal Waves address (a multi-sig account managed by secure servers), and in return, receives Waves-based tokens (WBTC) issued on the Waves blockchain. The WBTC tokens are backed 1:1 with the Bitcoins stored in the personal user’s Waves address. Thus, on the platform’s interface, users can see only a representation of their own crypto assets expressed in Wave’s tokens. Users do not lose control of their assets, as their private keys and seed phrases belong exclusively to them. Orders are executed not peer-to-peer, but through a centralized service called a Matcher. The Matcher matches orders, signs transactions, sends them for validation, and after the validation, these transactions are written to the Waves blockchain.

On the one hand, such DEXs cannot be deemed as fully decentralized because the users do not interact directly one with another and, ultimately, they are dependent on operators to successfully facilitate the trading process. On the other hand, such transactions may be executed immediately. In comparison, on-chain swaps can be time-consuming, as a transaction can wait in the queue for confirmation several hours due to the network load. Besides, since off-chain transactions are not recorded on the blockchain, there is no transaction fee paid to miners; while on the platforms with on-chain order books run on the Ethereum ecosystem, users have to pay gas fees to place, cancel or modify their orders. And needless to say, more on-chain transactions may result in increasing gas prices.

4. Multi-Reserve Currency and Parallel Processing System

Verus has been developing a unique model of DEX (Verus DeFi). It is built on an UTXO-based blockchain and is used by participants through smart transactions (smart contracts added to the protocol). Unlike AMMs’ liquidity pools where users interact with smart contracts rather than liquidity providers, on the Verus DeFi, users and liquidity providers use the same mechanism — transactions, ‘converting to, from, or through an asset known as a ‘multi-reserve currency.’ Multi-reserve currency can be used as a reserve, a base reserve, and a liquidity pool for a token issuance or as a gas fee. At this stage, Verus set a low transaction fee at 0.025% that goes to the holders of the multi-reserve currency. At the same time, these multi-reserves constitute two distinct types of investment products:

  • a “self-rebalancing portfolio” (e.g., backed by a basket of different tokens) which automatically rebalances with every block without fees;
  • “throttled exposure” to an asset; which is used for averaging up or down assets, also being continuously done with every block without fees.

The Verus DeFi is supposed to be cross-chain by implementing decentralized bridging capabilities which would allow tokens issued on other ecosystems (e.g., ERC-20 tokens, DGB assets, RVN assets, PYRK assets, and so on) to be represented on the Verus platform.

Source: https://medium.com/veruscoin/verus-superior-defi-for-community-driven-liquidity-e2592b251146

One of the other major benefits of the Verus model is ‘simultaneous parallel processing’ of transactions. Currently, AMMs generally process transactions in sequence, i.e. one after another, within a block, giving the priority to those who paid a better gar price. Such a ‘queue-jumping’ can lead to intra-block front-running, gas price manipulation and high transaction costs. Verus offers to collect a certain number of transactions in a mempool and simultaneously submit them to a block for settlement at the same price. It may reduce the stated risks, provide more efficient use of liquidity, as well as ensure the same fair market price for all trades transacting in a block.

On the whole, the Verus DeFi’s concept sounds very promising and, if successfully realized, can become one of the leaders in the DEX industry.

To sum up, we can classify DEXs into:

  • AMM;
  • Reserve System;
  • Peer-to-peer system divided into Atomic swaps, Subatomic swaps, Off-chain matching and on-chain settlement;
  • Multi-reserve currency and parallel processing system.

These DEXs are very different in their design. Still, they are united by the incontestable advantages in terms of security (control of funds by users, prevention from hacks through the operation of servers distributed around the world), and privacy (non-disclosure of sensitive data). Hence, DEX’s users will never face the situation where an exchange suddenly suspends withdrawals from the platform as it happened on OKex on 16/10/2020. Many DEX projects have been continually working on implementing new features, upgrading their protocols, becoming less costly and more attractive to people. And indeed, some DEXs have attracted a great share of the crypto community, however, mostly as DeFi by the benefits of yield farming. As for the swapping cryptocurrencies, DEXs are still a long way away from achieving the level of functionality, ease of use, liquidity, transaction speed, scalability that the large CEXs dispose of. Also, CEXs’ customers can benefit from margin trading, advanced order types for less risky and more sophisticated trades, an extensive range of portfolio management tools, derivatives trading, etc. Some CEXs resemble entertainment platforms where users can not only trade but also improve themselves on educational portals, participate in trading tournaments along with the other users, copy trades of leading traders, take part in the prize drawing and exercise many more activities. Besides, there is a support center available to help with any kind of user’s request. DEXs do not offer that much convenience for their audience. Moreover, many of them require excellent knowledge of smart contract deployment or full node installation that may be not comprehensible for the users not vested in these matters — meanwhile, shortage of participants and postponed mass adoption of the decentralized exchanges results in poor liquidity.

So far, by strengthening security, CEXs have been increasingly adopting the hallmarks of DEXs such as non-custodial solutions; at the same time, some DEXs are being compelled to step back from their principles and be tailored to becoming more stringent legal regulations. This interpenetration may eventually lead to the creation of new hybrids driving cryptocurrency trading.

https://twitter.com/thecapital_io


CEX and Common Types of DEXs was originally published in The Capital on Medium, where people are continuing the conversation by highlighting and responding to this story.



from The Capital - Medium https://ift.tt/3o9k6bv

Post a Comment

0 Comments