Understand how transaction ordering affects crypto swaps, how minimum-output limits work and what private routing can and cannot protect against.
Key Notes
- Transaction ordering can worsen a swap without changing its signed instructions or compromising the wallet key.
- Minimum-output limits constrain acceptable execution, while tighter settings can increase the chance of a failed swap.
- Private routing reduces public-mempool exposure but still involves service trust and does not fix bad quotes or unsafe approvals.
A decentralized exchange can show a reasonable quote and still deliver a worse result when the swap reaches the blockchain. Markets move, pool balances change and transaction ordering can work against the trader. MEV is one reason that the route from signing to execution matters.
This guide explains maximal extractable value, sandwich attacks and the controls available to ordinary users. It focuses on Ethereum-style swaps, while recognizing that transaction-ordering systems differ across networks. The worked examples use invented token amounts, not live prices or a promise that any particular protection will eliminate losses.
What MEV Means for a Swap
MEV stands for maximal extractable value. Ethereum’s MEV overview describes value associated with including, excluding or changing the order of transactions beyond ordinary block rewards and fees.
Transaction order matters because contracts execute against the state left by earlier transactions. A purchase can move a pool’s price before another purchase executes. Knowing about a pending trade can therefore be commercially valuable even without access to the trader’s private key.
Not every MEV activity is a sandwich attack. Arbitrage can move prices between markets toward alignment, and liquidation activity can help lending protocols enforce collateral rules. The same broad category also includes strategies that worsen a particular user’s execution.
Several actors can be involved: searchers identify opportunities, builders arrange transactions into blocks, and validators participate in block production. Their roles do not mean every participant is attacking users. The practical question is whether your submitted trade exposes an opportunity and what execution constraints limit the result.
How a Sandwich Attack Changes the Order
A sandwich strategy places a trader’s swap between other trades. ESMA’s MEV research examines front-running, back-running and sandwiching as distinct ordering strategies.
In a simplified case, someone observes a pending purchase and arranges a purchase before it. The victim’s transaction then executes against the changed pool balance. A subsequent sale unwinds the earlier position after the victim has traded. The strategy seeks to profit from the intervening price movement, after accounting for its own costs.
The attacker does not need to alter the victim’s signed minimum-output instruction for this to be harmful. A transaction can obey its programmed limits and still execute near the least favorable result the user allowed.
This is different from a wallet drainer, which abuses signatures or permissions to move assets. It is also different from an ordinary market move while a transaction is pending. A worse fill alone cannot identify which explanation applies. Keep the distinction in mind before treating an execution problem as proof that a wallet key was stolen.
Separate Price Impact, Slippage and Tolerance
Price impact is the effect of your own trade on the market or pool. Slippage compares the expected execution with the actual result. Slippage tolerance is a constraint on how far the result may deteriorate before the swap should fail.
Uniswap’s slippage explanation describes how market movement, liquidity and trade size affect execution. Our liquidity-pool guide explains why a large swap relative to pool depth can be expensive before any attack occurs.
A generous tolerance does not cause an attacker to appear, but it can leave more room for unfavorable execution. Tightening it may reduce that room while increasing the chance that a legitimate market change causes the transaction to revert.
There is no universal percentage suitable for every asset and network. Read the actual minimum received or maximum spent, then decide whether that outcome is acceptable. A percentage is easy to overlook; the number of tokens you are willing to receive is a more concrete limit.
A Worked Minimum-Output Example
Imagine an exact-input swap quoted to return 1,000 units of token B. You choose a hard minimum of 995 units. The five-unit gap is 0.5% of the quoted output. This arithmetic illustrates a chosen minimum; interfaces and SDKs can calculate percentage-based settings differently.
| Scenario | Output available at execution | Result with a 995-unit minimum |
|---|---|---|
| Quote remains available | 1,000 units | Within the limit |
| Small adverse movement | 997 units | Within the limit |
| Larger adverse movement | 994 units | Below the limit; swap should revert |
Uniswap’s swap documentation explains minimum-output guards for exact-input trades, maximum-input guards for exact-output trades and transaction deadlines. A deadline limits how late the swap remains valid; it is not an instruction to execute at the original price.
If you lower the minimum to 980 units merely to make the transaction succeed, you have accepted a materially worse outcome. A 981-unit fill would then satisfy that lower constraint, although it would fail the earlier one. Neither outcome proves an attack occurred.
A reverted on-chain swap can still consume gas. Keep network costs separate from token output when assessing the total result. Our gas-fee guide covers this distinction.
What Private Transaction Routing Can Protect
A private route can keep a pending transaction out of the public mempool, reducing exposure to bots monitoring that public queue. Flashbots Protect’s quick start describes this approach for Ethereum, alongside configurable execution and refund features.
Check whether your wallet or trading application actually sends the relevant request through the protected route. A protection label elsewhere in an app does not establish how every network, transaction type or fallback is handled.
Private submission also changes who receives the transaction before settlement. Flashbots’ settings guide explains builder sharing and data hints, and notes that sharing with additional builders involves trusting those builders. Privacy, speed and potential refunds can involve different settings.
Keeping a transaction out of a public queue does not make its eventual blockchain record confidential. It also does not fix a bad quote, a malicious token or an unsafe approval. Continue to set acceptable execution limits and verify the destination contract even when a private route is enabled.
Compare Other Execution Methods by Their Actual Terms
Some systems ask you to sign an order describing an acceptable outcome instead of submitting a conventional swap directly. Fillers or solvers then compete to execute it under the order’s rules.
The UniswapX documentation, for example, describes signed orders and competing fillers. Auction parameters and price tolerance determine the acceptable result. It also makes clear that its signed order messages can be broadcast publicly: an intent-based design should not automatically be described as a private mempool.
Compare the final amount received, validity period, approval requirements, cancellation process and all service charges. A headline benefit such as gas-free swapping does not mean that approvals, every surrounding transaction or every possible route are costless.
A limit order may provide a different way to specify an acceptable price, but it can remain unfilled. Splitting a large trade can change price impact while adding fees and exposure across several transactions. Neither is a universal cure. Our order-types guide explains execution certainty and price constraints.
A simple comparison can expose misleading headline quotes. Suppose route A offers 1,000 output tokens with estimated costs equivalent to four tokens, while route B offers 998 with costs equivalent to one. Using the same hypothetical valuation, the net comparison is 996 versus 997. Route B has the smaller headline output but the larger estimated net amount. Real network fees may be paid in another currency, so use a consistent reference value and recognize that both estimates can change.
Keep any potential refund separate from that comparison unless its amount and conditions are established. An advertised refund opportunity does not guarantee a payment to your address, and a refund received later cannot repair an execution limit you were unwilling to accept.
Investigate a Bad Fill Before Retrying
Save the quote, minimum output, route, transaction hash and final token movements. Use the correct network’s explorer to inspect what actually happened. Neighboring trades and relevant pool changes can support an investigation, but a bot label or an unfavorable output is not conclusive proof of sandwiching.
Check whether the transaction succeeded, reverted or remains pending. If it is pending privately, a public explorer may not yet know about it. Follow the wallet or service’s documented status and cancellation process rather than submitting another independent swap immediately.
Flashbots’ cancellation guidance describes a specific mechanism for pending Protect transactions. That process is not a reversal of a completed swap and should not be generalized to every wallet or network.
Before retrying, refresh the quote and reassess liquidity. Raising tolerance repeatedly can turn a useful refusal to execute into a much worse accepted trade. If you suspect malicious permissions rather than ordering, review allowances separately using our approval guide.
A Pre-Swap Checklist for Better Execution
- Match the network and exact token contracts.
- Compare quotes for the same input size and account for all fees.
- Read price impact separately from slippage tolerance.
- Accept the displayed minimum output only if you can tolerate that result.
- Check the submission route and any public-broadcast fallback.
- Inspect signatures, allowances and order expiry.
- Wait for a resolved status before retrying or changing execution methods.
Good protection combines sensible trade size, clear limits and an understood submission path. No label substitutes for knowing the least favorable result you have authorized.
Disclaimer: CoinScreamer is an independent media brand owned and operated by NuvexMedia LLC, publishing news, research, and market insights on digital assets and related technologies. NuvexMedia LLC invests in and collaborates with companies across the digital asset, blockchain, and technology sectors. These relationships do not influence CoinScreamer’s editorial coverage, and the publication maintains full editorial independence to provide accurate, timely, and objective information. © 2025 NuvexMedia LLC. All rights reserved. This content is for informational purposes only and should not be considered legal, tax, investment, financial, or other professional advice.