There seem to be two calls. What's the difference between them ? I basically want to know the total amount available to spend on each address(actually on the whole wallet but there is no such api call so I have to calculate the amount from all the addresses).
Unspent outputs
https://blockchain.info/unspent?active=$address
Multiple Addresses Allowed separated by "|" Address can be base58 or xpub
Optional limit parameter to show n transactions e.g. &limit=50 (Default: 250, Max: 1000) Optional confirmations parameter to limit the minimum confirmations e.g. &confirmations=6
The tx hash is in reverse byte order. What this means is that in order to get the html transaction hash from the JSON tx hash for the following transaction, you need to decode the hex (using this site for example). This will produce a binary output, which you need to reverse (the last 8bits/1byte move to the front, second to last 8bits/1byte needs to be moved to second, etc.). Then once the reversed bytes are decoded, you will get the html transaction hash.
{ "unspent_outputs":[ { "tx_age":"1322659106", "tx_hash":"e6452a2cb71aa864aaa959e647e7a4726a22e640560f199f79b56b5502114c37", "tx_index":"12790219", "tx_output_n":"0", "script":"76a914641ad5051edd97029a003fe9efb29359fcee409d88ac", (Hex encoded) "value":"5000661330" } ] }
Balance
https://blockchain.info/balance?active=$address
Multiple Addresses Allowed separated by "|" Address can be base58 or xpub
List the balance summary of each address listed.
{ "1MDUoxL1bGvMxhuoDYx6i11ePytECAk9QK": { "final_balance": 0, "n_tx": 0, "total_received": 0 }, "15EW3AMRm2yP6LEF5YKKLYwvphy3DmMqN6": { "final_balance": 0, "n_tx": 2, "total_received": 310630609 } }