Smart Order Routing

From smart order routing to aggregator.

The aggregator is part of the future Zenlink DEX Network, and the Zenlink team will start with smart order routing to complete it step by step, so let's first learn what Zenlink smart order routing is.

Smart Order Routing Overview

In order to help users find the best trading path and bring users the best trading experience, Zenlink built Smart Order Routing. With this Smart Order Routing function, Zenlink can aggregate all liquidity on parachains connected to Zenlink DEX Protocol, becoming an one-stop-shop that aggregates the optimal token price across parachains “market depth”, whether mainstream trading pairs or long-tailed trading pairs.

Smart Order Routing Strategy

Zenlink smart order routing adopts a new routing algorithm, which can effectively make use of many “market depths” in the same protocol and obtain the optimal transaction price by optimizing the transaction path for users in real time. According to the current scenario design, when a user plans to make a transaction, the execution strategy is rough as follows:

Step 1: user enters the tokens and the amount of tokens they plan to buy (sell), and the DEX front end begins to simulate smart order routing transactions in the Zenlink DEX liquidity pool (Pool) of all parachains. The routing will filter out the feasible solution of the transaction through “depth” priority search in all pAfterools in a single chain and prioritize the transaction path to get the optimal solution.

Step 2: After the simulated routing transaction of all chains, a set of optimal solutions of each parachain will be obtained and the chains in which the first N optimal solutions are listed in order will be used as the input parameters of the Split Trade.

Step 3: After obtaining the N chains that specifically execute the split trade, the route will be split for the first time, and the first split will allocate more transaction share to the more optimal price chain in the above-simulated routing transaction. After the share is allocated, the route calculation will get the solution after the first split. Compared with the simulated optimal solution obtained before the split, the better chain after price fluctuation will get more transaction share allocation in the next split.

Step 4: continue to carry out the previous step until the trading price fluctuation on each chain after allocation shows a gentle situation and is lower than a certain threshold, then the current best-split result is obtained and used as the final trading path.

In short, in the preliminary design scheme of Zenlink smart order routing, when it comes to cross-chain transactions, the route will at least simulate the transaction results in different paths in more than two parachains, and finally select the Pool on N parachains with the best simulation results to split the transaction.

It is worth mentioning that the above-mentioned selection of N optimal solution chains as the input parameters of the split transaction will not be too large. The reason for this design is that such transactions involve cross-chain Transfer to ensure the success rate of routing transactions and avoid “invalid” routes caused by the time difference caused by cross-chain Transfer between too many parachains. Therefore, a more balanced value will be sought as the value of N in the final routing scheme.

For more details:

Last updated