I tested sending multiple transactions with a low time gap, and I knew that they will wait for previous transactions to be confirmed. I did not use Nonce in the transaction code as it is optional. But I would like to know, is there any way to send transactions without waiting for confirmation of previous ones?
I thought about using nonce = getTransactionCount() + 1, although, I am not sure is it correct or not? and which condition I have to set in it amoung latest, earliest or pending for this solution.


I thought about using nonce = getTransactionCount() + 1

Web3.js does it for you if you do not specify nonce explicitly, so it won't make any difference.

Is there any way to send transactions without waiting for confirmation of previous ones?

Yes, exactly as you described it (sending them without waiting for confirmation of previous ones).

  • Thanks for reply. Do you mean I should not do anything special to achieve my goal? – Mohammad Saberi Apr 14 '20 at 10:35
  • @MohammadSaberi: Yup, simply don't wait for confirmation. Just keep the transaction hash (which is returned to you pretty much instantly), and check it later. Alternatively you can just check the state variables that your transactions change (assuming that each transaction independently changes something in the state). – goodvibration Apr 14 '20 at 10:37
  • Your direct and clear answer help me a lot. Thank you – Mohammad Saberi Apr 14 '20 at 10:39
  • @MohammadSaberi: You're welcome. Note that in this scheme you WILL need to increment the nonce explicitly, but WITHOUT relying on getTransactionCount for that (i.e., use your own internal counter). – goodvibration Apr 14 '20 at 10:39
  • 1
    @MohammadSaberi: Web3 does it automatically (setting nonce to the value returned by getTransactionCount). But the nonce of your account will not really increment until the transaction is added to the blockchain, and until that happens, getTransactionCount will return the same value. – goodvibration Apr 14 '20 at 11:57

You can increment Nonce "manually", do an internal control. You can make an array of sendSignedTransactions and after solving with Promise.all, one of the alternatives. As far as I know the queue supports up to 64 transactions.

At least on the Rinkeby network, you only receive the receipt when the next block is mined, so you would have the bottleneck of 4 transactions per minute.

Sending multiple chain events will require complicated logic if an error occurs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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