Minima
Published in

Minima

CEX, DEX, and P2P Exchanges

If there is only one cryptocurrency in the future, there won’t be a need for exchanges anymore. These days, we’re very far away from that, with tracking websites like Coinmarketcap listing over 15,000 different cryptocurrencies. Some traders make a living just by trading between tokens, and anyone who has ever bought into something and then saw another coin “moon” will know the urge of wanting to jump onto that one.

The prime venue to do that for crypto traders are exchanges. We can differentiate between three types of exchanges: Centralized exchanges, peer-to-peer exchanges, and decentralized exchanges.

Centralized Exchange (CEX)

Centralized exchanges were among the first to offer crypto enthusiasts ways to trade between currencies. They are also usually the place where newbies go to buy their first crypto with fiat money.

Centralized exchanges work similarly to brokers and exchanges in traditional finance. They host a central orderbook that brings buyers and sellers together. If you buy on a centralized exchange, you put your order into the orderbook and wait for it to match with a sell order by the matching engine. At times, your orders will be filled because another individual trader had a matching sell order, other times, it’ll be done by market makers providing liquidity.

As centralized exchanges run all trades through their own tech stack, they can facilitate trades across token standards and blockchains,

The advantages of centralized exchanges include providing customer support, ideally an intuitive user experience, and liquidity. Additionally, they support buying and selling crypto with fiat money.

The main disadvantage of centralized exchanges is in giving up custody of your private keys (meaning you’re not in control of your crypto). These exchanges are not available in all countries, can charge high fees, and sometimes get hacked.

So far, centralized exchanges continue being the top platforms in terms of trading volume, with Binance, Coinbase, and others often leading the rankings.

Peer-to-Peer exchanges (P2P) are an option for those living in countries not served by centralized exchanges, or who have a hard time converting crypto to their local currency.

P2P Exchanges

As the name suggests, these exchanges facilitate trades directly between peers. Technically, if you started buying, and selling crypto with your friends you could call it a P2P exchange. Bonafide P2P exchanges take this a step further by facilitating trades between individuals who don’t know each other and aren’t even necessarily in the same country. They are basically the eBay of crypto, where buyers and sellers come together. Instead of matching in an order book, buyers and sellers can communicate with each other, to arrange trades.

Most P2P exchanges include an escrow service that locks up buyer and sellers funds and only releases them once both parties have agreed that the conditions of the trade are fulfilled. Regardless, scams still happen on these exchanges, despite providers’ best efforts to reduce them by introducing rankings, or review systems.

Overall, P2P exchanges can be attractive to those willing to invest time in vetting counterparties, and when local currencies aren’t widely supported on other platforms. Renowned P2P exchanges include Paxful, LocalBitcoins, and HODLHODL, amongst others

Lastly, the exchange type that has seen tremendous growth in the last few years are decentralized exchanges (DEX).

Decentralized Exchange (DEX)

At the height of DEX activity, DEX volume was nearly 20% of CEX volume. DEX volumes have since fallen back but seem to recover. But how exactly do DEXs work?

In a sense, DEXs are similar to P2P exchanges because they facilitate trading without intermediaries. When using a DEX, traders keep custody of their coins at all times.

On-chain vs Off-chain orderbook

DEXs are built entirely on smart contracts, which automatically execute and facilitate trading. There are broadly three approaches to DEXs. They can either host their orderbooks ‘On-chain’ or ‘Off-chain’.

On-chain orderbook: this means that every transaction is recorded on the blockchain — this includes the actual purchase, requests to buy, and every time a trader cancels an order. While highly transparent, hosting every activity on-chain makes these DEXs more expensive and potentially slow (depending on the underlying blockchain).

Off-chain orderbook: to circumvent the problems with hosting the entire orderbook On-chain, other DEXs have chosen only to settle final transactions On-chain. That means your request to buy is handled Off-chain, and only once matched with a seller the final transfer occurs. While faster and less expensive, this type of structure hosts similar security concerns as centralized exchanges due to handling certain activities Off-chain and in a more centralized manner.

The third and most common approach to hosting a DEX is by relying not on order matching but algorithms.

Automated Market Maker (AMM)

If you’ve recently traded on Uniswap, Curve, or any other popular DEX, you have already interacted with an Automated Market Maker (AMM). Instead of matching orders by peers, recent DEXs take out the counterparty risk by letting traders trade directly with Liquidity Pools facilitated by an AMM.

AMMs have become the primary way to trade tokens in DeFi. They set the price for a trade based on the supply of tokens in the DEXs liquidity pool. Liquidity pools are simply holdings of traders who have decided to provide their funds to a DEX to earn a percentage of the trading fee and potentially the DEX’s governance token. Traders providing liquidity to DEXs are also called “Liquidity Providers”.

For any DEX, attracting sufficient liquidity at the beginning is crucial to facilitate a smooth trading experience — this has given rise to Vampire attacks, where a protocol will fork an existing DEX and offer more attractive incentives to Liquidity Providers to lure them away.

When buying ETH for WBTC on a DEX, you will connect your wallet directly to the DEX, enter your order, and then the AMM will provide you with a price and facilitate the transaction. At times, there might not be a pool directly to let you trade the pair you want to. In these cases, a DEX might conduct several swaps in the back-end to still fill your order.

Overall, DEXs are more private than CEXs and permissionless. Anyone with a wallet can access the underlying protocol. They are immune to hacks, and if they are truly decentralized, will never experience any downtime. However, they don’t support fiat trades and only work for one ecosystem. Without using bridges or wrapping tokens, you won’t be able to trade from Ethereum to Bitcoin or across other native chains.

Ultimately, which exchange one chooses will come down to one’s intentions. If you want to buy crypto with fiat, a CEX or P2P exchange will make it happen. Suppose you want to trade between different tokens on the same blockchain, and don’t want to give up custody, then a DEX is for you.

Recently, we’ve experienced an AWS outage that took down a DEX. This might have taken some traders by surprise, but when doing your research you will find that quite a lot of DeFi infrastructure is currently still run on centralized cloud providers.

At Minima we believe that DeFi will only be truly decentralized when we stop relying on any big cloud provider and start putting the power back into the hands of the people.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store