Bitcoin Forum
April 26, 2024, 11:59:21 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Receive payment API and manual lookup of confirmations  (Read 432 times)
register_man (OP)
Newbie
*
Offline Offline

Activity: 2
Merit: 0


View Profile
May 14, 2014, 10:23:09 PM
Last edit: May 14, 2014, 10:34:20 PM by register_man
 #1

Hi, I'm working on a bitcoin web app and am trying to manually query if a BTC address from the 'receive_payment' API has approximately 6 confirmations, but I'm not sure where to get more information about what blockchain returns when I query an address.  So here's the API I use to create the payments

https://blockchain.info/api/api_receive

It seems like the callbacks should be working, but I also want the app to be able to manually lookup the status in case something bad happens like the app shuts down, loses possession of the callback domain, undergoes some kind of weaponized Internet attack, or has some other kind of unforeseeable catastrophe...  




Specifically:
> My application created the following receive_payment address, 1MKaTLjTSZTAMyLGrUfDr3R3MvcMWVTmDf

> I then manually paid that address with correct amount of BTCs

> I then follow this advice (http://bitcoin.stackexchange.com/questions/9987/how-to-query-blockchain-info) to make two blockchain.info requests, one on the receive payment wallet, and another on the block height


At this point I've very unclear as to how any of the protocols really work.  I make these assumption though I am not certain this is correct:

> I assume that receive_payment addresses can be recycled, and that not all the transactions they've undergone relate to purchases made through my web application, IE not all payments that went into that wallet were redirected to my merchant BTC wallet.  

> I assume that if the first payment the receive_payment wallet receives is not enough to cover the value_needed (as specified during the receiving addresses creation) it will still be forwarded to the destination_address, and it will wait for subsequent pmts until the value_needed is met.  I haven't read any comment about partial payments and haven't tested this yet.  

Also, when the receive payment address (1MKaTLjTSZTAMyLGrUfDr3R3MvcMWVTmDf) is queried I see 4 transactions, though I expect 2, one transaction where I manually paid the receive_payment address, and another for when the payment received is forwarded to my merchant BTC wallet.  I can't make any sense of the other two transactions.  

http://blockchain.info/address/1MKaTLjTSZTAMyLGrUfDr3R3MvcMWVTmDf?format=json


Code:
{
"hash160":"dee5edd96a1e0be7515782cac95f5a2165465350",
"address":"1MKaTLjTSZTAMyLGrUfDr3R3MvcMWVTmDf",
"n_tx":2,
"total_received":4500000,
"total_sent":4500000,
"final_balance":0,
"txs":[{"result":0,"block_height":300444,"time":1399933847,"inputs":[{"prev_out":{"n":0,"value":4500000,"addr":"1MKaTLjTSZTAMyLGrUfDr3R3MvcMWVTmDf","tx_index":56343160,"type":0,"script":"76a914dee5edd96a1e0be7515782cac95f5a216546535088ac"},"script":"76a914dee5edd96a1e0be7515782cac95f5a216546535088ac"},{"prev_out":{"n":1,"value":17350000,"addr":"1DTyQoJDr9P8iQ8CSjoFtc9Mxz3i4Y2eU","tx_index":56329047,"type":0,"script":"76a914025b81d31497cadfc7682178a981a0c54a3cdf7788ac"},"script":"76a914025b81d31497cadfc7682178a981a0c54a3cdf7788ac"}],"vout_sz":2,"relayed_by":"127.0.0.1","hash":"f8c7969b81cfab6b75567eb8a79a4d397272e2589d1bab916409998df9aac957","vin_sz":2,"tx_index":56343161,"ver":1,"out":[{"n":0,"value":4500000,"addr":"1FWNSL4HZy7pW2zRHanR2t72nvw7VdLVuB","tx_index":56343161,"spent":true,"type":0,"script":"76a9149f1fb7e3d5e11d214d9d5d443029321086d0512a88ac"},{"n":1,"value":17340000,"addr":"1A2S2grsMJGGGP72xRQYBTf5bN2BNET28D","tx_index":56343161,"spent":false,"type":0,"script":"76a91462fe70f5a4600fe607598b8618eea00779ca117488ac"}],"size":375},{"result":-4500000,"block_height":300443,"time":1399933843,"inputs":[{"prev_out":{"n":1,"value":41131580,"addr":"168BxnDdE2YbEGNLzkwtsFD5AVdPTKJNKn","tx_index":56328225,"type":0,"script":"76a9143834b0e77f58dc0633a8bbdd10c8b1742ea2982088ac"},"script":"76a9143834b0e77f58dc0633a8bbdd10c8b1742ea2982088ac"}],"vout_sz":2,"relayed_by":"108.61.10.90","hash":"cc1064f5f48f608aa88951b39aab9f2207e7e4dff0d1d30fb3097ade682c5825","vin_sz":1,"tx_index":56343160,"ver":1,"out":[{"n":0,"value":4500000,"addr":"1MKaTLjTSZTAMyLGrUfDr3R3MvcMWVTmDf","tx_index":56343160,"spent":false,"type":0,"script":"76a914dee5edd96a1e0be7515782cac95f5a216546535088ac"},{"n":1,"value":36621580,"addr":"168BxnDdE2YbEGNLzkwtsFD5AVdPTKJNKn","tx_index":56343160,"spent":true,"type":0,"script":"76a9143834b0e77f58dc0633a8bbdd10c8b1742ea2982088ac"}],"size":225}]
}


So what exactly is the deal with that reference to a transaction value of 0.1734 BTC, when I only paid the 0.045 BTC into the wallet?
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!