Decentralized Exchange (DEX) is a structure that is most commonly used with cryptocurrency. This contrast with centralized exchanges (CEX) which are centralized and are associated with a company.
Most exchanges that people use are centralized. In the world of finance, commodities, stocks, and bonds are all traded in this manner. Even within cryptocurrency, the majority of transactions are done on CEX as opposed to DEX.
How They Work
A DEX is a peer-to-peer (P2P) exchange that allows users to trade cryptocurrency without the use of an intermediary. This means there is no custodian of the funds, giving the use full ownership. It also removes counterparty risk since the private key is retained by the individual. This is in adhere to not your keys, not your crypto.
Buyers and sellers are linked up through the DEX. This is done through the use of smart contracts. They tend to be built upon blockchains with the best smart contract platforms.
When submitting a trade, the individual is effectively offering an "IOU". The coins or tokens are still in the wallet but the trade is ready to go through. Once there is a willing participant on the other end, this is completed.
There are different kinds of DEX and some using automated market makers, similar to the service provided by companies that run exchanges.
An advantage to DEX is they do not require any information. A true DEX cannot adhere to KYC or AML rules. Centralized exchanges are required by governments to collect the data on those who have accounts. This is necessary if an exchange wants to operate within those jurisdictions or garner business from its citizens.
It is easy to see how DEX can offer greater privacy to its customers. This can be an issue with regulators which is why the platform requires total decentralization. DEX are often open source software which means they can be forked.
DEX are structured in such a way that compliance with regulation is impossible.
Instead of building a company, which owns the exchange, DEX are designed around a protocol. The most famous, and popular, is Uniswap. This is the largest DEX by volume and was also forked a number of times.
Decentralized Finance (DeFi)
Decentralized Finance (DeFi) holds great promise in creating a financial system that veers away from Wall Street control. The banks are immersed at the center of that system, extracting enormous sums of money for the financial services provided. DeFi can offer an alternative.
DEX are at the core of this idea. Swapping one asset for another is a fundamental premise of any financial system. The ability to trade is interwoven into any economy. As the scale of the economy grows, the trades become more complex. This means that operating globally entails billions of trades daily.
The root of this is the trading of goods and services. Finance is the mechanism that often allows this to happen. Funding is required along with settlement. Centuries of development established the institutions and infrastructure to facilitate this.
Decentralized system are, according to many, the next step in this evolution. The DEX is the centerpiece for decentralized finance since people need to be able to move from one asset to another.
Cryptocurrency, though blockchain and associated wallet system, gave people control over the currency. This is enhanced when people are then able to use decentralized applications for other financial services.
A DEX offers limited counterparty risk. Basically, the code is what provides the security. There are vulnerabilities associated with smart contracts. Hacks can take place which do present a degree of vulnerability.
The term limited applies since it is reduced as compared to CEX. There was a lesson presented in 2022 with the implosion of platforms such as Celsius and FTX. The latter was one of the larger exchanges that went bankrupt. It also reaffirmed the not your keys, not your crypto.
Finance comes down to a matter of trust. A lot was put in place to try and establish trust among the public. One method used is regulation. The idea is that entities are safe due to the oversight provided by government agencies. This has not always translated into practice.
The future of CEX for most cryptocurrency transactions is bring brought into question. They do offer people ease of use which attracts a lot of people. In the end, each individual has to weigh the pros and cons.
Types of DEX
There are a number of types of DEX. They all seek to address liquidity issues although do it in different ways.
Automated Market Maker
Automated Market Makers (AMM) use liquidity pools to offer trading services. This taps into pre-funded pools, accessing liquidity when needed.
They also use blockchain oracles which garners pricing from other exchanges and feeds. A DEX using AMM doesn't match buyer and seller directly. When one shows up, the associated coin or token is removed from the liquidity pool.
Those who fill the liquidity pools are entitled to the transaction fees associated with the activity relating to the pool. This is how they earn a return (or interest) on having their money in the LP. It can be a profitable tactic but is not without risk.
Coins or tokens in a liquidity pool are locked in. Thus, any price movement down could result in an impermanent loss. If the individual decides to exit this pool when in this state, the loss becomes realized. This might not be offset by the feeds garnered.
Pools that have a stablecoin as one of the pairs tend to suffer the least impermanent loss since the volatility is only on one side of the equation.
This is a type of DEX that mirrors a centralized exchange.
Under this type of operation, all buy and sell orders are recorded by the DEX. These are lined up seeking to match buyer with seller. As orders come in, a depth chart will result. The spread between bid and ask is established.
Trades occur when both sides meet. When an individual decides to meet an existing order, the transaction occurs.
Like with all trades slippage can occur especially with assets that lack a great deal of trading volume. If there is a large spread, market orders will fill at a price far different than one could flip it form.
These solve the problem of liquidity by aggregating different protocols, especially on larger orders. They can pull from both DEX and CEX in an effort to fill orders.
The goal here is minimize slippage by accessing prices, fees, and liquidity on a degree larger than employed by other DEX.
DEX aggregators also reduces the number of failed transactions due to the fact many sources are being accessed.
Examples of DEX
Exchanges such as these are accessed using wallets such as Metamask.