2

Can Someone please explain what does tx.wait(1) do? And also what does it mean by block confirmations?

1 Answer 1

4

tx.wait(1) means that it will wait until your transaction is confirmed in 1 block;

Block confirmations is the amount of blocks that have been added to the blockchain after your transaction was included in a block(mined)

My response comes from here

2
  • So, basically when I initiate a trasaction, my transaction gets included in a block and then it waits for those no.(here, 1) of blocks to get added to the blockchain and only after that my block gets added to the blockchain.. right? or am I missing something? Nov 5, 2022 at 14:05
  • Nope, when you initiate a transaction it gets to a "miners pool", it is a storage of all pending transactions and its usually handled by your RPC provider ie. Alchemy; Once your TX is in the pool its basically waiting for miners to include it in a block. so the tx.wait(1) is making the execution of your code to wait until the TX is been taken from the pool by miners and included in a block. if you store the return of tx.wait(1) you will be getting a transaction receipt const receipt = await tx.wait(1)
    – Casareafer
    Nov 7, 2022 at 3:14

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.