<p>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.</p>

CC BY-SA 4.0
2018-06-03T00:53:21.747Z
Not really understand it ... especially on poll for a status chain between blocks. can you further explain about that.
vincentsty
CC BY-SA 4.0
2018-06-03T00:56:09.823Z
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
CC BY-SA 4.0
2018-06-03T00:58:32.037Z
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
CC BY-SA 4.0
2018-06-02T23:33:13.773Z
2018-06-02T23:33:13.773Z
Raghav Sood
<p>I am sending bitcoin transaction in node js via <code>bitcore-lib</code> and <code>bitcore-explorers</code>.</p>

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

<p>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).</p>

<p>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.</p>

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

<p>And what function should i use to get transaction detail? I seems to not able to find query of transaction detail in bitcore library.</p>

<transactions><bitcoin-core>
Sync bitcoin transaction status to local database
vincentsty
# Sync bitcoin transaction status to local database

(Asked by: username_0 on 2018-06-02)

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.

**Tags:** transactions, bitcoin-core


---

## 1 answers

### Answer by username_1 on 2018-06-02. Score: 1

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.

> **Comments:**
> **username_0**: Not really understand it ... especially on poll for a status chain between blocks. can you further explain about that.  
> **username_1**: 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  
> **username_0**: 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  

---

