Title: Help understanding payment verification via blockchain.info JSON API Post by: Ford on July 12, 2013, 12:30:24 PM Hi All
Im a simple web developer and trying to understand how to verify payments/transactions. Can anyone comment on the php code i have so far / test code (i am far from a good php programmer, but get by usually) And the output as i am not fully understanding it..... (sorry if these sound dumb questions, but i am loving BitCoin and want to start using it on many more sites!) Code:
This generates the following output (with my notes and some questions to the side) Code:
I am going to issue a unique payment address to all sales and get the total received to enter into my DB/ecommerce system, but what if someone then pays on the same unique address. is there a better way that i can get the amount actually received rather than the total received? (as if some one can break things, i find they usually will) Any help at all or advice would be great (and if anyone finds this code or thread useful, great feel free to use it) Best Regards Ford Title: Re: Help understanding payment verification via blockchain.info JSON API Post by: ToaDy on July 12, 2013, 01:53:40 PM Hey man,
For me it seems: "value The value of the payment received in satoshi (not including fees). Divide by 100000000 to get the value in BTC." You can find nearly everything in the documentation: http://blockchain.info/de/api/blockchain_wallet_api cheers, Gary Title: Re: Help understanding payment verification via blockchain.info JSON API Post by: Ford on July 12, 2013, 06:17:57 PM Hey man, For me it seems: "value The value of the payment received in satoshi (not including fees). Divide by 100000000 to get the value in BTC." You can find nearly everything in the documentation: http://blockchain.info/de/api/blockchain_wallet_api cheers, Gary Hi Gary Thanks for the reply I am not using the RPC connection as i am after transactions/addresses that are not in the block chain wallet and i think it will only give me details on addresses within the wallet. I can get the full value form the JSON API, but im wondering out of the various transactions that are returned how to get the transaction that i am after, other than just getting the full received amount Title: Re: Help understanding payment verification via blockchain.info JSON API Post by: coinprize on July 13, 2013, 02:47:36 AM You might wanna to also use the original bitcoin rpc api listtransactions or listsinceblock to get transactions for specific address. check out in here: https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list
Title: Re: Help understanding payment verification via blockchain.info JSON API Post by: Ford on July 13, 2013, 10:26:58 AM You might wanna to also use the original bitcoin rpc api listtransactions or listsinceblock to get transactions for specific address. check out in here: https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list Tried that, but it only returns transactions for the accounts held within the bitcoind client, and i did not want to do this as hackers may be able to steel my shiny coins then I planned to have payments made to an offline wallet. Please do correct me if i am wrong! I would be very interested to know if i can get transactions via bitcoind that are not in the same account/wallet (just like blockchain.info somehow manage to do...) At present i have managed to do it via the BlockChain JSON API, but i worry about scalability (i.e how will blockchain cope if i try to send 10,000+ calls per hour...) Title: Re: Help understanding payment verification via blockchain.info JSON API Post by: ToaDy on July 14, 2013, 03:53:54 PM Hey,
I would not worry about this. 8) cheers, Title: Re: Help understanding payment verification via blockchain.info JSON API Post by: CIYAM on July 14, 2013, 03:57:18 PM I would be very interested to know if i can get transactions via bitcoind that are not in the same account/wallet (just like blockchain.info somehow manage to do...) At present i have managed to do it via the BlockChain JSON API, but i worry about scalability (i.e how will blockchain cope if i try to send 10,000+ calls per hour...) You can do this (look at the options for indexing all tx's that were introduced after the levelDB introduction). To be able to query any tx you'll need to "re-index" (this is another option). Title: Re: Help understanding payment verification via blockchain.info JSON API Post by: Abdussamad on July 14, 2013, 05:23:50 PM I am going to issue a unique payment address to all sales and get the total received to enter into my DB/ecommerce system, but what if someone then pays on the same unique address. is there a better way that i can get the amount actually received rather than the total received? (as if some one can break things, i find they usually will) Any help at all or advice would be great (and if anyone finds this code or thread useful, great feel free to use it) Best Regards Ford First up I had no idea you could query blockchain.info data in json format like that. So thanks for that. Second the solution to your problem is to use a separate address for each transaction. This is actually the recommended way to do things. It will help you to track individual transactions and assign credit to different customers. Title: Re: Help understanding payment verification via blockchain.info JSON API Post by: Abdussamad on July 14, 2013, 05:42:14 PM I looked into this a little more and you might be better off using getreceivedbyaddress:
https://blockchain.info/q http://blockexplorer.com/q You can see an implementation of this in the function BWWC__getreceivedbyaddress_info in bwwc-utils.php of this WP plugin: http://wordpress.org/plugins/bitcoin-payments-for-woocommerce/ Title: Re: Help understanding payment verification via blockchain.info JSON API Post by: Abdussamad on July 14, 2013, 06:20:24 PM Another thing is that there is a question mark on the accuracy of blockchain.info's output when using getreceivedbyaddress. Blockexplorer is correct in this instance:
18+ http://blockexplorer.com/q/getreceivedbyaddress/1H9uAP3x439YvQDoKNGgSYCg3FmrYRzpD2 15+ http://blockchain.info/q/getreceivedbyaddress/1H9uAP3x439YvQDoKNGgSYCg3FmrYRzpD2 I created the following script and it outputs the blockexplorer number both times even when using blockchain.info data: Code: <?php Title: Re: Help understanding payment verification via blockchain.info JSON API Post by: Ford on July 15, 2013, 05:38:42 PM I would be very interested to know if i can get transactions via bitcoind that are not in the same account/wallet (just like blockchain.info somehow manage to do...) At present i have managed to do it via the BlockChain JSON API, but i worry about scalability (i.e how will blockchain cope if i try to send 10,000+ calls per hour...) You can do this (look at the options for indexing all tx's that were introduced after the levelDB introduction). To be able to query any tx you'll need to "re-index" (this is another option). Hello and thanks for the reply I think i may have worded things wrong by saying "transactions" what i meant is "address" as i dont know the transaction numbers..... I had tried enabling txindex and re-indexed but it still would not bet details on an "address" that was not in my wallet. If i have still got this wrong and can get the balance of ANY address please do reply. Thanks Ford Title: Re: Help understanding payment verification via blockchain.info JSON API Post by: Ford on July 15, 2013, 06:02:06 PM Hello Again
If anyone does know how i can get bitcoind to provide me details on any address i would be very interested. After spending the past week integrating a "kind of new ecommerce" system with blockchains JSON API, today i start further development to notice blockchain JSON API is not working...... I should have known better to rely on 3rd parties.... Ford |