How do I get started with OKX Trade?

Published on Jul 26, 2022Updated on Aug 11, 20246 min read44

1. What's OKX Trade?

OKX Trade aims to provide users with one-stop cross-chain aggregation transaction services. Through smart order routing algorithms, we'll 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 has its own smart order routing algorithm that can provide users with the most efficient, seamless, and cost-effective cross-chain experience.

2. What's cross-chain swap?

A cross-chain swap allows for the direct exchange of assets between different blockchains without the requirement for a sequential process. It employs algorithms to discover the most efficient cross-chain route in terms of both cost and time. Presently, OKX DEX is seamlessly connected with over 20 cross-chain bridges and is compatible with 16 different blockchain networks.

How does the bridge aggregator work?

It works in finding the best route for bridging Token X on Chain A to Token Y on Chain B. It finds multiple bridging routes via supported DEXes & bridges, considering any swaps that may be needed before/after bridging.

3. What's DEX?

A Decentralized Exchange (DEX) refers to a blockchain-based exchange. Unlike a centralized exchange (CEX), a DEX doesn't 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 underlying smart contracts.

Compared to CEXs, DEXs are featured with:

  • Ease of use. No email registration or identity 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 aren't 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's 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 aren't as fast and efficient as on CEXs.

  • Gas fees. Unlike on CEXs, users need to pay gas fees on DEXs.

4. What's an AMM?

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 aren't technically trading against counterparties. Instead, they're 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'll always be slippages in each transaction. However, generally, the more liquidity there's in the pool, the fewer slippages there'll 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'll 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.

5. What's 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.

Best splitting

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:

  • UniswapV2(50%)

  • Kyber (22%)

  • Sushiswap (18%)

  • 0x (10%)

Best routing

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.