How can a bundle rescue tokens from a wallet with a sweeper bot?
How to recover tokens from a compromised wallet with a sweeper bot: bundle exact gas funding with the token transfer so the bot cannot take the gas first.
Crypto News Newsroom3 min read

A Flashbots bundle can rescue ERC-20 tokens from a compromised wallet by combining a safe wallet’s gas funding with the token transfer in one block. This keeps the funding from sitting in the compromised wallet where the sweeper can take it first.
Say your leaked-key wallet holds 500 USDC and zero ETH. The sweeper watches the address and forwards incoming ETH as soon as it arrives. Since EIP-1559, each transaction pays its base fee in ETH from its own sender, so the USDC transfer needs ETH in the compromised wallet to pay gas.
MetaMask users may encounter Flashbots Protect when sending transactions privately. The linked topic, flashbots protect metamask, adds wallet-level context; rescuing tokens still requires the funding and transfer to be coordinated together.
How do you bundle gas funding with an ERC-20 transfer?
For the 500 USDC case, prepare two signed transactions: first, the safe wallet sends ETH to the compromised wallet; second, the compromised wallet transfers all 500 USDC to the safe wallet. Submit both together through the Flashbots Relay using eth_sendBundle, targeting upcoming blocks.
Set the first transaction’s ETH amount to the token transaction’s gas limit multiplied by its max fee per gas. This funds the maximum gas cost allowed by that transaction’s fee settings. The safe wallet also needs enough ETH to pay for its own funding transaction.
The bundle executes in order and lands all-or-nothing: the funding transaction runs immediately before the token transfer, or neither is included. That ordering gives the second transaction gas without leaving a public-mempool funding transfer for the sweeper to spot and take. The bundle is submitted privately rather than shown in the public mempool; inclusion in a particular block is not guaranteed.
Use a fresh safe wallet with ETH, sign transaction one from that wallet, then sign transaction two with the compromised key. Check the token transaction’s gas limit and max fee before calculating the funding amount. If the bundle is not included, submit it again for later target blocks while the tokens remain.
Funding exactly to the maximum gas cost matters because the actual fee can be lower. Any ETH left over stays in the compromised wallet after the bundle; the sweeper may take it in the next block. The goal is to move the tokens in the same bundle, not to leave gas there for later use.
Can Flashbots Protect RPC alone rescue tokens?
No. A private single transaction does not combine the safe wallet’s funding with a transfer from a different sender. Sending only the funding transaction through Protect can still leave ETH available for the sweeper before the token transfer is included. The bundle is what ties the two transactions together; the relay and MEV-Boost infrastructure provide a route for builders to consider it.
Are online token rescue tools safe to use?
Treat any service asking for the safe wallet’s seed phrase as a scam. A leaked private key cannot be made secret again, so use a newly created safe wallet and never enter its recovery words into a rescue site. Tokens already moved are gone from this wallet; tokens locked or claimable only after a delay may require the claim call inside the bundle, or may not be savable through this method.
When is the rescue complete?
The rescue is complete when the tokens appear in the safe wallet on Etherscan. Before resubmitting, verify the destination address and recalculate gas from the signed transfer’s limit and max fee; that check helps avoid leaving extra ETH for the sweeper to collect.