Atomic Arbitrage in DeFi
- Atomic Arbitrage (AA) is a trading method where multi-leg swaps are bundled into a single transaction, ensuring either full execution with profit or complete reversion.
- AA frameworks leverage cyclic arbitrage across automated market makers by employing closed-form solutions for optimal trade sizing and equilibrium enforcement.
- Attribution methods in AA analyze causal origins using techniques like simulation and Shapley value allocation to assess market inefficiencies and protocol impacts.
Searching arXiv for the cited Atomic Arbitrage literature and related papers. arxiv_search(query="Atomic Arbitrage AMM closed-form solutions generic N-token arbitrage (Willetts et al., 2024)", max_results=5) arxiv_search(query="Closed-form solutions for generic N-token AMM arbitrage", max_results=10) {"query":"Closed-form solutions for generic N-token AMM arbitrage", "max_results": 10} Atomic Arbitrage (AA) most commonly denotes a multi-leg arbitrage whose entire execution is bundled into a single blockchain transaction, so that either every leg settles and the profit condition holds, or the transaction reverts. In decentralized-exchange and automated-market-maker research, this notion covers cyclic arbitrage across pools, price-convergence trades between AMMs and external venues, and basket trades in multi-asset CFMMs (Wang et al., 2021, Gogol et al., 2024, Willetts et al., 2024). A distinct usage in mathematical finance studies “atomic arbitrage” created by insider information taking values on finitely many atoms; that usage is conceptually separate from blockchain execution semantics, even though the terminology overlaps (Chau et al., 2016).
1. Definition and terminological scope
In recent blockchain studies, AA is usually formalized as a transaction-level property. An on-chain transaction is classified as atomic arbitrage if and only if three conditions hold: it executes at least two swaps, the net balance change is non-negative for every asset in the route, and the transaction’s net profit after protocol fees and priority bids is strictly positive. In compact form,
This criterion is used in large-scale Polygon analyses to detect AA in block data (Vostrikov et al., 29 Aug 2025, Seoev et al., 30 Apr 2026).
Within DEX theory, AA is often a cyclic arbitrage: a multi-step trade that starts and ends in the same token and exploits price discrepancies around a cycle of liquidity pools. For tokens , the cycle
is profitable when the final amount exceeds the initial amount (Wang et al., 2021). In A2MM, the term is specialized further to a two-step cycle across two AMMs: swap of asset for of on one AMM, then immediately swap 0 back to 1 on another, with 2 (Zhou et al., 2021).
The older mathematical-finance usage differs materially. There, the “atomic” object is not a transaction but an atom of information 3 known to an insider at time zero. In a complete market, the insider can super-hedge 4 for an initial capital strictly less than 5, yielding strong arbitrage on that atom while NUPBR can still hold (Chau et al., 2016). This suggests that the phrase “atomic arbitrage” is polysemous: in DeFi it denotes all-or-nothing execution, whereas in enlargement-of-filtration theory it denotes arbitrage tied to atomic information.
2. Atomicity as an execution primitive
The core operational property of AA on-chain is all-or-nothing execution. In cyclic DEX arbitrage, packaging all swaps into one transaction eliminates partial-fill risk: if the final condition 6 is not met, the EVM reverts the entire transaction, so no intermediate leg settles except for gas expenditure (Wang et al., 2021). This rollback property is the main reason AA is modeled as safer than sequential multi-leg execution.
A canonical implementation is a custom smart contract that computes the route, checks profitability, and then executes the swap sequence. One documented pattern is: 45 This design captures the minimal AA logic for cyclic arbitrage on Uniswap-style pools (Wang et al., 2021).
In multi-asset G3M pools, AA is generalized from a path of pairwise swaps to a single basket trade. The trade is represented by a net vector 7, and all token legs are packaged into one CFMM swap call. Because the closed-form solution enforces the pool invariant with equality, the transaction crosses the CFMM boundary once and leaves pool and market prices in perfect equilibrium, with no residual arbitrage kink (Willetts et al., 2024). The documented router flow is: transfer inbound tokens 8, call swapExactTokensForTokens with a custom multi-asset path encoding 9, and receive outbound tokens 0 in the same transaction (Willetts et al., 2024).
Atomicity becomes more subtle when one leg is off-chain. For AMM–CEX arbitrage, the theoretical model treats the trade as if both legs are wrapped into one atomic arbitrage call, but the same work explicitly notes that off-chain CEX execution cannot literally be in the same EVM transaction; in practice, traders pre-fund CEX accounts or use pegged derivatives (Gogol et al., 2024). A common misconception is therefore that “atomic” always means cross-venue simultaneity in a literal execution sense. In cross-domain settings, atomicity is often an economic abstraction rather than a strict settlement fact.
3. Mathematical models and optimal trade sizing
The simplest AA model in AMMs is the cyclic constant-product framework. For each pool 1 swapping 2, reserves are 3, the fee factor is 4, and the swap function is
5
If the cycle output is 6, profit is
7
A small-input cyclic arbitrage exists if and only if
8
equivalently 9. The optimal input 0 is unique and can be written in terms of equivalent reserves 1 as
2
This framework formalizes classical triangular and higher-order DEX cycles (Wang et al., 2021).
A more general formulation appears for 3-token geometric-mean market makers. Let reserves be 4, weights 5 with 6 and 7, invariant
8
and fee credit fraction 9. A trade 0 is accepted iff
1
Writing the net trade as 2 and 3 if 4 else 5, the equality frontier is
6
For an active set 7, normalized weights 8, and
9
Appendix A yields the closed-form optimal trade
0
This converts AA from a numerical optimization problem into signature enumeration plus direct evaluation (Willetts et al., 2024).
For AMM–CEX arbitrage, a CPMM with reserves 1 and invariant 2 yields instantaneous AMM price 3. If the CEX has price 4, the optimal amount of token 5 sold into the AMM is
6
and the corresponding Maximal Arbitrage Value is
7
For concentrated liquidity, the analogous quantity is computed per tick and summed: 8 This formulation explicitly links trade size, liquidity depth, and price divergence (Gogol et al., 2024).
A2MM analyzes the two-pool case with constant-product AMMs and 0.3% fee. If pools 9 and 0 have reserves 1 and 2, the arbitrageur chooses 3 to maximize
4
Equation 16 gives a closed-form approximate optimizer,
5
with a necessary profitability condition 6 (Zhou et al., 2021).
4. Detection, attribution, and measurement at scale
Large-scale empirical work operationalizes AA by scanning blocks, parsing swaps, aggregating per-asset net flows, and computing net profit after fees and prioritization bids. A documented detection loop over 23 million Polygon blocks uses a full Polygon archive node, PolygonScan API, and web3py: for each transaction, parse swaps, discard 7, compute 8, reject any transaction with 9, then classify as AA when 0 (Vostrikov et al., 29 Aug 2025).
Once AA events are identified, a separate question is causal attribution: which earlier transaction created the arbitrage opportunity. One framework defines the candidate set
1
and compares four attribution methods for atomic arbitrage on EVM-compatible networks (Seoev et al., 30 Apr 2026).
| Method | Mean cost | Coverage / accuracy |
|---|---|---|
| Coefficient | 0.8 ms | 88.4% / 77.2% |
| Bot-data | 8 ms | 38.4% / 94.2% |
| Simulation | 12.3 ms | 99.1% / 91.7% |
| Shapley MC | 2.1 s | 98.1% / 100% |
| Shapley exact | ~5 min | 98.1% / 100% |
The simulation-based method replays the block with and without candidate transactions, searching backwards up to 2 blocks for an edge transaction where profit drops below 3 of original 4, then computes
5
and selects the source maximizing 6 (Seoev et al., 30 Apr 2026). The coefficient-based method instead tracks a price-multiplier coefficient 7 along the arbitrage cycle and attributes to the transaction maximizing 8; it is lightweight but omits slippage and depth (Seoev et al., 30 Apr 2026). Shapley-based attribution models candidate transactions as players in a cooperative game with value function 9 and assigns marginal contributions
0
This is theoretically ideal for multi-source attribution but computationally costly (Seoev et al., 30 Apr 2026).
A plausible implication is that AA research has bifurcated into two layers: optimization of the arbitrage transaction itself, and retrospective attribution of the opportunity’s causal origin. The first asks how to execute the trade; the second asks who created the state from which the trade became profitable.
5. Empirical regularities across chains and market designs
A systematic study of Uniswap V2 from May 2020 to April 2021 recorded 292,606 executed cyclic arbitrages over eleven months, with total gross revenue of approximately 1 ETH, gas costs of approximately 2 ETH, and average net profit of approximately 3 ETH per cycle. The same study reports more than 4 million USD in revenue and observes persistently unexploited opportunities above 5 ETH per block, indicating that DEX markets may not be efficient enough (Wang et al., 2021).
Polygon measurements emphasize the distinction between Spam-based and Auction-based backrunning. Over Jan 2023 to Oct 2024, a 23 million-block study estimates total AA MEV at approximately 6 million USD. Spam-based AA accounts for approximately 7 of AA MEV volume and approximately 8 of AA transaction counts, whereas Auction-based AA via FastLane accounts for approximately 9 of AA MEV volume and approximately 0 of AA transaction counts. Average profit per transaction is approximately 1 MATIC for Spam-based AA and approximately 2 MATIC for Auction-based AA; the study also reports that FastLane’s private relay and bid auction reduce network congestion by approximately 3 fewer failed/duplicated transactions, and that observed efficiency satisfies 4 over the study period (Vostrikov et al., 29 Aug 2025).
The same Polygon work reports token concentration: WMATIC appears in approximately 5 of AA, followed by WETH at 6 and WBTC at 7, reflecting deep liquidity (Vostrikov et al., 29 Aug 2025). A separate March 2026 attribution study on Polygon analyzes 360,026 atomic arbitrage events with total extracted value of \$334,799 and finds highly concentrated opportunity creation: the top 8 of opportunity-creating transactions account for 9 of extracted value, the top 00 of protocols generate 01 of total MEV creation, and 02 of arbitrage events attribute more than 03 of positive Shapley value to a single transaction (Seoev et al., 30 Apr 2026). Among 220,262 identified opportunity creators in February 2026, participation rates are 04 for Uniswap V3, 05 for Algebra, 06 for Uniswap V4, 07 for Uniswap V2, and 08 for DODO, with protocol overlap because a single swap may touch multiple pools (Seoev et al., 30 Apr 2026).
On zkSync Era, arbitrage between SyncSwap and Binance from July to September 2023 yields cumulative MAV of \$\tau$0943.73M traded volume. Daily MAV peaks near \$8k on high-misalignment days, while price misalignments typically decay within a few minutes, with block time 10 s and median decay approximately 11–12 s (Gogol et al., 2024). This suggests that AA opportunities on rollups can be persistent enough to measure but short-lived enough to require low-latency execution.
For multi-asset G3M pools, simulation and backtest results indicate that closed-form AA can outperform convex solvers. Synthetic trials over 120,000 random perturbations of an 13-token pool starting at equilibrium show strictly greater or equal profit in at least 14 of cases versus CVXPY, with 15 ms versus 16 ms on CPU for 17. A historical backtest from June 2021 to July 2022 on a 3-token ETH/BTC/DAI pool with 18, 19, and initial TVL 20 M USD finds that, in dueling mode where convex arb gets priority, the closed-form method still captures 21 more cumulative profit (Willetts et al., 2024).
6. Infrastructure, security, and open limits
AA is not only a trading strategy but also a source of network externalities. A2MM argues that when arbitrage and routing are internalized inside a smart contract, competitive MEV exploitation is reduced. In a 185-day replay on Uniswap and Sushiswap data, A2MM reports total on-chain arbitrage revenue of 22 K ETH, average revenue per AA call of approximately 23 ETH, block-space savings of 24 fewer total gas consumed versus separate AMM plus arbitrage transactions, and approximately 25 fewer mempool spam messages per AA. Under realistic block sizes and latencies, effective miner bandwidth improves by up to approximately 26 Mbit/s, translating into approximately 27 lower stale-block rate on Ethereum; in expectation, A2MM revenue allows swap fees to be reduced by 28 (Zhou et al., 2021).
On-chain integration details matter for whether AA is practically realizable. In the 29-token G3M setting, closed-form evaluation loops over at most approximately 30 trade signatures with 31 arithmetic per signature; for 32, even single-thread CPU evaluation is reported as less than 33 ms, and signature checks are embarrassingly parallel, allowing one thread per signature on GPU. The same work states that a CUDA kernel can complete the full pass in less than or equal to 34 ms for 35, and that end-to-end arb latencies from price feed to on-chain transaction can be driven below 36 ms (Willetts et al., 2024). It also notes that multi-asset swap gas scales roughly linearly in 37, with typical marginal cost approximately 38 gas per extra token leg, and recommends private relays or Flashbots to mitigate front-running and sandwich risk (Willetts et al., 2024).
Atomicity, however, is not sufficient in every execution environment. A shared-sequencer model over two constant-product pools shows that the expected profit under atomic execution,
39
can be lower than expected profit under non-atomic execution when one-sided swap success is itself valuable. In the symmetric case 40,
41
and the model states that this quantity is negative. The paper concludes that switching to atomic execution does not always improve profits, and that shared sequencers may need guaranteed execution features beyond atomic swap bundling to attract arbitrage flow (Silva et al., 2024). This directly qualifies the common claim that atomicity is always profit-enhancing.
Several open problems recur across the literature. For large 42, signature enumeration in closed-form G3M arbitrage grows as 43, so heuristics or branch-and-bound pruning become essential for very large 44 (Willetts et al., 2024). Temporally varying weights in TFMMs require differentiating through the swap, and extension to stableswap, Uniswap v3’s piecewise-linear pool, cross-pool routing, and cross-chain arbitrage remains open (Willetts et al., 2024). At the ordering layer, Polygon studies point to auction-based consensus, time-based fairness, content-agnostic ordering, and application-layer solver models as directions for reducing AA leakage and its adverse externalities (Vostrikov et al., 29 Aug 2025). A plausible implication is that future AA research will remain split between execution efficiency, causal attribution, and protocol design aimed at reducing the very opportunities that AA exploits.