Class take 2-5 minutes to be confirmed

The class takes 3-5 minutes to be confirmed (True) while the transaction on https://rinkeby.etherscan.io has been confirmed. so, ‘afterSave’ webhook will be called 2 times.

what is the question? isn’t that the expected behaviour?

it is considered as confirmed after it was confirmed by a number of blocks, not when it is first included in blockchain

that lead an error to my method that was going to be called “adding that item to my our marketplace”, instantly after the item is created.

I don’t understand why the “confirmed” column did not update to be TRUE since the transaction on etherscan has been confirmed.

what you mean by a transaction on etherscan to be confirmed?

He means that the transaction on etherscan is already confirmed, while it still takes 2-5 minutes for the confirmed column to become true.

I think moralis does this to give as accurate info as possible, no? (since small forks can happen and the transaction can get deleted)

2 Likes

As mentioned by @kone

that is the expected behaviour, we wait a specific number of blocks until we consider a transaction as confirmed. if you want to consider it as confirmed faster you can ignore that confirmed flag and use your own number of blocks to consider it as confirmed after it is added as unconfirmed (you’ll have to write some code for that)

hi @cryptokid, can oyu share the amount of blocks Moralis waits before flipping to to confirmed state?

It depends on the chain, you can view the number of confirmations for some here - not sure if they’re up to date. You can research this.

Thanks @glad for the info. it does seem a bit extreme for Polygon to be at 100 confirmations. One of the benefits of being on an L2 like Polygon is to take advantage of the faster tx times, but this essentially make it at L1 speeds - my tests yesterday took ~9 minutes to achieve the 100 confirmations.

Is there any way to lower this threshold?

There isn’t a way on our side. You can track the original unconfirmed event and wait less time until you check if it is confirmed.

Soon there will be streams API that you could also use