<p>I need to count the number of sent coins from an address to another address.</p>
<p>I found this API <a href="https://blockchain.info/rawaddr" rel="nofollow noreferrer">https://blockchain.info/rawaddr</a>, is it enough for me, using this method, to simply calculate the &quot;outputs&quot; of the transaction to the address?</p>
<p>JS Code example:</p>
<pre><code>const valueAddreses: IValueAddress = {};

axios.get(`https://blockchain.info/rawaddr/${address}`)
  .then((res) =&gt; {
    if (res.data.txs?.length) {
      res.data.txs.forEach((tx) =&gt; {
        tx.out.forEach((out) =&gt; {
          if (out.value &gt; 0 &amp;&amp; out.addr === findAddress) {
            if (!valueAddreses[out.addr]) {
              valueAddreses[out.addr] = {value: out.value};
            }

            valueAddreses[out.addr].value += out.value;
            valueAddreses[out.addr].valid = valueAddreses[out.addr].value &gt;= minLimitSat;
          }
        })
      });

      res.json(valueAddreses);
    }
  });
</code></pre>

CC BY-SA 4.0
2022-11-06T20:28:32.180Z
Does JavaScript support back ticks?
Mercedes
CC BY-SA 4.0
2022-11-07T05:45:32.533Z
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals
Vitaly
CC BY-SA 4.0
2022-11-18T15:42:05.290Z
What have you tried? Why don't you trust this code block?
Mercedes
<blockchain.info><api>
How to check the number of BTC sent from one address to another via API?
Vitaly
# How to check the number of BTC sent from one address to another via API?

(Asked by: username_0 on 2022-11-06)

I need to count the number of sent coins from an address to another address.
I found this API https://blockchain.info/rawaddr, is it enough for me, using this method, to simply calculate the "outputs" of the transaction to the address?
JS Code example:
const valueAddreses: IValueAddress = {};

axios.get(`https://blockchain.info/rawaddr/${address}`)
  .then((res) => {
    if (res.data.txs?.length) {
      res.data.txs.forEach((tx) => {
        tx.out.forEach((out) => {
          if (out.value > 0 && out.addr === findAddress) {
            if (!valueAddreses[out.addr]) {
              valueAddreses[out.addr] = {value: out.value};
            }

            valueAddreses[out.addr].value += out.value;
            valueAddreses[out.addr].valid = valueAddreses[out.addr].value >= minLimitSat;
          }
        })
      });

      res.json(valueAddreses);
    }
  });

**Tags:** blockchain.info, api

> **Comments:**
> **username_1**: Does JavaScript support back ticks?  
> **username_0**: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals  
> **username_1**: What have you tried? Why don't you trust this code block?  

---

## 0 answers

