Sync bitcoin transaction status to local database I am sending bitcoin transaction in node js via bitcore-lib and bitcore-explorers.

I realized that when i call the function .broadcast to send the transaction to network and returns value, it means that the transaction is broadcasted but not completed.

What I want to ensure that when the transaction is in bitcoin network , I will need to write the status into local database (pending, success or fail).

I am thinking of looping and keep calling the transaction detail by txid until it is completed only it write to database. But thinking that bitcoin network transaction will take up to 30 minutes it might not be a good approach because the node server might take up a lot of resources in keep querying the transaction detail.

Any idea on what's the best practice to ensure that local database transaction detail and status in sync with the bitcoin network?

And what function should i use to get transaction detail? I seems to not able to find query of transaction detail in bitcore library.
Since you aren't running your own node, the best way would be to simply check each new block for your transaction. Since transactions can only be mined if a new block is generated, you don't need to poll for a status chain between blocks.