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
Best Answer
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 highergasPrice
(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:
nonce
increased ), with a lowergasPrice
I can't imagine any scenario where this would be of any help, but it's definitely possible.