Bitcoin Forum
June 16, 2024, 04:09:53 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: how to properly verify that payment was made using txid and blockchain.info API  (Read 1147 times)
shark255 (OP)
Full Member
***
Offline Offline

Activity: 224
Merit: 100



View Profile
October 30, 2014, 10:07:37 PM
 #1

How to properly verify that payment was made to specific address with known sum, using txid and blockchain.info API

Use case: User A sent 0.001 BTC to User B. I should verify that user B really received that amount to specific address.

For example, we have transaction id feec67bb56dbb5d18c535645879ec65c1d9b2da63e512c89d0ca052f40c4cfc9 .
We should verify that payment was made in amount of 5000000 satoshi to address 1C5MT6YVpZF3G6xhp6PFti1ySzAxtpNf86 .

I make request to https://blockchain.info/tx/feec67bb56dbb5d18c535645879ec65c1d9b2da63e512c89d0ca052f40c4cfc9?format=json

Decode received JSON:

Code:
stdClass Object
(
    [ver] => 1
    [size] => 338
    [inputs] => Array
        (
            [0] => stdClass Object
                (
                    [sequence] => 4294967295
                    [prev_out] => stdClass Object
                        (
                            [spent] => 1
                            [tx_index] => 66740766
                            [type] => 0
                            [addr] => 162XaHLX7QpCw5DFbAnuedgvA1vC4TvC8M
                            [value] => 5000000
                            [n] => 0
                            [script] => 76a9143722910e212d777b3caff82caa4a5e56c86bb73f88ac
                        )

                    [script] => 4730440220354a8a6b0c335181b413f2a8e8579beca7421453f3a9db1224005ea68b13082802202f32a3600ea6a99bed46e2521689b2178ae85388d87340f6b98e140e7f3d9ab801210395a937d030a3dbf5729a5a1b4753050223287ade0f8c8d8c07623c0da75ba8b4
                )

            [1] => stdClass Object
                (
                    [sequence] => 4294967295
                    [prev_out] => stdClass Object
                        (
                            [spent] => 1
                            [tx_index] => 60915659
                            [type] => 0
                            [addr] => 16xyo8ReXPxRVdJ1JzUtH4Am2Z5RSafhYj
                            [value] => 10000
                            [n] => 0
                            [script] => 76a914416eeacaac3ad4e3732d97844b0859116be7702e88ac
                        )

                    [script] => 4730440220256c081a09566b5c4d4017b1285b6ba8e5af80d282b085bda4881afe109c4bc4022025c91c267768b4c5a496e50c6b0cb97d21319143561aa587fdacd8feac9801a301210236048c393b19b2068159c8d099618a5ff6a43c945ec4fa2efcf2a4ef8026e335
                )

        )

    [double_spend] =>
    [time] => 1413549405
    [block_height] => 325724
    [tx_index] => 66959896
    [vin_sz] => 2
    [hash] => feec67bb56dbb5d18c535645879ec65c1d9b2da63e512c89d0ca052f40c4cfc9
    [vout_sz] => 1
    [relayed_by] => 68.230.61.161
    [out] => Array
        (
            [0] => stdClass Object
                (
                    [spent] => 1
                    [tx_index] => 66959896
                    [type] => 0
                    [addr] => 1C5MT6YVpZF3G6xhp6PFti1ySzAxtpNf86
                    [value] => 5000000
                    [n] => 0
                    [script] => 76a914797c1e42b35bc1e7e17ede4589b17cb45f53714888ac
                )

        )

)

Then look into out array and find our address and its amount - thats enough for verifying ? BTW where I can see number of confirmations of this transaction?
Newar
Legendary
*
Offline Offline

Activity: 1358
Merit: 1001


https://gliph.me/hUF


View Profile
October 31, 2014, 05:58:57 AM
 #2

How about this?

Code:
https://blockchain.info/q/txresult/feec67bb56dbb5d18c535645879ec65c1d9b2da63e512c89d0ca052f40c4cfc9/1C5MT6YVpZF3G6xhp6PFti1ySzAxtpNf86?confirmations=6

Code:
5000000


edit: https://blockchain.info/q

OTC rating | GPG keyid 1DC91318EE785FDE | Gliph: lightning bicycle tree music | Mycelium, a swift & secure Bitcoin client for Android | LocalBitcoins
shark255 (OP)
Full Member
***
Offline Offline

Activity: 224
Merit: 100



View Profile
October 31, 2014, 10:03:38 AM
 #3

That's simply amazing  Smiley Thanks! RTFM carefully !! Grin
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!