0

I am trying to create a simple bot for sending transactions. what it does is that it sends multiple in successions with the same data but different nonce and a bit more gasPrice each time. In theory that's what you need to change in order for your transaction to be seen as completely new.

But my issue is that all transactions would stay pending forever on the nodes (i knew this by running a light client and using it as a provider). I would like to know why is this happening ? do I need to change the data on each transaction?

I tried changing the gas price up to 100Gwei in order to see if that would work but to no use.

is there something that i ma doing wrong ?

3
  • Are you following the "canceling" process described here ? : info.etherscan.com/how-to-cancel-ethereum-pending-transactions The trick to “cancel” your pending transaction is by replacing the transaction with another 0 ETH transaction with a higher gas fee sending to yourself with the same nonce as the pending transaction.
    – hroussille
    Oct 30, 2021 at 20:35
  • sending transactions with the same nonce to the same node will trigger an error. i think cancelling pending transactions is not the issue here, it's that all transactions sit at pending even with the highest gas fees. Oct 30, 2021 at 20:59
  • Are you sure about the error ? I thought changing priority of a transaction followed the same process.. Which network are you running against btw ? I suppose it's not the mainet , even though that could explain the forever pending state.
    – hroussille
    Oct 30, 2021 at 21:06

1 Answer 1

2

I looked a bit more into the tx processing in go ethereum.

First, a node holding a tx pool will replace an existing pending tx by another one if :

  1. Nonce is the same
  2. gasPrice is higher by at least 10% higher.

Implementation is here. So with your approach of changing nonce but higher gas price you are just flooding the tx pools.

Second thing that might directly explain your problem: if a tx with nonce n is pending, no transaction with nonce > n can proceed before (assuming the same sender, of course).

I am trying to create a simple bot for sending transactions. what it does is that it sends multiple in successions with the same data but different nonce and a bit more gasPrice each time.

So if your first transaction is pending because of too low gasPrice, no other transaction with higher nonce will proceed until you explicitly cancel / replace it. Same goes for second, third, etc...

1
  • thanks, i'll be checking this. if what you are saying is correct, i will need to account for the pending transactions and replace them by using the same nonce. Oct 31, 2021 at 13:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.