<p>I want to find all transactions of address in regtest. How it is possible to do?
I have this solution, but I get response (201) before for ends. I think it's bitcoin timeout false.</p>

<pre><code>    bitcoin.getReceivedByAddress(user_address).then ((current_balance) =&gt; {
        //get current address balance\
    //if balance has changed, check latest transactions
    if (current_balance &gt; 0) {
        bitcoin.getBlockCount().then ((n) =&gt;{

            for (let i = n; i &gt; current_balance !== 0 &amp;&amp; i &gt; 0; i--) {
            bitcoin.getBlockHash(i).then((hash) =&gt; {
                bitcoin.getBlock(hash).then( (block) =&gt; {
                for (let j in block.tx) {
                bitcoin.getTransaction(block.tx[j]).then ((transaction) =&gt; {
                    if (transaction.details[1].address === user_address
                &amp;&amp; transaction.details[1].category === "receive") {
                    current_balance -= transaction.details[1].amount;
                }

            });

            }


        });

        });

        }

    });
    }






}).then(() =&gt; {
        res.send(201);
    })
</code></pre>

CC BY-SA 3.0
2018-02-04T23:06:51.847Z
You should specify which library and api you are using.  "bitcoin api" is not enough information.
Jestin
CC BY-SA 3.0
2018-02-05T08:21:51.597Z
I use bitcoin core lib.
Agniezhk
CC BY-SA 3.0
2018-02-05T11:45:24.720Z
Welcome to Bitcoin.SE! Your question can be improved if you edit it and specify additional information to assist those researching an answer. More is generally better!
Willtech
<bitcoin-core><bitcoind><api><regtest><node.js>
How to get all transactions of address with bitcoin api in node.js?
Agniezhk
# How to get all transactions of address with bitcoin api in node.js?

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

I want to find all transactions of address in regtest. How it is possible to do?
I have this solution, but I get response (201) before for ends. I think it's bitcoin timeout false.

```
    bitcoin.getReceivedByAddress(user_address).then ((current_balance) => {
        //get current address balance\
    //if balance has changed, check latest transactions
    if (current_balance > 0) {
        bitcoin.getBlockCount().then ((n) =>{

            for (let i = n; i > current_balance !== 0 && i > 0; i--) {
            bitcoin.getBlockHash(i).then((hash) => {
                bitcoin.getBlock(hash).then( (block) => {
                for (let j in block.tx) {
                bitcoin.getTransaction(block.tx[j]).then ((transaction) => {
                    if (transaction.details[1].address === user_address
                && transaction.details[1].category === "receive") {
                    current_balance -= transaction.details[1].amount;
                }

            });

            }

        });

        });

        }

    });
    }

}).then(() => {
        res.send(201);
    })

```

**Tags:** bitcoin-core, bitcoind, api, regtest, node.js

> **Comments:**
> **username_1**: You should specify which library and api you are using.  "bitcoin api" is not enough information.  
> **username_0**: I use bitcoin core lib.  
> **username_2**: Welcome to Bitcoin.SE! Your question can be improved if you edit it and specify additional information to assist those researching an answer. More is generally better!  

---

## 0 answers

