1.What is OKX Trade?
OKX Trade aims to provide users with one-stop cross-chain aggregation transaction services. Through smart order routing algorithms, we will find the most efficient swapping routes and split trading amounts across multiple routes in a single transaction to help users buy or sell at the best available price.
Currently, OKX Trade is built on 1inch, an aggregation protocol on the Ethereum blockchain. It is expected to have its own smart order routing algorithm soon to provide users with the most efficient, seamless, and cost-effective cross-chain experience.
2.What is a DEX?
A Decentralized Exchange (DEX) refers to a blockchain-based exchange. Unlike a centralized exchange (CEX), a DEX does not store users' funds or personal data on a centralized server but instead performs on-chain activities including asset custody, orders matching, and clearing thoroughly through the underlying smart contracts.
Compared to CEXs, DEXs are featured with:
- Ease of use. No email registration or KYC verification is required. Users only need to connect to a wallet to access a DEX.
- Complete control over assets. In CEXs, users have to deposit crypto on the platform before trading, thus giving away control over their assets. By contrast, DEXs don't offer asset custody services and therefore can't have control over or access to users' funds.
- Diversification. Various tokens that are not listed on CEXs are available on DEXs.
- Limited speed. In CEXs, transaction data is off-chain, so a transaction can be instantly completed if there is a matching order. DEXs, however, are fully backed by blockchain, which means that every order or state change will be recorded as a transaction on the chain. Therefore, transactions on DEXs are not as fast and efficient as on CEXs.
- Gas fees. Unlike on CEXs, users need to pay gas fees on DEXs.
An Automated Market Maker (AMM) is a decentralized exchange protocol that relies on algorithmic trading to provide liquidity to specific markets. Liquidity Providers (LP) provide liquidity to the trading market; the price function is used to set the price for each trade, while traders interact directly with smart contracts to complete crypto transactions.
How does an Automated Market Maker (AMM) work?
DEXs replace order books, order matching systems, and institutional market makers with protocols called AMM and smart contracts to create liquidity pools and define the price of assets according to mathematical equations.
In DEXs, users are not technically trading against counterparties. Instead, they are trading against the liquidity locked inside smart contracts.
A smart contract pairs the crypto received from a user with another token and swaps using preset mathematical equations. For example, Uniswap uses a simple x*y= k equation to set the relationship between the particular assets held in the liquidity pools. Here, x and y represent the amount of the tokens respectively, while k is a constant.
Note that Uniswap's x*y= k is just one of the mathematical formulas used by AMMs today. The equation varies with the use case.
As a result of how AMMs work, there will always be slippages in each transaction. However, generally, the more liquidity there is in the pool, the fewer slippages there will be.
What are liquidity pools?
Liquidity pools are pools of tokens locked in smart contracts used for market making. Liquidity pools allow users to seamlessly swap between tokens on-chain in a completely decentralized and non-custodial manner.
In a typical DEX, there will be many liquidity pools, in each of which two crypto assets are pooled together to create a trading pair.
The great thing about AMMs is that anyone can become a market maker and earn a passive income by simply staking crypto. To become a market maker or a liquidity provider in an AMM, a user needs to deposit an equivalent value of two tokens in the corresponding pool - for example, $150 worth of ETH and $150 worth of USDC in the USDC/ETH pool.
4.What is a DEX Aggregator?
As a trading aggregation protocol based on blockchain, DEX aggregators source liquidity from different DEXs, automatically find the best trading route, and split trading amounts across multiple routes in a single transaction, thus offering users better token swap rates than they could get on any single DEX.
DEX aggregators connect to most major DEXs, such as Uniswap, Kyber, Curve, and 0x. For example, when a user trades ETH for DAI, a DEX aggregator compares the rates available across all decentralized exchanges, applies the smart order routing algorithms to find the best rate and splits orders across multiple DEXs.
Splitting orders is particularly effective for large transactions. For example, to trade $500 worth of ETH for DAI, the order is routed across four pools:
- Kyber (22%)
- Sushiswap (18%)
- 0x (10%)
Smart order routing algorithms scan for all possible execution opportunities. For example, if you want to trade sUSD for ETH, a direct sUSD -> ETH swap might not be the best option. In this case, it requires an sUSD -> USDT/DAI swap and then a USDT/DAI -> ETH swap to get the best rates. DEX aggregators will calculate all the possibilities and complete the swaps in one step for users.
Through ever-improving order-split routing algorithms, DEX aggregators can interact with multiple services and smart contracts while saving gas fees, mitigating slippages, thus offering users the best rates.