UNSWEEP › Guides
Sweeper bot on a hacked wallet: why sending gas is risky and how a one-transaction rescue works
This guide is informational. Funds already moved out of a compromised wallet cannot be recovered. A rescue can only try to move assets that are still in the wallet, and it is not guaranteed to succeed.
Check any address first with the free, read-only diagnostic: https://unsweep.com/ (no keys, no signatures).
Current scope of UNSWEEP: Base: 16 verified tokens. Arbitrum: 12 verified tokens. Other ERC-20 tokens may be detected, but without any guarantee. Ethereum: read-only diagnostic only (no rescue). Funds already taken cannot be recovered, and NFTs are not rescued. See what can and cannot be rescued and the step-by-step rescue guide. Start with the free diagnostic.
What a sweeper bot is
A wallet (an externally-owned account, EOA) is controlled by whoever has its private key. Ethereum's documentation describes an EOA as “controlled by anyone with the private keys” and says the private key “is what you use to sign transactions, so it grants you custody over the funds associated with your account” (ethereum.org – Accounts).
When an attacker obtains that key, the attacker can sign transactions from the wallet exactly as the owner can. A sweeper bot is an automated program run by the attacker that watches the compromised address and tries to sign a transfer out as soon as value arrives. The network cannot tell the owner and the attacker apart: both hold a valid key.
Why sending gas to a compromised wallet is risky
Every transaction must pay a fee in ETH. Per Ethereum's documentation: “Gas fees have to be paid in Ethereum's native currency, ether (ETH)”, and the sender is “the externally owned account that sends the transaction, pays for gas” (ethereum.org – Gas).
So to move tokens out of the wallet in the usual way, the owner must first send ETH to it. That ETH is exactly what the sweeper is waiting for. The attacker can also bid for ordering: “tips allow users to outbid others for priority within the same block” and “a higher tip can make it more likely that your transaction will get into the next block” (ethereum.org – Gas). A higher tip improves the chance of earlier inclusion; it does not guarantee that the attacker's transfer runs first or instantly. Even so, any ETH that lands in the wallet can be spent by whoever holds the key, so the attacker may take it before the owner's token transfer uses it. That is why sending ETH for gas to a swept wallet is not recommended.
How a one-transaction rescue works
The idea is to never put ETH in the compromised wallet. EIP-7702 (status: Final) lists among its motivations:
- Sponsorship: “account X pays for a transaction on behalf of account Y”.
- Batching: “allowing multiple operations from the same user in one atomic transaction”.
EIP-7702 adds a transaction type (SET_CODE_TX_TYPE = 0x04) carrying an authorization_list of tuples [chain_id, address, nonce, y_parity, r, s]. The account that is delegated is recovered from the signature: “Let authority = ecrecover(msg, y_parity, r, s)” (EIP-7702 – Specification). This means:
- The owner of the compromised wallet signs an authorization locally, on their own device. The private key is never shared or uploaded.
- A separate, clean account submits the type-
0x04transaction and pays the gas. The compromised wallet receives no ETH, so there is nothing for the sweeper to take. - Inside that single atomic transaction, the delegated code moves the remaining tokens to a safe address chosen by the owner. If execution fails, the token transfers in it are undone, but an authorization that was already processed is not rolled back: the wallet can remain delegated even after a failed rescue, so a failed attempt is not evidence that the wallet has no delegation. Check the wallet's code again afterwards (EIP-7702 – Behavior).
Limits to be aware of: the attacker still holds the key and can sign their own transactions, including their own authorizations, so the outcome is a race that is not guaranteed. This only works on networks where EIP-7702 is active, and only for assets that are still in the wallet.
Before anything else
- Never send ETH “for gas” to a wallet that is being swept.
- Never paste a seed phrase, or the key of a wallet that is still safe, into a website or share it with anyone. Ethereum's documentation: “It is vital to keep your private keys safe and, as the name suggests, PRIVATE” (ethereum.org – Accounts).
- Treat the compromised key as permanently burned and use a new wallet afterwards.
Start with the free diagnostic to see what is still in the wallet and whether a delegation is set: https://unsweep.com/.
Related: Malicious EIP-7702 delegation: detect and revoke · Compromised wallet checklist
Sources: EIP-7702 · ethereum.org Accounts · ethereum.org Gas
Related guides: Why ETH sent for gas gets stolen immediately · Rescue USDC and WETH from a hacked wallet on Base · Rescue tokens from a hacked wallet on Arbitrum · Sweeper bot vs malicious EIP-7702 delegation · How to check if a wallet has a sweeper bot · What to do in the first 5 minutes after a wallet hack · Malicious EIP-7702 delegation · Step-by-step rescue · What can and cannot be rescued
MetaMask is a trademark of its owner, referenced descriptively; UNSWEEP is not affiliated with MetaMask or Consensys.
Before you start: trust facts
Sounds familiar? “My funds disappear as soon as they arrive” · “I can’t pay for gas because the ETH is taken instantly” · “My wallet was hacked and I can’t get my tokens out”.
- Open source: github.com/unsweep/unsweep. Rescue contract
0x38bcF425bC4d13624734e09376F2fafc799fA8c8, source verified on Sourcify (exact match): Base · Arbitrum · Basescan. - Which key, and where it goes: a rescue uses only the private key of the wallet that is already compromised, the one the attacker already has. Never your seed phrase and never the key of your new safe wallet. The key signs 100% inside your browser and is never sent to UNSWEEP or any server; only signatures are sent (see the exact signing code on GitHub). Check it yourself: open DevTools → Network before signing, and see the verified contract on Basescan. UNSWEEP never writes to you first.
- We never DM you: UNSWEEP never contacts anyone by DM, Telegram or Discord. Anyone who does is a scammer.
- Cost: free diagnostic, no upfront payment. Success fee only if the rescue executes, taken from the rescued tokens in the same transaction: 15% (<1,000 USD), 10% (1,000–10,000 USD), 5% (>10,000 USD); hard 15% maximum in the contract; shown in a simulation before you sign.
- Cannot rescue: funds already taken, NFTs, anything on Ethereum mainnet (read-only). Tokens outside the verified lists may be detected without guarantee. Nothing is guaranteed.