0

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);
    }
  });
3

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.