Table of Contents
Fetching ...

PRIME: Efficient Algorithm for Token Graph Routing Problem

Haotian Xu, Yuqing Zhu, Yuming Huang, Jing Tang

TL;DR

PRIME is proposed, a two-stage iterative graph algorithm designed for the Token Graph Routing Problem (TGRP), which consistently outperforms the widely-used Uniswap routing algorithm, achieving up to 8.42 basis points better execution prices on large trades while reducing computation up to 96.7%.

Abstract

Optimizing asset exchanges on blockchain-driven platforms poses a novel and challenging graph query optimization problem. In this model, assets represent vertices and exchanges form edges, recasting the graph query task as a routing problem over a large-scale, dynamic graph. However, the existing solutions fail to solve the problem efficiently due to the non-linear nature of the edge weights defined by a concave swap function. To address the challenge, we propose PRIME, a two-stage iterative graph algorithm designed for the Token Graph Routing Problem (TGRP). The first stage employs a pruned graph search to efficiently identify a set of high-potential routing paths. The second stage formulates the allocation task as a strongly convex optimization problem, which we solve using our novel Adaptive Sign Gradient Method (ASGM) with a linear convergence rate. Extensive experiments on real-world Ethereum data confirm PRIME's advantages over industry baselines. PRIME consistently outperforms the widely-used Uniswap routing algorithm, achieving up to 8.42 basis points (bps) better execution prices on large trades while reducing computation up to 96.7%. The practicality of PRIME is further validated by its deployment in hedge fund production environments, demonstrating its viability as a scalable graph query processing solution for high-frequency decentralized markets.

PRIME: Efficient Algorithm for Token Graph Routing Problem

TL;DR

PRIME is proposed, a two-stage iterative graph algorithm designed for the Token Graph Routing Problem (TGRP), which consistently outperforms the widely-used Uniswap routing algorithm, achieving up to 8.42 basis points better execution prices on large trades while reducing computation up to 96.7%.

Abstract

Optimizing asset exchanges on blockchain-driven platforms poses a novel and challenging graph query optimization problem. In this model, assets represent vertices and exchanges form edges, recasting the graph query task as a routing problem over a large-scale, dynamic graph. However, the existing solutions fail to solve the problem efficiently due to the non-linear nature of the edge weights defined by a concave swap function. To address the challenge, we propose PRIME, a two-stage iterative graph algorithm designed for the Token Graph Routing Problem (TGRP). The first stage employs a pruned graph search to efficiently identify a set of high-potential routing paths. The second stage formulates the allocation task as a strongly convex optimization problem, which we solve using our novel Adaptive Sign Gradient Method (ASGM) with a linear convergence rate. Extensive experiments on real-world Ethereum data confirm PRIME's advantages over industry baselines. PRIME consistently outperforms the widely-used Uniswap routing algorithm, achieving up to 8.42 basis points (bps) better execution prices on large trades while reducing computation up to 96.7%. The practicality of PRIME is further validated by its deployment in hedge fund production environments, demonstrating its viability as a scalable graph query processing solution for high-frequency decentralized markets.
Paper Structure (28 sections, 7 theorems, 19 equations, 6 figures, 4 tables, 3 algorithms)

This paper contains 28 sections, 7 theorems, 19 equations, 6 figures, 4 tables, 3 algorithms.

Key Result

Lemma 1

A feasible allocation for the token allocation problem is optimal if and only if the marginal prices are equal across all components (i.e., paths and parallel edges).

Figures (6)

  • Figure 1: An Example Token Route from WETH to USDC
  • Figure 2: The Workflow of PRIME Algorithm
  • Figure 3: Performance of PRIME relative to SOR across three distinct market periods: Bearish, Stable, and Bullish. The figure plots the daily average performance for WETH to USDT swaps across a range of input amounts. (a) Price improvement of PRIME over SOR, measured in basis points (bp). (b) Percentage reduction in computation time achieved by PRIME.
  • Figure 4: Scalability Comparison
  • Figure 5: Token swap execution patterns in production protocols. Uniswap V3 offers multiple pools for the same token pair, distinguished by fee tiers specified in the label (e.g., 'UniV3_5bp'). The standard 30bp fee for V2 pools is omitted for clarity. Percentages denote flow allocation.
  • ...and 1 more figures

Theorems & Definitions (18)

  • Definition 1: Swap Function
  • Definition 2: Swap Graph
  • Definition 3: Swap Path
  • Definition 4: Token Graph Routing Problem
  • Lemma 1: Optimal Condition
  • proof
  • Theorem 1: Convergence of ASGM
  • proof
  • Lemma 2: Strong Concavity of Path Swap Functions
  • proof
  • ...and 8 more