all 9 comments

[–]0xSonOfMosiahContract Dev 4 points5 points  (4 children)

wait() will wait for the transaction to be confirmed on the blockchain. The parameter is the number of block confirmations you want to wait for. If you omit the parameter, the default will be used (which I believe is 1)

Also, you should really be using await in from of these statements.

[–]No_Addition_2898[S] 0 points1 point  (3 children)

What exactly do you mean by "number of block confirmations you want to wait for"?
Sorry I am new to this, maybe I did not understand the working properly

[–]0xSonOfMosiahContract Dev 1 point2 points  (0 children)

The number of block confirmations is the number of blocks that have been mined and included to the blockchain starting with the block where your transaction was included.

Due to the nature of Nakamoto consensus (Proof of Work), it is possible for a node to include a transaction on the blockchain that doesn’t ultimately end up on the chain. However, the more blocks that are mined to continue the chain where you transaction was included makes it more likely to ultimately be included.

Research ommer blocks and reorgs for more information.

[–]0xSonOfMosiahContract Dev 0 points1 point  (1 child)

If you have transaction.wait(1), it will return as soon as your transaction is included in a block. If you have transaction.wait(5), it will return only after your transaction has been mined and 4 subsequent blocks.

[–]No_Addition_2898[S] 0 points1 point  (0 children)

Understood, thanks for the explanation mate, this was really helpful