In the previous discussions regarding the Liquidity Aggregation mode of the Kinetex dApp, the team has emphasized the significance of accessibility and security in developing this and following innovative solutions. While we have previously delved into the accessibility aspect, let's now focus on the security measures incorporated in the first of Kinetex's solutions.
When it comes to using DeFi services, one of the biggest challenges is dealing with price slippages and price impacts. These sudden changes in the price of cryptocurrencies can make it difficult to trade assets quickly and efficiently, which can be a significant hurdle for anyone looking to navigate the world of decentralized finance. These challenges become particularly apparent in cross-chain swap scenarios where atomicity is not ensured, and both price slippage and price impact can spiral out of control.
One way to overcome substantial price changes during transfers is to bypass bridges. Kinetex enables users to avoid losses by providing direct cross-chain transactions with guaranteed rates. This approach allows users to trade without worrying about unsatisfactory trading outcomes. Kinetex incorporates bridgeless cross-chain swaps through its own atomic cross-chain swap protocol and integration with Hashflow, and its algorithms prioritize choosing routes that use them.
Another method to control price changes during swaps is introducing slippage tolerance. In the trading context, slippage occurs when the market price at which a trade is executed differs from the anticipated or requested price. Slippage tolerance refers to the maximum acceptable deviation between a trade's assumed and actual rates. To manage the impact of market fluctuations, Kinetex offers a valuable tool called "Slippage Tolerance." It restrains slippages when building routes through aggregated liquidity sources, enabling users to select the slippage they are willing to accept during a trade.
Users should consider the following, though. The bigger the slippage, the quicker a trade is expected to be executed. However, more significant slippage also means greater cost-ineffectiveness and losses. The minimum slippage level suggested by Kinetex is 2-4%, while the default setting is 2%. In addition, the gas level is one more critical setting that should not be overlooked. A low gas level can result in a transaction being stuck, as validators choose others to include in a block.
Lastly, Kinetex ensures more stable prices for users by prioritizing routes with the same asset or stablecoins as intermediate assets. Consequently, if a swap fails within the established slippage tolerance, the user's assets get fixed in either the original asset or a stablecoin. Such an approach decreases volatility risks and the chance of notable price changes during the swap process.
At times, transactions may not be executed successfully for several reasons, including changes in prices. A transaction will fail if the selected slippage tolerance is not met at any swap stage. In case the transaction fails at the beginning, the user will receive the initial assets. Otherwise, the user will get the swap amount in one of the supported stablecoins. Unfortunately, gas fees cannot be refunded in such cases; still, this approach will prevent the loss of additional funds.
Furthermore, Kinetex has implemented a specific deadline for transaction reordering. It enables relay nodes to retry failed swaps automatically when more promising market conditions arise. The standard deadline time is 20 minutes.
The second serious challenge that Kinetex faced in the Liquidity Aggregation mode was MEV attacks. This phenomenon significantly impacts the DeFi market and user experience when trading crypto. The decentralized trading mechanisms facilitate transaction manipulations and MEV. This problem is severe during cross-chain swaps that go through platforms and aggregators that automate swapping processes. In such cases, aggregators publish the planned route publicly during the swap initiation.
Along with the use of large slippage levels, which users often prefer to increase the chances of a successful swap, it leads to maximum exploitation of users. The Kinetex team has implemented a set of measures to reduce the influence of MEV attacks as much as possible.
The first measure is hiding transactions from MEV searches. Transactions in the Liquidity Aggregation mode pass through relay nodes, which allows Kinetex to manage their publication in the mempool. To prevent the disclosure of transaction details before they appear in mined blocks, Kinetex currently publishes transactions through the Flashbots infrastructure, thereby preventing their analysis by MEV search engines.
Another way to prevent early route disclosure is using upgraded Swap structures. All transactions on Kinetex Aggregation require a signed user message that provides information about the transactions in each network along the route. This message is structured in a Swap format, which contains an array of SwapStep structures and is included in the SwapParams structure. The SwapStep structure includes a chainID field, which allows each step to be applied separately to each network. When the user message is made public, the entire route can be predicted, making it vulnerable to MEV attacks.
To complicate MEV extraction significantly, Kinetex updated the contract to include the SwapStealth structure. This structure only publishes the user-signed hash set of each SwapStep structure during the first transaction, and the data of each step itself is published successively during the swap. Consequently, Kinetex is able to mitigate risks of losses connected to MEV.
The last important challenge that Kinetex successfully overcame when ensuring user security in the Liquidity Aggregation mode is control of token approvals. The first Kinetex mode lets users choose from two token allowance options. The first is a one-time approval for the precise amount a user would like to swap, which should be re-issued for each new swap. The second option is an infinite approval that provides access to the entire user's balance. It is advised to use the first method as it allows for enhanced security.
Security of swapping in DeFi is one of the biggest priorities, along with accessibility, for the Kinetex team. By making the DeFi space more user-friendly and safe, projects can attract more users to this industry, including those who now prefer using traditional CeFi platforms. This way, the team hopes to help users experience crypto in the way it was meant to be experienced: decentralized, easy-to-use, safe, efficient, and empowering, enabling more people to benefit from the advantages of DeFi.
Kinetex Network: Website | Kinetex dApp