0
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.
Not really understand it ... especially on poll for a status chain between blocks. can you further explain about that. – vincentsty – 2018-06-03T00:53:21.747
You don't need to do that. You simply need to check each new block. A transaction will not be mined unless there is a new block from when you last checked, so there is no need to do anything in between blocks – Raghav Sood – 2018-06-03T00:56:09.823
I see. But a new block only guaranteed a transaction is mined, does not guarantee a transaction is success right? It still could be a success or fail transaction. Between which function i can call to check new block / new transaction. I can't find it in bitcore librarly – vincentsty – 2018-06-03T00:58:32.037