Web3.js docs state that a confirmation event will be fired:

  • 12 times when calling web3.eth.sendTransaction (see here)
  • 24 times when calling myContract.methods.myMethod.send (see here)

Why is the difference in the number of times that the event is fired in each case?

More importantly, what exactly should I use these events for?

At present, I simply await for the function to complete, and then use the returned value, which is a resolved Promise containing the transaction receipt (unless we're dealing with a contract deployment, in which case it will contain the new contract's instance).

To my understanding, this receipt can also be obtained using:

myContract.methods.myMethod().send().on('receipt', function(receipt){...});

I assume that this additional way of obtaining the receipt is for when you also want to handle other things, such as those confirmation events, which from what I've observed, do not necessarily occur before the receipt is available.

Do I need to count up 12 (or 24) events in order to be sure that the information receipt reflects the block-chain?

Thank you!

  • When your transaction is mined, receipt will become available.... this is confirmation 0, as more blocks added into blockchain.... confidence increases that your transaction is on longest chain and can’t be undone...
    – kherwa
    Commented Jun 18, 2018 at 15:08
  • @kherwa: Thank you. And does that confidence reach 100% after 12 (or 24) confirmation events? Or more generally, can the confidence level be measured as a function of the confirmation number? If yes, what exactly is the function? Also, does each confirmation event correspond to 1 block being added to the chain? Commented Jun 18, 2018 at 15:21
  • Yes each confirmation is a new block... it is upto you to wait for certain number of confirmations depending upon nature and sensitivity of transaction...
    – kherwa
    Commented Jun 18, 2018 at 15:37
  • @goodvibration so how you come up a solution, how are you making sure the transaction is completed. Commented Jan 31, 2019 at 14:09

2 Answers 2


When a transaction is mined, the receipt is available for use, at this point confirmation number is 0, as more block are added to the blockchain, confirmation number increases. With higher confirmation number, we will have more confidence that transaction is on the longest path and can’t be undone.

Suppose you accept transactions with a certain number of confirmations, you can filter that confirmation number on confirmation event.

.on('confirmation', function(confirmationNumber,receipt){})

Regarding why the event is emitted up to 12 and 24 confirmations in different scenarios, I do not have much idea.

  • 4
    A confirmation event is fired 24 times in both cases (I tested it). The "12" is an error in the docs. Thank you! Commented Jun 19, 2018 at 7:04

Sorry for jumping on a very old post how ever came across it looking for something else.

For those interested, the 24 confirmation events are being emitted due in fact to 24 being the default internal Web3 setting for number of acceptable confirmations. This setting can be set to a lower or higher confirmation count.

To read the current setting:


To change the setting:

web3.eth.transactionConfirmationBlocks = <new number>

See the Official Web3 documentation for further information here Web3

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.