I'm using blockchain api to display transactions of credits and debits seperately, I'm using the below procedure for displaying credit and debit transactions. But credit transactions are showing in debit transactions... I mean the credited transaction which need to display in "inputs" index showing in "out".

Clear explanation :

Taking an address as an example: 12RpKRwx7AevwTDJYF94MVDx6vEduFBvHR. If you can the compare transaction list in blockchain.info url https://blockchain.info/address/12RpKRwx7AevwTDJYF94MVDx6vEduFBvHR and json format url https:// blockchain.info/address/12RpKRwx7AevwTDJYF94MVDx6vEduFBvHR?format=json&limit=5, first 2 transactions are showing fine in 'out' index json. But when you see the 3rd transaction in https:// blockchain.info/address/12RpKRwx7AevwTDJYF94MVDx6vEduFBvHR it is incoming transaction, This 3rd transaction is showing in "out" index.

My moto is to show my website users a clear transactions of their address.

Here I need to show list of Incoming and Outgoing transactions from blockchain api seperately, Procedure I'm following as suggested by the blockchain.info support team.

Procedure:

1st api call https:// blockchain.info/address/12RpKRwx7AevwTDJYF94MVDx6vEduFBvHR?format=json&limit=5 . From this api call I'm taking "hash" index value and passing the to 2nd api call --> https://blockchain.info/rawtx/$hash in the foreach loop . Showing "inputs" index as incoming transactions received to address 12RpKRwx7AevwTDJYF94MVDx6vEduF and "out" as outgoing transactions from 12RpKRwx7AevwTDJYF94MVDx6vEdu.

You can check if transaction is incoming or outcoming if you check "spent" boolean value:

{"spent":false,"tx_index":64117670,"type":0,"addr":"18TXxNNt5qQWiNsCb6vLhUud8wjqehHWYN","value":496364,"n":29,"script":"76a91451cd88fd726d2f2085e86fd242873c6ab6f5485d88ac"},    
{"spent":true,"tx_index":64117670,"type":0,"addr":"1FvfNCiqGF9sCFoJqcNCExv34UM1KfpXiu","value":464214,"n":30,"script":"76a914a3b7d538dac93dd995e01069e44be13bdebd7baa88ac"}
  • but for even both input and output has both 1 and 0 for different transaction. How can i show the user a clear transaction picture of in and out? – hello world Nov 5 '14 at 13:02

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.