Author

Topic: [SOLVED] Need help RE: blockchain.info payment notifications. (Read 772 times)

full member
Activity: 168
Merit: 100
Movin' on up.
This pretty much cleared everything up for me.  Thank you kindly.  And excellent service, by the way.
hero member
Activity: 910
Merit: 1005
I figured the inputs were what was sent from who and the outputs specify who received the coins, correct?

Yes that is correct. If you view a a transaction like this (https://blockchain.info/tx-index/15861941/c7be384cd8e231e5b2da26a6ffe811265c61fca487425a531ffaefa2bcd1e9fd?show_adv=true) this inputs are on the left of the green arrow, the outputs on on the right hand side.

Also, if there are multiple inputs and outputs, how can you determine that it's for the specific address you're interested in handling?

You need to know you own bitcoin address(s) in order to determine which outputs are to you. In rough pseudo code:

Quote
int amount_paid_to_me = 0;

for every output
  if output is to my bitcoin address
      amount_paid_to_me += output value

The bitcoin address for an output is the "addr" field.

The value is "value".

Let me know if there is anything you are still not sure about.
full member
Activity: 168
Merit: 100
Movin' on up.
I'm working on a couple of projects related to Bitcoin and came across the blockchain.info My Wallet service and its instant payment notification option.  I've tried using it several times, but the information I'm trying to receive never is in the same location of the returned JSON object.

Using the example they provide, added below:

Code:
{
    "hash": "bf8648b06160ded3274d6054cfeadd95f762271170070429ef40d62ac5452c4b",
    "ver": 1,
    "vin_sz": 1,
    "vout_sz": 2,
    "lock_time": "Unavailable",
    "size": 258,
    "relayed_by": "71.238.174.98",
    "tx_index": 13903761,
    "time": 1325700693,
    "inputs": [
        {
            "prev_out": {
                "hash": "e417eb0889a1870e6b500ad8769cb7110739749e",
                "addr": "1Mo3ibZuqZpsBGimyfmUnYDiZoU44VbAJV",
                "value": 438000000,
                "tx_index": 13902462,
                "n": 1
            }
        }
    ],
    "out": [
        {
            "value": 215000000,
            "hash": "6c835372a306b2e253f896801cb0b5703d60114c",
            "addr": "1AtmJQYUCVZSwoLkQvEvFhtoRfwn4Eumuu"
        },
        {
            "value": 222000000,
            "hash": "60ce49cd97aa152e1db8a76c1b62c55ae3b059d3",
            "addr": "19przaW7NeE96SEVtKGWdGM3CuKVaSYhrS"
        }
    ]
}

I figured the inputs were what was sent from who and the outputs specify who received the coins, correct?  If this is not the case, can someone please break it down for me so I may get a better understanding?  Also, if there are multiple inputs and outputs, how can you determine that it's for the specific address you're interested in handling? Also, how are deposits into your wallet structured, and is there any easy way to grab the data from that JSON object just as easily?

Sorry for the questions, it's just that I never messed with JSON before now.  Can be a bit confusing at times, and their documentation for the responses aren't all that great.  :p
Jump to: