Block waiting confusion.. #2109
-
Or
the difference in upper two statements are |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 8 replies
-
Beta Was this translation helpful? Give feedback.
-
Hey @MasterofBlockchain as we know, the code |
Beta Was this translation helpful? Give feedback.
-
Why do we need to mine those transactions? Well, that is precisely how transactions work in a blockchain, they need to be mined for them to go through. So, we are confirming the withdrawal transaction Hence, the high gas fees when the network is congested with many transactions as they need to be mined. (which leads to a low supply of miners mining the same amount of transactions, hence the high cost of gas fees) |
Beta Was this translation helpful? Give feedback.
Hey @MasterofBlockchain as we know, the code
await FundMe.withdrawal()
executes the withdraw function but it also returns a transaction receipt (in the form of a promise). So doingconst tx = await FundMe.withdrawal()
actually captures the txReceipt if you want to use it. Part of the methods that comes with the transaction receipt is thewait()
function/method. The syntax for.wait()
istransaction.wait(Number of confirmations)
What the
.wait()
method does is that we are telling hardhat to wait for whatever confirmations we put inside the bracket to resolve the transaction receipt. So if we put.wait(2)
we are saying that we want to wait until our transaction has been confirmed in2
mined…