All You Need To Know About Decentralized Exchange📈

·

5 min read

What-is-a-Decentralised-Exchange-1-800x533.png In this article I'm going to explain what decentralized exchange is (DEX), how it works, and how it differs from centralized exchange (CEX).

What is Decentralized Exchange?

Decentralized exchange, also known as DEX, is a peer-to-peer marketplace where cryptocurrency traders make transactions directly without handing over management of their funds to an intermediary. DEX sets to replace traditional banks, brokers, payment processors, or other institutions with the blockchain network (more on that later).

How does it work?

The large-scale trading of crypto assets between many users is entirely through automated market maker, instead of the conventional approach of acting as financial intermediary between buyers and sellers. The smart contract creates this algorithm that these DEXs use. They are pieces of code written on top of blockchain networks. So in order for you to understand how this exchange works on a blockchain network, let me go over what automated market maker is.

Automated Market Maker

An automated market maker (AMM) system that relies on smart contracts was created to solve the liquidity problem (more on that later). The creation of these exchanges partly came from inspiration originating from Ethereum co-founder Vitalik Buterin’s paper on decentralized exchanges, describing how to execute trades on the blockchain using contracts holding tokens. AMM users supply liquidity pools with crypto tokens, whose prices are determined by a constant mathematical formula

Constant Mathematical Formula

Also known as constant product formula, is one that does not change based on the size of the trade or asset that a user is trading. Most of these DEXs contain the algorithm used for this constant product market maker model.

lp-constant-product.png

The formula requires that the total amount of liquidity remains constant. That’s the K in the formula. X and Y represent the two tokens being invested in the liquidity pool. The value of those two tokens must always be K. So as the value of Y increases, the value of X must decrease, and vice versa.

If all that didn't make sense, please watch this video here. It explains AMM in a very detailed matter and provides well explained examples.

Liquidity Pool - a crowdsourced pool of cryptocurrencies or tokens locked in a smart contract that is used to facilitate trades between the assets on a decentralized exchange (DEX).
Liquidity - how easily one asset can be converted into another asset without affecting its market price.

Centralized Exchange (CEX) vs Decentralized Exchange (DEX)

You could probably guess already what these differences are, but I'll go over it in case you don't already. The major differences are custody, security, and the method of trade.

Before I explain the differences are let me explain what centralized exchange is. Centralized exchanges (CEX) such as Binance or Coinbase, popular finance companies, are considered centralized because one company oversees all the transactions and sets the exchange's rules and fees.

DEX - Self custody
This is the best thing! Since a DEX does not exist as a central entity, there is no platform to put funds into, which instead, you simply connect the DEX to your existing wallet, using your own private keys to manage your funds.

Private keys - a secure code that enables the holder to make cryptocurrency transactions and prove ownership of their holdings.

CEX - Not self custody
You have to place your assets in the custody of the exchange before you start trading. Essentially they have full control over your assets. However, this allows you to have a better security since your coins will never be controlled by anyone but you. Whereas in DEX you are solely responsible for your own security by not allowing your private keys to be exposed.

DEX & CEX - Security
When a centralized exchange company gets hacked or phished, or even goes out of business, your coins will be gone. However, in decentralized exchange there is no middle man, so therefore you all these issues like hacking or getting phished is not possible unless you share your private keys. But that also comes with having to take full responsibility.

DEX - Trading Method
Decentralized exchange trading uses peer-to-peer order matching algorithms. Whereas Centralized exchange trading uses a centralized exchange order matching engine to match buy & sell orders.

This is based off of the traditional order book model, which traditional finance exchanges have used for centuries. Early decentralized exchanges had used that same concept but when Uniswap launched in 2018, it became the first decentralized platform to successfully utilize an automated market maker (AMM) system. After its success, many other DEX cryptos had forked its concept - notably Sushi, Balancer, Curve Finance, and many other DEX finance.

Forked - A fork is a copy of a repository. Forking a repository allows you to freely experiment with changes without affecting the original project.

Note: Most commonly, forks are used to either propose changes to someone else's project or to use someone else's project as a starting point for your own idea.

Conclusion

Okay, so I only scratched the surface of what decentralized exchange is and I also gotta mention that I'm no expert in this industry and I'm still learning. Reason why I posted this blog was to help build an understanding of the DeFi space and hopefully help me or you engage with individuals who have the same kind of goal that they want to achieve.
If you want to learn more about decentralized exchange. Please click here, it is a blog post from Chainlink that goes over pretty much everything that you need. I also highly recommend you watch Whiteboard Crypto videos, he provides crypto education in which I had learnt a lot from him.

Â