4

I'm new to programming and currently following a brownie tutorial. While interacting with smart contracts, my tutor puts a tx.wait(1) after every transaction that requires a state change of the contract. I'm guessing tx.wait(1) means that we tell brownie to wait for at least one confirmation of the transaction before proceeding further. But

  1. tx.wait(1) is not required after deploying a contract. Why don't we wait for a confirmation after deployment?
  2. my tutor skips tx.wait(1) during testing. why does it still work?

It is clear that I don't fully understand what tx.wait(1) actually does. Can someone please explain it to me? Or atleast point me towards some documentation about it? I'd really appreciate the help. TIA.

Navraj Sharma
  • 43
  • 1
  • 1
  • 5

1 Answers1

2

number of confirmations are required to finalize a transaction with high probability. Confirmations serve as an additional mechanism to ensure that there is probabilistically a very low chance for a transaction to be reverted, but otherwise, once a mined block is finalized and announced, the transactions within that block are final at that point. Bitcoin has 6 block confirmations. The key idea behind waiting for six confirmations is that the probability of double spending is virtually eliminated after six confirmations.

Yilmaz
  • 35,338
  • 10
  • 157
  • 202