Press ESC to close

JIT Liquidity in Uniswap v3: How MEV Bots Steal Fees in Milliseconds

Imagine you’ve opened a coffee shop in a busy area. You pay rent, hire staff, and wait for customers. Suddenly, right in front of your door, as a group of 100 tourists approaches, someone sets up a temporary kiosk in a split second, sells them coffee, and tears it down immediately after the last tourist pays. You’ve been standing there all day, but the profit is gone—it’s taken by the “ghost.”

In DeFi, this “ghost” is called JIT liquidity (Just-In-Time).

 

1. Concept: On-Demand Liquidity

In Uniswap v2, liquidity was “lazy”—spread across the entire price curve from zero to infinity. Uniswap v3 introduced Concentrated Liquidity, letting LPs pick narrow ranges.

JIT liquidity is the extreme form of concentration. An MEV bot doesn’t keep funds in the pool all the time. It adds them exactly when it sees a large transaction (swap) in the mempool that is guaranteed to generate big fees.

How it looks in a block (Timeline):

  • Target Tx: A user sends a transaction to swap 500 ETH for USDC.
  • Detection: The bot spots it in the mempool (pending transactions).
  • JIT Bundle: The bot creates a three-step bundle:
    • Action A (Mint): Add massive liquidity in a 1-tick range (smallest possible price step) where the trade will happen.
    • Action B (Swap): The user’s swap happens here.
    • Action C (Burn): Immediately remove the liquidity along with the share of fees.

All three actions occur in the same block, often within a single atomic transaction through the bot’s smart contract.

 

2. Why your fees “disappear”

LP earnings in Uniswap v3 are proportional to their share of the active price range.

Mathematical shock: If the pool has $1,000,000 from regular LPs, and a JIT bot injects $9,000,000 into the same narrow range for a single swap, it takes 90% of the fees from that trade.

For a passive LP, this means dilution. You don’t lose your tokens (aside from normal impermanent loss), but you lose the opportunity cost—the profit you risked capital for.

Real example (2025-2026 data):

In a USDC/ETH (0.05%) pool, a $10M swap occurs. Expected fees: $5,000.

  • No bot: 10 regular LPs split $500 each.
  • With JIT bot: The bot adds $100M liquidity. Regular LPs’ share drops to 1%. The bot takes $4,950, and the 10 LPs share a meager $50.

 

3. Anatomy of a transaction: Technical view

JIT bots use specialized smart contracts. The normal Uniswap interface is too slow and expensive gas-wise for this.

Technical detail: The bot calls the mint function on NonfungiblePositionManager but does so through its wrapper contract, which immediately calls decreaseLiquidity and collect after the swap.

Example call structure (Solidity-style):

// Pseudocode for JIT contract logic
function executeJit(
    address pool,
    int24 tickLower,
    int24 tickUpper,
    uint256 amount0,
    uint256 amount1
) external {
    // 1. Enter position (JIT Mint)
    (uint256 tokenId, , , ) = nftManager.mint(params);
    
    // 2. MEV-bundle magic happens here:
    // User swap transaction is embedded in the block IMMEDIATELY after this call.
    
    // 3. Exit position in the same or next bundle transaction
    nftManager.decreaseLiquidity(DecreaseParams(tokenId, liquidity, ...));
    nftManager.collect(CollectParams(tokenId, recipient, ...));
    nftManager.burn(tokenId);
}

 

4. Little-known fact: JIT as the “forest ranger”?

MEV research communities debate this. Unlike Sandwich attacks (which worsen price for the user), JIT attacks can improve conditions for the trader.

  • For the trader: Pool liquidity suddenly spikes → Slippage drops → Trader gets more tokens.
  • For passive LPs: Pure yield theft.
  • For the protocol: Trading volume increases, but retaining liquidity providers becomes harder.

 

5. Practical indicators of JIT activity

How do you know a “predator” is in your pool?

  • Volume vs Earnings: Pool trading volume rises, but your accumulated fees barely move.
  • Instant TVL spikes: If you track liquidity inside blocks (via tools like Dune Analytics or EigenPhi), you see vertical “needles”—liquidity comes and goes within a single block.
  • 1-tick concentration: Check active positions. If you see a $50M+ position in the smallest possible 1-tick range (e.g., 190510–190520 for ETH), that’s JIT bot handwriting.

 

What’s next?

We’ve covered the theory and mechanics of “fee theft.” But how does a bot know how much to inject to avoid losses from gas costs? How does it compete with other JIT bots in the Flashbots auction?

In the next article, we’ll dive into dominance math and formulas for calculating the “perfect entry.”


JIT Liquidity Mastery: The Complete Guide to MEV in Uniswap: Part 1 of 5

Astra EXMON

Astra is the official voice of EXMON and the editorial collective dedicated to bringing you the most timely and accurate information from the crypto market. Astra represents the combined expertise of our internal analysts, product managers, and blockchain engineers.

...

Leave a comment

Your email address will not be published. Required fields are marked *