Author

Topic: Understanding transaction data, Blockchain.info API (Read 1749 times)

legendary
Activity: 2506
Merit: 1010
Im trying to write a simple script that keeps track of all the Deposits and timestamps for a given address.

Timestamps are not any more accurate than +/- a couple hours.


Transactions can be ordered by the block number (height) in which the transaction appears, and then from there the timestamp is whatever the miner wishes it to be +/- two hours.
member
Activity: 102
Merit: 10
Im trying to write a simple script that keeps track of all the Deposits and timestamps for a given address.

Im not really understanding this data; the timestamps don’t seem to match up. The “results” seems to act inconsistent. I think there is something fundamental im not understanding. 


I show a couple examples.
1HhJDptWQh3rPqZY4ccJPGRYnqg2mhET6v

Looks like
Code:
stdClass Object
(
    [hash160] => b72106c7fcbd2737d50622917712e131355e4682
    [address] => 1HhJDptWQh3rPqZY4ccJPGRYnqg2mhET6v
    [n_tx] => 2
    [n_unredeemed] => 0
    [total_received] => 4638000000
    [total_sent] => 4638000000
    [final_balance] => 0
    [txs] => Array
        (
            [0] => stdClass Object
                (
                    [hash] => f38ed6d4cddb014c13f7e2f9b23edd71e61d66d3474439bd2d8c5c3dee9e3c2c
                    [ver] => 1
                    [vin_sz] => 1
                    [vout_sz] => 2
                    [size] => 225
                    [relayed_by] => 184.97.234.57
                    [tx_index] => 19333861
                    [result] => 0
                    [time] => 1346979783
                    [block_height] => 197611
                    [inputs] => Array
                        (
                            [0] => stdClass Object
                                (
                                    [prev_out] => stdClass Object
                                        (
                                            [type] => 0
                                            [addr] => 1HhJDptWQh3rPqZY4ccJPGRYnqg2mhET6v
                                            [value] => 4638000000
                                            [tx_index] => 19306651
                                            [n] => 1
                                        )

                                )

                        )

                    [out] => Array
                        (
                            [0] => stdClass Object
                                (
                                    [addr] => 1HkC9rAYATAHAfdPmER6FcovjBmmqJtQR9
                                    [value] => 4594500000
                                    [type] => 0
                                )

                            [1] => stdClass Object
                                (
                                    [addr] => 19hHdMGkSQ3ndiQmmfd7cZCoVGQqthuJpY
                                    [value] => 43500000
                                    [type] => 0
                                )

                        )

                )

            [1] => stdClass Object
                (
                    [hash] => d259ade477311b24835e355ed1afbbbcfd71f07dfb603471c867429494c54255
                    [ver] => 1
                    [vin_sz] => 2
                    [vout_sz] => 2
                    [size] => 374
                    [relayed_by] => 213.189.52.53
                    [tx_index] => 19306651
                    [result] => -4638000000
                    [time] => 1346949302
                    [block_height] => 197558
                    [inputs] => Array
                        (
                            [0] => stdClass Object
                                (
                                    [prev_out] => stdClass Object
                                        (
                                            [type] => 0
                                            [addr] => 18eAfNBzCvwqvPvKWL6oZHtsRpwpCD1Y9n
                                            [value] => 2010610000
                                            [tx_index] => 19303073
                                            [n] => 0
                                        )

                                )

                            [1] => stdClass Object
                                (
                                    [prev_out] => stdClass Object
                                        (
                                            [type] => 0
                                            [addr] => 1EDvRoAavAgPzEgwKgpX5rXtdbUFmrXLS1
                                            [value] => 2700000000
                                            [tx_index] => 19247286
                                            [n] => 1
                                        )

                                )

                        )

                    [out] => Array
                        (
                            [0] => stdClass Object
                                (
                                    [addr] => 1NCURo7zw4XZ6bJzSZDNVxyUixyJoNdeRz
                                    [value] => 72410000
                                    [type] => 0
                                )

                            [1] => stdClass Object
                                (
                                    [addr] => 1HhJDptWQh3rPqZY4ccJPGRYnqg2mhET6v
                                    [value] => 4638000000
                                    [type] => 0
                                )

                        )

                )

        )

)
The timestamp on transaction 1
Is 1346949302 or 2012-09-06 16:35:02
But the result is negative?
http://blockchain.info/address/1HhJDptWQh3rPqZY4ccJPGRYnqg2mhET6v


Or this example
1NDZyj5txmztkPVPCWFLQ185SprXxJfKjW
Looks like

Code:
stdClass Object
(
    [hash160] => e8bb296352b4926574363bba6603703589d12d25
    [address] => 1NDZyj5txmztkPVPCWFLQ185SprXxJfKjW
    [n_tx] => 4
    [n_unredeemed] => 4
    [total_received] => 13000000
    [total_sent] => 0
    [final_balance] => 13000000
    [txs] => Array
        (
            [0] => stdClass Object
                (
                    [hash] => 682832393a86adba8160a766a23bca22b55990047d0adc75df5362ff57602414
                    [ver] => 1
                    [vin_sz] => 1
                    [vout_sz] => 2
                    [size] => 258
                    [relayed_by] => 127.0.0.1
                    [tx_index] => 28896910
                    [result] => 0
                    [time] => 1349574785
                    [block_height] => 202148
                    [inputs] => Array
                        (
                            [0] => stdClass Object
                                (
                                    [prev_out] => stdClass Object
                                        (
                                            [type] => 0
                                            [addr] => 1GHYfp7X81X8pXBpmQZwFJcXCsoCAESNag
                                            [value] => 23850000
                                            [tx_index] => 28107783
                                            [n] => 1
                                        )

                                )

                        )

                    [out] => Array
                        (
                            [0] => stdClass Object
                                (
                                    [addr] => 1NDZyj5txmztkPVPCWFLQ185SprXxJfKjW
                                    [value] => 10000000
                                    [type] => 0
                                )

                            [1] => stdClass Object
                                (
                                    [addr] => 1GHYfp7X81X8pXBpmQZwFJcXCsoCAESNag
                                    [value] => 13800000
                                    [type] => 0
                                )

                        )

                )

            [1] => stdClass Object
                (
                    [hash] => 3a6ee1f05b3eb402878f1ac28efb056caf8cea584181bd931024cf7ce1dfdb11
                    [ver] => 1
                    [vin_sz] => 1
                    [vout_sz] => 2
                    [size] => 258
                    [relayed_by] => 127.0.0.1
                    [tx_index] => 28108192
                    [result] => 10000000
                    [time] => 1349051111
                    [block_height] => 201313
                    [inputs] => Array
                        (
                            [0] => stdClass Object
                                (
                                    [prev_out] => stdClass Object
                                        (
                                            [type] => 0
                                            [addr] => 1GHYfp7X81X8pXBpmQZwFJcXCsoCAESNag
                                            [value] => 39000000
                                            [tx_index] => 28107939
                                            [n] => 1
                                        )

                                )

                        )

                    [out] => Array
                        (
                            [0] => stdClass Object
                                (
                                    [addr] => 1NDZyj5txmztkPVPCWFLQ185SprXxJfKjW
                                    [value] => 1000000
                                    [type] => 0
                                )

                            [1] => stdClass Object
                                (
                                    [addr] => 1GHYfp7X81X8pXBpmQZwFJcXCsoCAESNag
                                    [value] => 37950000
                                    [type] => 0
                                )

                        )

                )

            [2] => stdClass Object
                (
                    [hash] => d25bc1d305922e8f37f6467707383a20daf9103cc1186a3396659c4a337fcd3d
                    [ver] => 1
                    [vin_sz] => 1
                    [vout_sz] => 2
                    [size] => 258
                    [relayed_by] => 127.0.0.1
                    [tx_index] => 28107783
                    [result] => 1000000
                    [time] => 1349050675
                    [block_height] => 201313
                    [inputs] => Array
                        (
                            [0] => stdClass Object
                                (
                                    [prev_out] => stdClass Object
                                        (
                                            [type] => 0
                                            [addr] => 1GHYfp7X81X8pXBpmQZwFJcXCsoCAESNag
                                            [value] => 24900000
                                            [tx_index] => 27895519
                                            [n] => 1
                                        )

                                )

                        )

                    [out] => Array
                        (
                            [0] => stdClass Object
                                (
                                    [addr] => 1NDZyj5txmztkPVPCWFLQ185SprXxJfKjW
                                    [value] => 1000000
                                    [type] => 0
                                )

                            [1] => stdClass Object
                                (
                                    [addr] => 1GHYfp7X81X8pXBpmQZwFJcXCsoCAESNag
                                    [value] => 23850000
                                    [type] => 0
                                )

                        )

                )

            [3] => stdClass Object
                (
                    [hash] => 45aecdc3fb16ad810e9aab8b14e0e8c042a11b647d7da7486d08ee9d3246eafe
                    [ver] => 1
                    [vin_sz] => 1
                    [vout_sz] => 2
                    [size] => 258
                    [relayed_by] => 127.0.0.1
                    [tx_index] => 28107456
                    [result] => 1000000
                    [time] => 1349050311
                    [block_height] => 201313
                    [inputs] => Array
                        (
                            [0] => stdClass Object
                                (
                                    [prev_out] => stdClass Object
                                        (
                                            [type] => 0
                                            [addr] => 1Ji9Y6ny8fCzCBYFD1rHRryAQEfDG2YLhb
                                            [value] => 6088000
                                            [tx_index] => 27889882
                                            [n] => 1
                                        )

                                )

                        )

                    [out] => Array
                        (
                            [0] => stdClass Object
                                (
                                    [addr] => 1NDZyj5txmztkPVPCWFLQ185SprXxJfKjW
                                    [value] => 1000000
                                    [type] => 0
                                )

                            [1] => stdClass Object
                                (
                                    [addr] => 1Ji9Y6ny8fCzCBYFD1rHRryAQEfDG2YLhb
                                    [value] => 5038000
                                    [type] => 0
                                )

                        )

                )

        )

)


The results are positive this time.  And the timestamps match up!
Except when it come to transaction 0. The timestamp is right, but the result is 0.

All I want to do is record the times and amount of deposits for this address. How can I Consistently get accurate data out of this JSON object?

http://blockchain.info/address/1NDZyj5txmztkPVPCWFLQ185SprXxJfKjW


Jump to: