Understanding DEX’s

& Why CEX is not always good.

TLDR;
- There are three models of Exchanges; Orderbook, Smart-Contract Reserves, & Dutch Auction.
- Each exchange model has its own tradeoffs.
- CEX is great but DEX’s is better

Exchanges are an extremely lucrative business model with tremendous impacts on the world’s economies. They are constantly innovating, improving & changing how the financial world works. Keeping up with them is difficult; but rather than becoming lost in the forest of individual exchanges; we can grasp their underlying mechanisms & then understand how they all work.

Source: Adobe/Siarhei

Since the advent of Bitcoin, large-name DLT cryptocurrencies have been able to prove their resilience against coordinated attacks from hackers, botnets & even government bans. However, the venues on which they trade continuously succumb to hacks, loss of funds, technical inaptitude & rigorous (invasive) compliance; which in turn feeds into the global markets suffering from suppressed price realization.

Centralized exchanges have dominated the crypto-trading landscape for the last 7+ years. Being the anti-thesis to the inherent decentralization of cryptocurrency, it comes as no surprise the industry began to innovate & found a solution to displace centralized exchanges.

Hello, Decentralized Exchanges.

What sets apart a CEX (centralized exchange) from a DEX (decentralized exchange) are the two following quintessential properties; custody of keys & distribution of the hardware that runs the software.

Centralized exchanges operate as custodians & require users to deposit their funds into a single server. This means that the private keys of those assets are owned by the exchange & the exchange is responsible for the hardware that runs the exchange software.

On the other hand, Decentralized exchanges must be non-custodial meaning that users keep their private keys; and good decentralized exchanges should be adequately distributed, running on hardware all over the world, hopefully by a large group of independent, self-interested participants.

Both of the exchange types serve the same purpose; to be a place to trade assets. And Both of the Exchange types have share the 3 exchange/market-making models that allow trade to take place.

The oldest & most popular market-making model is known as an Orderbook model. As the name suggests, the markets are created by having orders for buying & orders for selling at certain price points & visually layering those orders as a book. Whenever there are new orders that go into the book that match existing orders the trade happens.

While this model has served capitalism & global finance well so far, cracks in it begin to show. Orderbook models, especially ones that are centralized, are extremely subjected to manipulation; most commonly to front running.

***Front running is the immoral & illegal practice where the entity looking at orderbooks can see what the demand from both sides is & place their order from both sides. Front running is better understood through this intuitive example; Exchange ABC hosts the orderbook. Sally places a buy order for Bitcoin at $100,000; Bob places a sell order for Bitcoin at $99,900. Exchange ABC knows their orders & can delay publishing Sally’s order to buy Bob’s Bitcoin & resell it to Sally before other market participants get the chance. They are in essence profiting $100 completely risk-free.

The newer, more experimental & extremely promising exchange model is the smart contract reserve model; also know as known as AMM — Automated Market Making. The AMM model works by pooling assets from both sides of a trade into a smart contract reserve. The reserve then prices the trade according to the outstanding amount of the assets against each other.

*** There are three prominent projects that are using this model right now, those are UniSwap, SushuSwap, & Bancor. The concept is very intuitive, lets use an example with two popular digital assets, Ethereum(ETH) & ChainLink(LINK). Sally Deposits 10 eth into an ETH/LINK UniSwap contract & Bob deposits 100Link into that same contract. Now the Contract provides a trade possibility of 1eth-10link. This is exciting becuase the smart contract is unaware of the underlying asset prices elsewhere. If ETH is trading at $5,000 & LINK is trading at $50 then there is a massive arbitrage opportunity here becuase the market value of ETH/LINK is 1:100 & somebody can go buy 100 LINK for 1 ETH, turn around to the smart contract & trade those 100LINK for 10ETH. Boom baby 10x logic…. *Disclaimer — this is extremly over simplified.

Another very old model that gets less attention these days is the Dutch Auction. The Dutch auction is slightly more complex as it works by batching orders so that the participants all end up paying an equally fair price for their portion of a trade.

*** The single most poriment project that is spearheading this model is Gnosis. The concept here is a little more intellectually demanding. Users only pay once an auction is completed & they only pay the final clearing price. Meaning that users are incentivized to place higher bids in order to secure their positions. Once an auction closes, the payouts are also done in proportion to the bids; so if 3 people are participating in an auction for 100,000 token - person1 bids $100; person2 bids $200; Person three Bids $300 making the pools total $600. Once the auction finalizes the participants will recieve their proptional amount of tokens as dictaed by their investment; so
person1 gets 1/6 (16.67%) — 16,667 tokens
person2 gets 2/6 (33.33%) — 33,333 tokens
person3 gets 3/6 (50%) - 50,000 tokens

But, in order to truly qualify as a DEX, These two prominent models still require that magical touch of decentralization. How this decentralization is achieved in the world of crypto & blockchain is through ON-chain validation.

Right now, the Orderbook model-based & Dutch Auction model-based exchanges facilitate trading through one of two ways; fully on-chain & partially off-chain.

Fully On-Chain.
Fully On-Chain means that all of the data associated with conducting a trade is processed step-by-step by the network. The order are placed & stored on-chain; they require private keys & gas fees to take down, the orders are executed on-chain & the orders are settled on-chain.

This approach provides the highest level of decentralization & security for the users as they never have to give over custody of the assets/private keys. However, this approach is also extremely costly in terms of network gas fees, slow & typically not super liquid.

Partially Off-Chain.
The partially on-chain model moves some/ if not all of the computation associated with executing a trade off-chain & publishes proofs to the blockchain after trades happen. A lot of reputable leading projects are employing this approach, most notably ZRX (0X), LoopRing (LRC) & Injective Protocol (INJ). These projects provide low entropy networks that run in parallel to the blockchain. They do all the heavy computation on that network & only publish the results on-chain.

This hybrid approach provides slightly lower certainty in terms of trade clarity; however, it satisfies decentralization demands with lowers costs dramatically & increasing throughput while remaining non-custodial.

On the other side of the model spectrum, the SmartContractReserve model-based exchanges are by default fully on-chain. This translates to typically very high costs for tradings, but that is the price to pay that gives enormous arbitrage opportunities.

There is another burgeoning technical revelation model for the provision of trade; the less talked about Atomic Swaps. Atomic swaps are already being utilizing by some narrow audiences, but they are still in the phase of gaining momentum & proving their trustless cross-chain capabilities at scale.

Hope this was able to disambiguate & shine some light on Exchange models as a whole. Thank you for reading & I hope to see us all blossom.

Andrey Didovskiy logo
Subscribe to Andrey Didovskiy and never miss a post.
#defi#dex#trading#exchange
  • Loading comments...