The problem: One of your wallets has been compromised, and any ETH you put on ther is siphoned off immediately. You would like to retrieve some assets or transfer contract ownership, but that all costs gas and your gas tank is stuck on empty.
The solution: Flashbots!
The code for this repo provides an example of how
This is the actual code I used (with added comments) to recover assets from a compromised wallet
Most of this code was taken from the example provided by https://www.youtube.com/watch?v=1ve1YIpDs_I
npm install
secrets.json
, which is included in this repo's .gitignoreINFURA_KEY=<...> FUNDING_WALLET_PRIVATE_KEY=<...> COMPROMISED_WALLET_PRIVATE_KEY=<...> npm run start