How can I find the confirmation information in ethers.js api? I cannot find such kind of function.

  • 1
    What exactly does "confirmation information" mean? Please add some more context to your question, including the relevant part of your code. It is rather impossible to refer to it otherwise. – goodvibration Mar 15 at 14:28

The concept of "confirmations" is not native to the blockchain. It's a term used typically to refer to the amount of blocks which are mined on top of the block we're interested in. So if we want to know how many "confirmations" some transaction has we first in which block it was mined in and after that calculate the amount of blocks which were mined after that on top of that block - that's the amount of confirmations.

The term is typically used by exchanges and other parties which need a certain level of certainty for their transactions. With 0 confirmations it's quite likely that a transaction still gets reverted due to the blockchain's consensus mechanism. So typically exchanges require something like 5-10 confirmations before they accept a transaction to be final.

In theory no transaction is ever 100% final and in theory every block in the blockchain may still get reverted. But in reality something like 5 confirmations makes a block already almost 100% certain.

| improve this answer | |
  • thanks If I calculate the confirmation block number by myself for example I use the latest block number minus the block number of my transaction, I can get the confirmation number of blocks. But maybe my transaction has been taken out of the original block cannot be confirmed by other nodes so my original block will not include my transaction in this case do I need to: Confirmation_number=Latest_block.number-myblock.number If(Confirmation_number>5) Get my transaction from myblock to check again my transaction included – Louis Mar 16 at 0:18
  • A mined block will always include the same transactions. If a block gets reverted a new block will get formed (at some point) to include the same transactions and you have to find that/those block(s) again. – Lauri Peltonen Mar 16 at 6:29

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.