<p>There is a better API, and it is the Bitcoin core API. You get all the data you require there. Blockchain.info must probably also be using the core API's (or they must have made a parser to parse the binary data of the blockchain on the machine running the full node). Using the core API's and the corresponding bindings present for various programming languages, you can access all the data from the blockchain you need. </p>

<p>There seems to be no txid field above but there's one tx_index which refers to that hex. You can get the number of BTC's in that transaction (input and output) by using the core api <code>getrawtransaction</code>(to access non-wallet transactions, you need to rebuild your blockchain after adding the line txindex=1 in the conf file and restarting the server with -reindex option)</p>

CC BY-SA 3.0
2016-11-02T15:07:49.130Z
2016-11-02T15:07:49.130Z
Shabahat M. Ayubi
<p><a href="https://www.blockonomics.co/views/api.html#history" rel="nofollow noreferrer">Blockonomics api</a> has history api call that returns transaction history of multiple bitcoin addresses considering them part of the same wallet. In input you can give all your five addresses and parse the value of the JSON output. In case of outgoing transaction; value will be negative, else value will be positive.</p>

CC BY-SA 3.0
2016-11-03T07:55:56.830Z
2016-11-03T07:55:56.830Z
dark knight
<p>I am building myself an alert program with which I want to send myself an alert via email if there are transactions ongoing at all (5) of my addresses.</p>

<p>I have chosen the Blockchain API because I couldn't find anything better for this.</p>

<p>How can I find out if this transaction is an incoming or outgoing transaction? This JSON below is one transaction from a few which i get return with the Request: <a href="https://blockchain.info/de/address/1MLnfxu3AicGcpBS4MbevCCQP8WSftkXj8?format=json" rel="nofollow noreferrer">https://blockchain.info/de/address/1MLnfxu3AicGcpBS4MbevCCQP8WSftkXj8?format=json</a></p>

<p>Also where can I find out how many BTCs are transferred in this one transaction.</p>

<p>FYI, I write a script in Python. I could parse all the 'value' values and add them together. Also i could check if my provided address, if it is in 'inputs' or in 'out'.</p>

<p>But isn't there a better way? Or are some better APIs out there for this?</p>

<pre><code>{
   "ver":1,
   "inputs":[
      {
         "sequence":4294967295,
         "prev_out":{
            "spent":true,
            "tx_index":182562706,
            "type":0,
            "addr":"3NSHD5zB9wCMfoVXsuS9v8d6PcnKxDFKeg",
            "value":40000,
            "n":1,
            "script":"a914e3912957c315153f65bfef4322af64188ba7cdc487"
         },
         "script":"00473044022039d16bf80101ce331e93f8dd8d24e8770e3d7a8e367f2e54a86d2f4153ea5d99022048bff03a37f39180ac3b18d8619f6d450a4b3ec9ebf4bf24f598b16348187e550147304402203df2d77fefe694a5b58a1c77af3d73c75eab5bbe36fec3c1c7364fc7b9f4b367022048a80b164ada45a4b734586e6e6f2f3f624415287a346ef84bc3c6b63e67808f0147522102265981c8d731915bee94597c8f7fce92819ab37245b9c6b1f2f011015161adf02103c511b8fe3a5e60ad16bb14b0865f8a3f192ddb386c4f8d23f72edd24764e0e2352ae"
      },
      {
         "sequence":4294967295,
         "prev_out":{
            "spent":true,
            "tx_index":183105717,
            "type":0,
            "addr":"3NSHD5zB9wCMfoVXsuS9v8d6PcnKxDFKeg",
            "value":14980000,
            "n":0,
            "script":"a914e3912957c315153f65bfef4322af64188ba7cdc487"
         },
         "script":"0047304402202ec3a4c1bf1aa386f8db24e2ec0434f5224890ea9c510b067f03a39c1d69325a0220154ffb2d6f54875faa0ee2de10a78ace2fff30595a88732937e2827bddeab1ea01483045022100e8ee555d0cdf09a7803fbffdca4da3498393748f1ff52f10abfbfe6920bc118702202f7ffc9ff6289cfc17e26004298d6ce4379451fd3cb29399d7adf30e704dc10e0147522102265981c8d731915bee94597c8f7fce92819ab37245b9c6b1f2f011015161adf02103c511b8fe3a5e60ad16bb14b0865f8a3f192ddb386c4f8d23f72edd24764e0e2352ae"
      }
   ],
   "block_height":436110,
   "relayed_by":"176.126.247.116",
   "out":[
      {
         "spent":true,
         "tx_index":185011579,
         "type":0,
         "addr":"1PHdd9DpdHtxNeVeqkEbBu1pBoDcTws6kx",
         "value":5066000,
         "n":0,
         "script":"76a914f477fe7c4a0fce5dbc7c174ba2ab5d9ab27fe91d88ac"
      },
      {
         "spent":false,
         "tx_index":185011579,
         "type":0,
         "addr":"1MLnfxu3AicGcpBS4MbevCCQP8WSftkXj8",
         "value":9834000,
         "n":1,
         "script":"76a914df208b39050b2a3f1166216efda0855cc4df8aae88ac"
      },
      {
         "spent":false,
         "tx_index":185011579,
         "type":0,
         "addr":"3NSHD5zB9wCMfoVXsuS9v8d6PcnKxDFKeg",
         "value":60000,
         "n":2,
         "script":"a914e3912957c315153f65bfef4322af64188ba7cdc487"
      }
   ],
   "lock_time":0,
   "result":99980000,
   "size":627,
   "time":1477558874,
   "tx_index":185011579,
   "vin_sz":2,
   "hash":"1806396e0a7fa220d5626dae7ee4a5caa3b35d333f1885d25a440d256701bba4",
   "vout_sz":3
}
</code></pre>

<blockchain><api><blockchain.info><python>
Type and Amount of Transaction in Blockchain API
Daniel S.
# Type and Amount of Transaction in Blockchain API

(Asked by: username_0 on 2016-11-01)

I am building myself an alert program with which I want to send myself an alert via email if there are transactions ongoing at all (5) of my addresses.

I have chosen the Blockchain API because I couldn't find anything better for this.

How can I find out if this transaction is an incoming or outgoing transaction? This JSON below is one transaction from a few which i get return with the Request: <https://blockchain.info/de/address/1MLnfxu3AicGcpBS4MbevCCQP8WSftkXj8?format=json>

Also where can I find out how many BTCs are transferred in this one transaction.

FYI, I write a script in Python. I could parse all the 'value' values and add them together. Also i could check if my provided address, if it is in 'inputs' or in 'out'.

But isn't there a better way? Or are some better APIs out there for this?

```
{
   "ver":1,
   "inputs":[
      {
         "sequence":4294967295,
         "prev_out":{
            "spent":true,
            "tx_index":182562706,
            "type":0,
            "addr":"3NSHD5zB9wCMfoVXsuS9v8d6PcnKxDFKeg",
            "value":40000,
            "n":1,
            "script":"a914e3912957c315153f65bfef4322af64188ba7cdc487"
         },
         "script":"00473044022039d16bf80101ce331e93f8dd8d24e8770e3d7a8e367f2e54a86d2f4153ea5d99022048bff03a37f39180ac3b18d8619f6d450a4b3ec9ebf4bf24f598b16348187e550147304402203df2d77fefe694a5b58a1c77af3d73c75eab5bbe36fec3c1c7364fc7b9f4b367022048a80b164ada45a4b734586e6e6f2f3f624415287a346ef84bc3c6b63e67808f0147522102265981c8d731915bee94597c8f7fce92819ab37245b9c6b1f2f011015161adf02103c511b8fe3a5e60ad16bb14b0865f8a3f192ddb386c4f8d23f72edd24764e0e2352ae"
      },
      {
         "sequence":4294967295,
         "prev_out":{
            "spent":true,
            "tx_index":183105717,
            "type":0,
            "addr":"3NSHD5zB9wCMfoVXsuS9v8d6PcnKxDFKeg",
            "value":14980000,
            "n":0,
            "script":"a914e3912957c315153f65bfef4322af64188ba7cdc487"
         },
         "script":"0047304402202ec3a4c1bf1aa386f8db24e2ec0434f5224890ea9c510b067f03a39c1d69325a0220154ffb2d6f54875faa0ee2de10a78ace2fff30595a88732937e2827bddeab1ea01483045022100e8ee555d0cdf09a7803fbffdca4da3498393748f1ff52f10abfbfe6920bc118702202f7ffc9ff6289cfc17e26004298d6ce4379451fd3cb29399d7adf30e704dc10e0147522102265981c8d731915bee94597c8f7fce92819ab37245b9c6b1f2f011015161adf02103c511b8fe3a5e60ad16bb14b0865f8a3f192ddb386c4f8d23f72edd24764e0e2352ae"
      }
   ],
   "block_height":436110,
   "relayed_by":"176.126.247.116",
   "out":[
      {
         "spent":true,
         "tx_index":185011579,
         "type":0,
         "addr":"1PHdd9DpdHtxNeVeqkEbBu1pBoDcTws6kx",
         "value":5066000,
         "n":0,
         "script":"76a914f477fe7c4a0fce5dbc7c174ba2ab5d9ab27fe91d88ac"
      },
      {
         "spent":false,
         "tx_index":185011579,
         "type":0,
         "addr":"1MLnfxu3AicGcpBS4MbevCCQP8WSftkXj8",
         "value":9834000,
         "n":1,
         "script":"76a914df208b39050b2a3f1166216efda0855cc4df8aae88ac"
      },
      {
         "spent":false,
         "tx_index":185011579,
         "type":0,
         "addr":"3NSHD5zB9wCMfoVXsuS9v8d6PcnKxDFKeg",
         "value":60000,
         "n":2,
         "script":"a914e3912957c315153f65bfef4322af64188ba7cdc487"
      }
   ],
   "lock_time":0,
   "result":99980000,
   "size":627,
   "time":1477558874,
   "tx_index":185011579,
   "vin_sz":2,
   "hash":"1806396e0a7fa220d5626dae7ee4a5caa3b35d333f1885d25a440d256701bba4",
   "vout_sz":3
}

```

**Tags:** blockchain, api, blockchain.info, python


---

## 2 answers

### Answer by username_1 on 2016-11-02. Score: 3

There is a better API, and it is the Bitcoin core API. You get all the data you require there. Blockchain.info must probably also be using the core API's (or they must have made a parser to parse the binary data of the blockchain on the machine running the full node). Using the core API's and the corresponding bindings present for various programming languages, you can access all the data from the blockchain you need.

There seems to be no txid field above but there's one tx\_index which refers to that hex. You can get the number of BTC's in that transaction (input and output) by using the core api `getrawtransaction`(to access non-wallet transactions, you need to rebuild your blockchain after adding the line txindex=1 in the conf file and restarting the server with -reindex option)


---

### Answer by username_2 on 2016-11-03. Score: 0

[Blockonomics api](https://www.blockonomics.co/views/api.html#history) has history api call that returns transaction history of multiple bitcoin addresses considering them part of the same wallet. In input you can give all your five addresses and parse the value of the JSON output. In case of outgoing transaction; value will be negative, else value will be positive.


---

