2

I want to send a transaction using web3, and I want this transaction to have the same nonce as other transactions - so far so good. The issue comes when I set a lower gasPrice than the other transactions. When I do this, I get an error:

Replacement transaction underpriced

I am aware that the transaction is underpriced compared to the existing ones, but still I want it to issue the transaction instead of throwing an error and messing up the whole program.

Is there a way to circumvent this? Should I use any other API for this purpose? or am I doomed to always be the highest bidder?

Thanks

1 Answer 1

3

It doesn't make any sense to send the same transaction with lower gasPrice: If both transactions are in mempool, the miners pick the transaction with the higher gasPrice (your first transaction), so there's no need to add the second one.

If, for whatever reasons, you really want to have the same transaction with lower gasPrice, you could do the following:

  • cancel the pending transaction - this costs gas, because it actually sends a 0 ETH transaction to itself, with a higher gasPrice than the original tx
  • re-submit the original tx (with its nonce increased ), with a lower gasPrice

I can't imagine any scenario where this would be of any help, but it's definitely possible.

2
  • Thank you for your wisdom. Believe it or not this case exists. Commented Feb 13, 2018 at 16:49
  • cool. I'm glad my answer helped you Commented Feb 13, 2018 at 18:10

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.