---
title: Cyclic Arbitrage in DEXs
url: https://www.emergentmind.com/topics/cyclic-arbitrage-in-decentralized-exchanges-dexs
type: topic
---

# Cyclic Arbitrage in DEXs

Cyclic arbitrage in decentralized exchanges (DEXs) refers to the atomic execution of a sequence of trades that forms a closed loop in the asset exchange network, resulting in a net profit from price discrepancies that exist across different pools or trading paths. Unlike traditional markets, DEX cyclic arbitrage leverages blockchain-specific mechanisms—such as atomic smart contract execution, public transaction ordering, and on-chain liquidity pools—which fundamentally alter both the operational security and economic dynamics of arbitrage strategies. This article provides a comprehensive account of cyclic arbitrage in DEXs, synthesizing theoretical models, empirical findings, design impacts, and security considerations from recent research.

## 1. Fundamentals of Cyclic Arbitrage on DEXs

Cyclic arbitrage exploits the non-equivalence between the direct and cross-rates for token pairs within the interconnected pool structure of DEXs. Given a set of tokens and their associated liquidity pools, a cyclic arbitrage opportunity is present if traversing a loop of trades—for example, A→B→C→A—yields more of the starting token than was initially committed, after accounting for fees and slippage. A basic mathematical condition for an n-token cyclic arbitrage is:

$$(a_{2,1} \cdot a_{3,2} \cdots a_{1,n})/(a_{1,2} \cdot a_{2,3} \cdots a_{n,1}) > 1/(r_1^n r_2^n)$$

where $a_{i,j}$ are the pool reserves and $r_k$ the corresponding fee factors [2105.02784]. This condition generalizes to the product of forward quoted prices exceeding the compounded fee denominator.

Nearly all practical cyclic arbitrage on DEXs is executed atomically: the sequence of trades is bundled in a single transaction, ensuring that execution either occurs in its entirety or is reverted. This atomicity eliminates traditional execution risk arising from partial fills or orderbook slippage—any adverse price movement between the legs cancels the entire transaction at the cost of gas fees only [2105.02784]. Consequently, the incentive to identify and respond to transient price discrepancies is high, and competition for inclusion in the next block is intense.

## 2. Detection Algorithms and Cycle Identification

Formal detection of cyclic arbitrage opportunities in DEXs is framed as a negative-weight cycle problem in an exchange-rate graph. A canonical approach deploys modified Bellman–Ford algorithms, operating on a weighted graph where edge weights correspond to the negative logarithm of effective exchange rates (including fees):

$$p_{i,j} = -\log[(1-\lambda)\cdot(r_j/r_i)]$$

for edge $(i, j)$, with $r_i, r_j$ as pool reserves and $\lambda$ as the effective fee [2406.16573, 2106.16158]. A negative cycle directly translates to a profitable arbitrage loop.

Recent advances utilize line graph transformations combined with extra source nodes and novel edge-cut rules to simultaneously detect arbitrage cycles from any specified starting token and to identify profitable non-loop paths (arbitrageurs ending up with a different token). This approach solves several key limitations of previous Moore-Bellman-Ford implementations—namely, the inability to specify start tokens, restricted coverage of cycles per run, and exclusion of non-loop arbitrage paths [2406.16573].

Once cycles are detected, profit maximization is solved via bisection on the constant product market maker (CPMM) equation (Uniswap V2):

$$[x + (1-\lambda)\Delta x] \cdot (y-\Delta y) = x \cdot y$$

with the optimum at the point where the marginal output ratio equals unity or, for non-loop paths, matches a reference price on a CEX [2406.16600]. Optimized cycle detection algorithms identify not only more arbitrage opportunities but also systematically larger potential profits compared to previous methods [2406.16573].

## 3. Atomic Execution, Frontrunning, and Priority Gas Auctions

Atomic arbitrage in DEXs is facilitated by smart contracts that execute multi-hop trades in a single transaction. This property guarantees that all legs of the arbitrage loop succeed together or the entire transaction reverts. As all pending transactions are visible in the public mempool, sophisticated bots monitor for profitable atomic arbitrage submissions and compete to have their own version included first. The outcome is the “priority gas auction” (PGA), a continuous-time, all-pay auction where each bot repeatedly resubmits its arbitrage attempt with incrementally higher gas fees, seeking to outbid competitors for priority transaction inclusion [1904.05234].

Let $p$ denote the theoretical arbitrage profit and $g$ the gas fee bid; the profit function is formulated as:

$$\max_g [p - g]$$

The incremental gas fee race continues until the marginal cost of bidding exceeds the residual profit, frequently eroding the arbitrage margin nearly to zero [1904.05234]. Even losing bots pay partial gas costs due to partial execution, as failed transactions are still charged for attempted computation.

This auction dynamic does not differentiate between “pure” cross-venue arbitrage and cyclic arbitrage: the mechanism for gaming priority is identical, and escalating gas competition can cause profit opportunities to vanish or convert to a net loss if frictional costs outpace price discrepancies [1904.05234].

## 4. Economic and Empirical Properties of Cyclic Arbitrage

Empirical analyses demonstrate that cyclic arbitrage is an inherent and persistent phenomenon in DEXs. For example, in Uniswap V2, more than 290,000 cyclic arbitrages were executed in an 11-month span, generating $>138$ million USD in revenue. Despite this scale, substantial unexploited opportunities (>1 ETH per block) often remain, indicating that DEXs are not perfectly efficient [2105.02784]. Statistical data further reveal:

- High correlation between periods of volatile token prices and surges in cyclic arbitrage frequency, profit, and decreased block duration of opportunities [2203.07774].
- Most cyclic arbitrage is executed atomically: only about 0.03% of attempts are made sequentially, and atomic implementations enjoy dramatically lower negative-revenue rates ($\approx$0.3%) than sequential implementations (>50%) [2105.02784].
- Transaction cost structure—most notably, gas fees—scales poorly for small trades. Persistent cyclic arbitrage deviations are observed: average triangular price gaps in major stablecoin triplets are 10–30 bps (contrasted with CEXs at <5 bps), intensified by high gas fee regimes [2112.07386].

Empirical support is also observed for the central role of arbitrage in restoration of pool pricing: in volatile regimes, liquidity providers bear the losses captured by arbitrageurs (the so-called “impermanent loss”) [2103.08842].

## 5. Protocol Design, Routing, and Efficiency Metrics

The presence and magnitude of cyclic arbitrage are closely tied to DEX design choices:

- **AMM invariants and pricing curve curvature:** Greater curvature (as in constant product pools) reduces the arbitrage gap but also reduces investor surplus; there is an optimal curvature that balances efficiency and liquidity provision [2103.08842].
- **Token pooling:** Pooling more than two tokens increases expected arbitrage losses; arbitrageurs can synthesize more advantageous cycles across more dimensions, as formalized for 2- vs. 3-token pools [2103.08842].
- **Routing algorithms:** Variants including depth-first search (DFS) and line-graph-based enhancements directly influence detected arbitrage potential. Superior routing (line-graph method) finds systematically more profitable paths and reduces Standardized Total Arbitrage Profit (STAP)—a convex optimization-based efficiency metric that quantifies residual arbitrage after optimal path selection. As STAP$\rightarrow$0, the DEX becomes “arbitrage-complete” [2508.03217].
- **Batch-clearing architectures:** Batch-clearing with Arrow–Debreu-derived global price assignments, as in SPEEDEX, eliminates all internal cyclic arbitrage by design. All trades in a block face the same exchange rate matrix, and traversing any loop yields no net gain [2111.02719].

Significant innovations (e.g., Uniswap v3's Multiple Fee Tiering and Discretionary Price Ranges) narrow price deviations and reduce arbitrage rent, especially for large trades [2112.07386].

## 6. Security, Market Microstructure, and Systemic Risks

Cyclic arbitrage is a source and conduit for Miner (or Maximal) Extractable Value (MEV)—the value miners can capture by controlling the ordering and inclusion of transactions. Excessive MEV regimes incentivize miners to reorder transactions, execute fee-based forking (“time-bandit attacks”), or even monopolize the inclusion of arbitrage cycles, introducing consensus-layer security risks [1904.05234]. Empirically, arbitrage and associated MEV have been shown to incentivize network-level behaviors that undermine block finality and fairness.

Architectural responses to these problems include:

- **A2MM (Automated Arbitrage Market Maker):** Internalizes routing and atomic arbitrage between multiple AMMs, reducing MEV leakage and the incentive for external bots to front-run or spam the network. Empirical claims include reductions of up to 90% in swap fees and 32.8% in block-space consumption attributable to AMM transactions [2106.07371].
- **Non-atomic arbitrage:** Recent research highlights the distinction between pure on-chain cyclic arbitrage and non-atomic arbitrage combining DEX and off-chain CEX legs. The latter introduces a different risk and centralization profile, as the two transaction legs are exposed to market drift, and large searchers dominate participation, sometimes controlling $>$80% of MEV volume [2401.01622, 2507.13023].

Protocols integrating atomic cycle execution and efficient on-chain routing, along with the separation of top-of-block extraction or block time reduction, are discussed as systemic mitigations [2401.01622, 2106.07371].

## 7. Advanced Frameworks and Open Directions

Recent advances have included convex optimization-based methods for measuring and eliminating all cyclic arbitrage (and DEX–CEX arbitrage) [2508.03217], asset-matrix and Coincidence of Wants (CoW) cycle mechanisms for rigorous, slippage-free trade execution [2507.10149], and mean-field game modeling of liquidity provider and MEV bot interaction for predictive pool evolution [2404.09090].

Empirical and theoretical studies consistently find that DEXs become less cyclic-arbitrage-efficient during periods of high volatility or low liquidity, and that improved routing, atomic batch-clearing, or integrated cycle closing mechanisms systematically reduce residual arbitrage [2508.03217, 2111.02719, 2507.10149]. The persistence and scale of cyclic arbitrage (as high as 0.25% of trading volume on ZKsync) further suggest ongoing opportunities as well as persistent market inefficiencies, especially across L2 rollups and cross-chain venues [2406.02172].

Open research challenges include optimal routing for complex graph topologies, risk quantification in non-atomic and cross-rollup settings, robust measurement of MEV under diverse protocol conditions, and the investigation of optimal convex formulations for market-wide cyclic equilibrium.

---

This synthesis draws directly from the mathematical formulations, empirical approaches, and protocol designs in the cited literature, providing an authoritative reference for the structure, mechanisms, and ongoing evolution of cyclic arbitrage in decentralized exchanges.

Source: https://www.emergentmind.com/topics/cyclic-arbitrage-in-decentralized-exchanges-dexs