0

I am on the kovan network and use web3 to execute transactions and query the blockchain. If I send many requests in short time intervals (1-15 seconds) one after the other, I get several errors >70% of my transactions fail! Here is the error I get:

Error: Returned error: Transaction gas price is too low. There is another transaction with same nonce in the queue. Try increasing the gas price or incrementing the nonce.

Error: Returned error: Transaction nonce is too low. Try incrementing the nonce.

If I send a transaction every 20 seconds, every transaction works! Is this a problem of the kovan network or something else? What is the best way to improve this?

1 Answer 1

1

You need to read a bit more about what is nonce: What is nonce in Ethereum? How does it prevent double spending?

The most likely reason is that since the previous transaction is not mined yet, the account nonce is yet to increase, hence you new transaction would likely fail (unless you use higher gas as a replacement transaction.

The better pattern is that you would need to wait for previous transaction to be mined, by polling web3.eth.getTransactionReceipt and check the status, then you send a new transaction. Or you may also increase nonce yourself for next transactions.

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.