scyclow / flashbot

MIT License
57 stars 49 forks source link

nonce too low #4

Closed hippke closed 1 year ago

hippke commented 1 year ago

Hey, thank you so much for this tool! I tried to recover a token but get an error "nonce too low" after "Try: 4". Is it possible that my raw transaction is somehow wrong or incomplete? I built a raw transaction on Etherscan by going to the token contract, connecting to Metamask, and entering target address and amount. The resulting raw transaction is 138 characters long, where as the one in your example is 203 characters.

After the failed run, I can actually see 3 new transactions on Etherscan: The first one providing my 0.0073294 as fee. That worked. The second which should initiate the transfer (but that didn't work). And the 3rd from a bot sweeping the address.

Any advice appreciated - I'd gladly tip you for your great work and assistance.

scyclow commented 1 year ago

It's hard for me to tell what the issue is, but maybe you need to increase the nonce from tx to tx? It kind of sounds like the first tx is working, then the nonce isn't being increased so the second one fails, and then the bot drains the address. Sorry I can't offer much help here, but it's been a while since I've run this code. I don't think this was anything I ran into though.

I'd happily accept any tips to steviep.eth, but zero pressure or obligation 🙂

hippke commented 1 year ago

How would I increase the nonce? Can't see any place in the script... Tried it another time, it failed after the 9th try with the same error:


{
  message: 'err: nonce too low: address 0xdB240F2Cbc36f34Aa7a6f4df9519AE4F78B90702, tx: 4 state: 6; txhash 0x066bbbfc6893b98af347d86eefc049dc3155e1573e8fb1485d4d95ee8d090fe2',
  code: -32000
}
scyclow commented 1 year ago

You'll have to check the fb docs, but I bet if you add a nonce property to your tx it will work https://github.com/scyclow/flashbot/blob/master/src/index.ts#L88

Also, in general I recommend running a bunch of tests on a testnet until you have something you're confident will work.