Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: GCInc. on May 02, 2012, 07:11:36 PM



Title: Checking the number of confirmations
Post by: GCInc. on May 02, 2012, 07:11:36 PM
This must be a simple question, the answer for which has evaded us for too long -

What ways are there to programmatically check the number of realtime confirmations for a single transfer (transaction)?

I know there is blockchain.info with for instance this: http://blockchain.info/tx-index/4646689/9b441b2bee99dc5611757a25a22140aa6488f25fcbf26b5fddb324724abc1fe9

from which the correct value could be parsed, but is there a simpler API somewhere that simply shows the number of confirmations? Blockchain.info rawtx does not show that, nor does blockexplorer.com?


Title: Re: Checking the number of confirmations
Post by: Remember remember the 5th of November on May 02, 2012, 07:15:14 PM
Bitcoin's own RPC command listtransactions? Or better yet, there was one to fetch a specific tx.


Title: Re: Checking the number of confirmations
Post by: GCInc. on May 02, 2012, 07:21:28 PM
I mean "from the web", without bitcoin running.

Quote
there was one to fetch a specific tx
Exactly, but I suppose that requires bitcoin running on one's server?


Title: Re: Checking the number of confirmations
Post by: grue on May 02, 2012, 07:58:07 PM
I mean "from the web", without bitcoin running.

Quote
there was one to fetch a specific tx
Exactly, but I suppose that requires bitcoin running on one's server?
If you ran a local bitcoin instance, it will be as easy as an RPC call. but if you really want to do it without a local instance, you can go on blockexplorer.com, check the transaction, and subtract the current # of the blocks from when it first appeared.


Title: Re: Checking the number of confirmations
Post by: GCInc. on May 02, 2012, 08:07:16 PM
check the transaction, and subtract the current # of the blocks from when it first appeared.
Nice, perhaps a little more trustworthy than parsing the blockchain.info html. However that requires two http calls (getting the transaction, and the current block count) so I need to assume there really isn't a simpler way to do that without running a bitcoin instance.


Title: Re: Checking the number of confirmations
Post by: Stephen Gornick on May 02, 2012, 10:25:31 PM
What ways are there to programmatically check the number of realtime confirmations for a single transfer (transaction)?

If you can use a 3rd party:
 - http://www.bitcoinmonitor.net
 - http://bitping.net

And possibly there might be something coming from ZipConf:
 - http://zipconf.com
 - http://zipconf.com/api


Title: Re: Checking the number of confirmations
Post by: DeathAndTaxes on May 02, 2012, 10:30:52 PM
without running a bitcoin instance.

Simpler or not you really shouldn't be trusted anyone else.  No 3rd party provides any SLA on the data (eventually Bitcoin will need something akin to a financial services company which provides data under contract for a fee).

If attacker learns you are using bitcoin.info then the attack becomes to hit bitcoin.info and change the data provided.

Make that 0-confirm look like a 6-confirm and rob you blind.   No matter how good your back end is you leave yourself vulnerable to third party attack.

Eventually I do imagine a contracted & bonded data provider using strong encryption and an API would provide commercial services but we aren't there yet. :)  Good business idea though.


Title: Re: Checking the number of confirmations
Post by: grue on May 02, 2012, 10:43:09 PM
without running a bitcoin instance.

Simpler or not you really shouldn't be trusted anyone else.  No 3rd party provides any SLA on the data (eventually Bitcoin will need something akin to a financial services company which provides data under contract for a fee).

If attacker learns you are using bitcoin.info then the attack becomes to hit bitcoin.info and change the data provided.

Make that 0-confirm look like a 6-confirm and rob you blind.   No matter how good your back end is you leave yourself vulnerable to third party attack.

Eventually I do imagine a contracted & bonded data provide using strong encryption and an API would provide commercial services but we aren't there yet. :)  Good business idea though.
a better idea would be a bitcoind fork that provides additional api functionality.


Title: Re: Checking the number of confirmations
Post by: Herbert on May 03, 2012, 09:41:02 AM
a better idea would be a bitcoind fork that provides additional api functionality.
My bitcoind fork used for bitcoinmonitor.net (https://github.com/TripleSpeeder/bitcoin) enables exactly this: Retrieving Transaction information for all transactions, not just transactions related to your wallet. And as far as i know there is a pull request existing for a similar feature which hopefully makes it into the 0.7 official bitcoin release.


BTT: Is there really no public API existing yet for this :o?

I think i can add this to the bitcoinmonitor.net api. Something like
Code:
http://www.bitcoinmonitor.net/api/v1/transaction/<tx_hash>/
which replies with the number of confirmations and probably some more details.

Is there demand for it? Should be a no-brainer to implement...


Title: Re: Checking the number of confirmations
Post by: GCInc. on May 04, 2012, 08:18:59 PM
which replies with the number of confirmations and probably some more details.
Is there demand for it? Should be a no-brainer to implement...
Sure there is. Would be a nice addition to your service's features.

The problem about using third party services, as pointed out earlier, however remains. Using services crafted by various operators with fairly unestablished reputation "as is" poses risks that some merchants are nevertheless ready to accept.

To a high extent the adoption of third party services is indeed a question of psychology. For instance, in the past I tried bitcoinmonitor.net and (for some reason that I can't recall) became suspicious of the service's reliability. It is very hard to regain trust once gone for any reason - there are numerous points of failure outside the service provider's control.

Currently pretty much the only service I would trust enough off the elbow is blockexplorer.com. I can't point out the exact reasons for that, which of course is rather irrational. But maybe telling that serves to help you guys provide useful third party services that merchants will benefit from, even when that means taking controlled risks in handing away the strict requirement of authenticity.