Without central entities, crypto trades would be overly complex and inefficient. In fact, entral marketplaces have facilitated the broad adoption of crypto, which has also solved the problem of low liquidity and made it easier to agree on correct token prices.
However, the involvement of third parties can be considered antithetical to the very purpose of crypto — decentralization and digital ownership. That is where decentralized exchanges (dexs) come into play.
The rapid development of crypto technologies has in turn enabled the development of platforms that allow two anonymous wallets to trade directly with each other, without third parties involved. This lesson will teach you what the dexs are and how they work.
Read the following lessons for more crypto knowledge:
What is a dex?
A dex is an exchange or a platform functions similarly to a traditional exchange (in terms of the purchase and sale of tokens) but unlike a traditional exchange, it is built atop a blockchain (distributed ledger) and does everything automatically and in a permissionless manner. With a dex, only you have custody of the tokens, so you don’t have to entrust the exchange with them like you would with a centralized exchanges (cex).
Your first foray into crypto trading most likely involved creating an account by filling in your personal details, generating a password, verifying the account and KYC, depositing tokens from your bank account and finally, starting to trade.
With a dex, the process is more straightforward and allows you to maintain anonymity. All you have to do is connect to the dex with your wallet (like a metamask). This means your tokens remain in your wallet instead of being held by the dex. Only when you start an activity, like buying a token, will your wallet extension pop up to get you to sign off on the transaction.
Using dexs means using the actual blockchain, which is not the case with cexs, which do not allow you to own the tokens’ private keys. You can trade and use other products cexs provide but these transactions do not occur ‘on-chain’, as these exchanges use their own databases.
Still, you can withdraw tokens from an exchange to your personal wallet, whereupon you will have ownership of the tokens. A rule to remember in crypto is “not your keys, not your coins”.
How do dexs work?
We know that dexs execute traders’ orders on-chain and enable traders to maintain custody of their tokens. We’ll now dive a little deeper to understand the unique technologies behind dexs.
1. Automated market makers
You may already know that cexs use order books to connect buyers with sellers. Dexs can’t do the same because order books require centralized parties and technologies to function. Instead, dexs use automated market makers (AMMs), which are protocols that automate and govern the process of liquidity provision.
AMMs don’t require counter-parties to execute trades because such trades occur through a pool of different paired tokens. AMMs execute them against the liquidity in the liquidity pool, so if you want to buy a token, you do not need a counter-party from the seller’s side. Rather, you need enough liquidity in the pool.
If AMM is the software code, it still requires assets to locate from one party to another. The answer lies in liquidity pools:
2. Liquidity pools
A liquidity pool is a smart contract held within a crowd-sourced pool of different paired tokens. Crowd-sourcing means that all tokens in a liquidity pool come from different liquidity providers (LPs) in the crypto community.
LPs stake their assets in liquidity pools because of the incentives. For example, they can earn attractive rewards, such as LP tokens, or trading fees from staking assets in liquidity pools.