Navigator: Swap Routing Engine
At the heart of Swapscanner’s innovation is the Navigator engine, a testament to our technical prowess in the DeFi space. Navigator utilizes real-time liquidity data from all DEXes within the Kaia network to find the optimal path for a swap transaction. This process involves navigating through multiple DEXes, tokens, and protocols to guarantee the lowest token purchase price possible. Achieving this requires a seamless and stable integration of several components, ensuring that every stage of the swap process, from blockchain synchronization and liquidity data extraction to optimal path calculation, is completed within a sub-second timeframe.
Key Features of Navigator
Real-Time Liquidity Utilization: Navigator employs a unique algorithm that uses up-to-date liquidity data to search for the most cost-effective swap routes. By optimizing an enormous amount of calculation algorithms and processing them through a distributed system, Navigator analyzes all liquidity data and extracts the optimal path in less than one second. Considering the vast number of potential routes (e.g., 75,937,500,000 possible paths when transiting through five different tokens), the ability to compute these in under a second is crucial for maintaining relevance due to the Kaia network's block creation time of 1 second.
Comprehensive Cost Calculation: Beyond simple liquidity ratio calculations, Navigator incorporates gas fees and DEX fees into its calculations to ensure the selection of the most cost-effective route. Liquidity and gas fees vary significantly across DEXes and pairs, making it imperative to consider these factors for an accurate optimal path determination.
Sub-second Liquidity Data Refresh: Given the volatility of liquidity information, Navigator requires constant access to the latest data. Most DEXes update their liquidity data every ten seconds, which can quickly become outdated. Utilizing Swapscanner’s robust Kaia node cluster, Navigator refreshes liquidity data in under a second, allowing for real-time optimal path calculations.
Infrastructure Components
Kaia Node Cluster: The backbone of real-time optimal route discovery lies in the synchronization speed with the actual network, provided by the Kaia node. Swapscanner operates multiple nodes and uses high-performance specifications to ensure uninterrupted functionality and immediate response to any network anomalies. Our nodes exceed Kaia’s recommended specifications, utilizing 16 vCPU, 64GB RAM, and 120k Provisioned IOPS SSDs, ensuring over 200% performance compared to standard requirements. This approach guarantees that our system remains functional under any circumstances, with automatic failover and node replacement mechanisms in place.
NAEP (Navigator Aggregation Execution Protocol): Executing the calculated optimal swap routes in reality is as crucial as their computation. NAEP, a smart contract protocol, plays a vital role in this process by enabling all swaps to be processed within a single transaction. This methodology is essential to adapt to the liquidity changes that can occur with each block. NAEP ensures the safety and reliability of swaps by verifying the amount of tokens received during the transaction. If the actual amount falls short of the expected, NAEP automatically cancels the transaction, preventing any loss of tokens. This level of protection offers peace of mind, even in transactions involving less secure DEXes.
Last updated