A short detour in our ongoing series around Argos. The previous post used the Argos MCP server to unwind a Tornado.Cash laundering case through gas fingerprints; the next one opens up the formally verified arbitrage detection engine inside Argos. Between those two heavier pieces, we owe the reader a gentler page: what an atomic arbitrage actually is, and why, when the contract is written the right way, it either lands in profit, or reverts as if the swaps never happened.
A cat released upside-down lands on its feet. Physicists found this almost insulting. The cat starts at rest with zero angular momentum, nobody pushes it, and yet it rotates a clean 180° before it hits the floor. For a while it looked like a small violation of a conservation law. It isn't. The cat rotates by changing its shape, folding front and back halves in opposite senses, sweeping its body through a closed loop of poses, and a closed loop in shape-space produces a net rotation while the total angular momentum stays exactly zero the whole way down.
Hold that sentence in your head, because it is also the definition of arbitrage. You go around a closed loop and come back rotated, richer, having, in some sense, never moved at all.
Arbitrage is a righting reflex
The canonical DeFi arbitrage is cyclic. You start with one token, say WETH. You swap WETH for USDC on one pool, USDC for DAI on another, DAI back to WETH on a third. If the three prices are momentarily inconsistent, and you traverse the loop in the right direction, you end up holding more WETH than you started with. Go the other way around and you lose: the cycle has a sign. You entered with a token and left with the same token. Your net position in the cycle is closed, you "haven't moved", and yet you've rotated into profit.
That profit doesn't come from nowhere any more than the cat's spin does. It comes from the geometry of the loop: a temporary mispricing around the cycle, which your trade consumes and erases. Go around the ring once; pocket the twist; the market is a little more consistent than before. The arbitrageur is the market's righting reflex.
A closed loop in shape-space rotates the cat. A closed loop in token-space pays the trader.
The triangular loop: WETH → USDC → DAI → WETH. You exit holding the same token, but with a small +Δ from the geometry of the cycle.
The reflex that cannot fail
Here is where blockchains do something physics can't. On an EVM chain, that whole three-swap loop can be a single atomic transaction. A small contract performs the swaps in sequence and, as its last act, checks the result:
// one transaction, three swaps, one verdict
uint256 start = WETH.balanceOf(address(this));
swap(WETH, USDC, amountIn); // leg 1
swap(USDC, DAI, /* all */); // leg 2
swap(DAI, WETH, /* all */); // leg 3 — back home
uint256 end = WETH.balanceOf(address(this));
require(end > start, "did not land on its feet"); // else REVERT
If the loop would close at a loss, that final require fails, the transaction reverts, and every swap inside it is undone as if it never executed. This is the part worth pausing on: the cat cannot belly-flop. Either it lands in profit, or the swaps retroactively never happened. Atomicity is the righting reflex made absolute, not "usually lands on its feet," but "lands on its feet or does not fall."
Two practical caveats keep this story honest. First, the require above is the simplified form: the real check is closer to end > start + exec_cost, because the gas burned running the three swaps is paid in ETH whether the transaction succeeds or reverts. And second, that gas is only truly forgiven if the failing transaction is never included in a block in the first place, which is why searchers route through private orderflow (Flashbots, MEV-Share, builder relays) rather than the public mempool. There, a bundle whose simulation doesn't profit is simply dropped before it lands in a block. The cat is not just kept from belly-flopping; it is allowed to refuse to fall at all.
Leg risk during execution, the thing that makes multi-step arbitrage scary in traditional markets, essentially vanishes. There is no half-completed loop, no leg that fills while another slips. The whole twist happens in one indivisible instant of block time.
A cat with no body: flash loans
You might object that you need WETH to begin with. You don't. A flash loan lets you borrow the starting capital inside the same transaction, on the sole condition that you repay it before the transaction ends, or the whole thing reverts. So you borrow, run the loop, repay the loan, and keep the residual, all atomically, minus whatever it takes to pay the block builder, which we come back to in the next section.
It is a cat that doesn't even own a body until it's mid-air, conjures one long enough to twist, and lands on feet it didn't have when it was dropped. The capital existed only for the duration of the fall.
The dark forest: many cats, one ledge
So if the reflex is guaranteed, why isn't everyone rich? Because you are not the only cat leaping for the same ledge. The moment a profitable loop is visible, dozens of searchers compete to be the one transaction that lands it, this is the heart of MEV (maximal extractable value). They bid up priority fees and direct payments to builders (so-called bribes in MEV jargon), route through private orderflow and block builders, and race on latency, gas efficiency and strategies.
The mathematics of the trade is solved; the contest is over sequencing. Who gets placed first in the block? The reflex is free. The ledge is not.
Atomicity itself is morally neutral. The same property that protects a benign cyclic arbitrage also enables sandwiches, JIT liquidity griefing, and predatory back-runs against retail flow. From the chain's point of view they are the same shape of object: an atomic, multi-leg, intent-bearing transaction. Telling the benign ring apart from the sandwich that taxed a retail swap is not a question of opinion; it is a question of structure. Which is exactly why being able to read these transactions, to label the loop and tell which kind of cat just landed, matters as much as being able to write them, and why, in the case of Argos, that labelling rests on a formally verified detection pipeline.
The trade is decided not by who is right, but by who is smart.
Watching the reflex, frame by frame
An atomic arbitrage is a dense little object: several swaps, cross-contract calls, token transfers and a profit check, all collapsed into one transaction hash. Understanding what actually happened, which pools, which legs, how much went to gas, where the edge really came from, means slowing the fall down to single frames.
At the level of a single transaction, that is what Apollo, our free EVM debugger, is for: step through the opcodes, inspect state at each hop, profile gas, and trace every cross-contract call as the loop unwinds. And at the level of patterns across the whole chain, Argos labels the pools and routers an analyst would otherwise read as raw hex, so a cyclic-arbitrage or sandwich pattern stands out at a glance.
The interesting question, of course, is how you spot the cycle in the first place when you have no idea which protocols a given transaction touched. That is exactly what the next post in this series is about: we open up the arbitrage detection engine inside Argos, a protocol-agnostic, formally verified pipeline that rewrites a transaction's cash-flow graph until any arbitrage cycle simply falls out of the canonical form. This post was the warm-up; that one is the machinery.
From the searcher's seat to the analyst's
That is the view from the searcher's seat. The rest of this series sits in the analyst's seat: spotting the loop in the wild, labelling its legs, deciding whether the cat is twisting toward a clean arbitrage or toward something it shouldn't be twisting toward at all.
The next post is where that work begins, term rewriting on cash-flow graphs, formal proofs in Rocq, and what we found running the pipeline on 220k Ethereum blocks. In the meantime, Argos is where the MEV labelling, fund tracing, and the engine all live. Talk to us.