A decentralized exchange (DEX) uses smart contracts to enable cryptocurrency traders to execute trades without an intermediary.
after reading this, you'll understand:
Decentralized exchanges place control and responsibility on the users by letting them trade directly from their wallets through smart contracts.
There are three types of DEX: automated market maker, order book, and DEX aggregator.
If you don’t understand how wallets and wallet extensions work, you could easily lose money in a DEX.
A decentralized exchange (DEX) uses smart contracts to enable cryptocurrency traders to execute trades without an intermediary. Close to 1,000 DEXs draw nearly 200 million visits a month, according to industry tracker CoinGecko, and these peer-to-peer networks have a market cap of around $17.3 billion.
Many users prefer decentralized exchanges over centralized exchanges due to their enhanced privacy. For example, traders on a DEX don't need to make any personal information public. They maintain control of their private keys (an encryption tool) and their cryptocurrency funds.
Centralized exchanges, like Coinbase and Binance, are more regulated and tend to make it easier for new cryptocurrency traders to use. Some centralized exchanges insure their users’ funds and provide surveillance services that make it easy to move funds. Still, many people don’t like handing their funds over to a custodial, third party.
Decentralized exchanges shift control and responsibility to the users. DEXs are non-custodial and let parties trade directly from their wallets through smart contracts. With decentralization, users are responsible for their funds and passphrases. DEXs typically form a distributed governance structure — a decentralized autonomous organization (DAO), made up of stakeholders.
An automated market maker (AMM) uses smart contract technology to fulfill orders and track the price of digital assets. Instead of matching buyers and sellers, AMMs use community-funded liquidity pools to execute buy and sell orders.
Liquidity pools are made up of two different tokens. When someone buys or sells a token using a liquidity pool, it shifts the ratio of the tokens in the pool and alters the price of the pool’s tokens. For example, if a liquidity pool contains 100 units of token A and 200 units of token B, that means 1 unit of token A is worth 2 units of token B. If someone buys 50 units of token B using 25 units of token A, the pool’s ratio shifts. Now the pool contains 125 units of token A and 150 units of token B, meaning 1 unit of token A is worth 1.2 units of token B.
With numerous automated market makers using their own liquidity pools, an asset’s price is rarely the same on every exchange. Arbitrageurs attempt to buy assets from exchanges with lower prices and sell the tokens into pools with higher prices, averaging the price between the two pools.
Order books share similarities with centralized exchanges. These exchanges enable traders to place buy orders at the price they’re willing to pay for a specific digital asset and sell orders at the price they’re willing to sell the asset. The order book compiles these offers and matches buyers and sellers to fulfill trades. On-chain order books allow traders to buy and sell digital assets without taking custody of their tokens. In many cases, traders can leverage their trades to increase their profit potential, although this also increases their loss potential.
DEX aggregators are comparable to a decentralized exchange search engine, as they aggregate decentralized exchanges, eliminating the need to manually find the best price for a token. These platforms use various protocols to aggregate liquidity from multiple DEXs, enabling them to minimize slippage on large orders, lower trading fees, and offer optimal token prices.
There are hundreds of DEX platforms encompassing nearly every major blockchain. They have become an important part of peer-to-peer, decentralized finance. Still, some are more popular than others. Choosing a popular exchange is ideal because they typically have larger liquidity pools for trading assets and generally have proven to be trustworthy and secure over time.
UniSwap. UniSwap is the largest DEX. It operates on the Ethereum blockchain and many other chains and has been a long-running favorite. It keeps customer funds secure because there is no centralized intermediary to hack and doesn’t charge listing fees for new tokens.
Curve Finance. Curve is a popular decentralized cryptocurrency exchange for trading stablecoins and other assets. Like UniSwap, it can function on a wide range of chains.
SaucerSwap. This was the first decentralized exchange to launch on the Hedera network. SaucerSwap offers a full range of DeFi services, including token swaps, staking to liquidity pools, yield farming and single-sided staking.
HeliSwap. This platform is the first DEX on the Hedera network supporting swaps between HTS, ERC20s and HBAR. HeliSwap is open-sourced, completely trustless and permissionless, and offers customized liquidity mining, liquidity pool bootstrapping with price discovery and the power to create your own yield farms.
A private key acts as a sort of secret digital signature, represented by a long string of numbers and letters used in cryptography, similar to a password. In cryptocurrency, private keys can be associated with a public key or address, which anyone can see. The public key encrypts a message that can be read only by someone with the private key.
On non-custodial DEX transactions, traders can use a private key that can both encrypt messages to send them and decrypt messages to read them. Private keys are used to sign transactions and prove ownership of a blockchain address.
Most DEXs charge fees for every transaction, regardless of whether a user is buying or selling. DEXs that use community-funded liquidity pools often reward liquidity providers with a portion of the fee revenue. DEXs tend to have lower transaction fees than their centralized counterparts, although the fees vary depending on the blockchain. In general, Proof-of-Stake blockchains charge lower fees than those using Proof-of-Work, the consensus mechanism that requires miners to compete for the rights to verify transactions.
To interact with a DEX, users need crypto wallets to send and receive information to the network. The wallets also serve as anonymous identifiers and can store cryptocurrency. Anyone can read a public distributed ledger, but no one can transact on a distributed ledger without a wallet.
Wallet extensions are an innovation that can make it easier to trade on DEXs and use dApps to improve the user interface. Many wallet extensions enable users to store NFTs. Users can link their blockchain account to a wallet extension to use their funds without giving the application custody of their assets. MetaMask is a popular Chrome extension for managing assets on the Ethereum blockchain and signing application transactions. HashPack is a popular wallet app powered by Hedera. It provides integration of Hedera dApps, token swaps, DEX trading, hardware wallets and more.
DEXs are primarily used by retail users who understand how to use cryptocurrency wallets and understand the nuances of DeFi. It’s important that users keep their private keys secure and don’t interact with potentially malicious decentralized exchanges.
Cryptocurrency wallets must be funded with tokens that exist on the same blockchain as the decentralized exchange application in which they’re engaging, or funds can be lost forever. For example, if a user tries to fund their Ethereum account by sending a Binance Smart Chain token to their Ethereum address, the funds will be lost forever. Most DEXs require that both the assets and the accounts they’re using exist on the same network.
Slippage tolerances have to be manually adjusted on most DEXs, and if done improperly, the price of funds used in trading can fluctuate wildly, resulting in loss. Also, adding to liquidity pools on a DEX can result in impermanent loss and allow for users to be susceptible to rugpulls, as their assets are locked in an account used for liquidity purposes.
DEXs offer many types of tokens to trade since assets don’t have to be individually vetted by a centralized authority. Additionally, they offer enhanced automation, anonymity and privacy compared to centralized exchanges. This may change over time as regulation matures, requiring users to identify themselves to the exchange and participate in proper reporting for tax and anti-money laundering purposes.
Additionally, users retain custody of their funds in an account for which only they hold the key. Therefore, they’re less susceptible to a centralized exchange freezing their accounts, preventing withdrawal, or outright taking their funds if they become insolvent.
Decentralized exchanges are at the core of the cryptocurrency ecosystem. The inherent privacy and security associated with DEXs make them an attractive option for many cryptocurrency traders and retail users looking to earn rewards on their assets by creating liquidity.
The Hedera network offers predictable fees, scalability with 10,000 TPS, and quick transaction settlement, making it ideal for DEXs. Additionally, thanks to the fairness that Hashgraph Consensus brings to the ordering of transactions, DEXs powered by Hedera aren’t susceptible to front-running by bots — a multi-billion dollar issue facing DEXs on alternative blockchain networks.