What can someone do if a crypto wallet is compromised but the wallet owner is staking on such wallet still? The APY is coming in but we both curious how possible it can be to get the staked token after the period of staking is over, without ending with the hacker or whatever is fit for the drainer to be called.
If your friend's wallet (or private key) has been compromised and there is a sweeper bot set up that will automatically send all funds to the hacker's wallet, it is best to just abandon the wallet and create a new, clean one.
I don't know if there is actually a way to beat the bot manually, because in order for your transaction to have priority, you have to either be faster than the bot (which is impossible) or put a higher fee, which will probably be too expensive.
Also, check out my response to a member on a similar issue last year:
I've noticed that many members claim there's no solution when dealing with a sweeper bot that automatically executes transactions. However, I came across information stating that it is theoretically possible to create transactions that can perform both functions at the same time - funding the address with ETH to cover gas fees and withdrawing tokens from the address. Such a transaction would be executed in the same block, thereby preventing the sweeper bot from stealing the funds.
I'm not expert enough to provide you with precise instructions, but you can read this comment on the Ethereum Stack Exchange to learn more:
https://ethereum.stackexchange.com/a/112099You are in the correct path. MEV can do this for you.
You can use MEV to submit two transactions with the following properties:
Either both or none of them go through
They should be executed in the same block, next to each other
The first one adds Ethers to the wallet
The second one transfers the assets out
You pay the miners directly in Eth, disregarding any gas fees
The transactions are not broadcast publicly, but are sent privately to miner(s)
You can use Flashbots to accomplish this. If the total value of the assets is big enough, you can ask their whitehat hackers for assistance. Or you can do it yourself with their tooling, which requires some developer know-how.