Author

Topic: Transaction block hash (Read 1243 times)

legendary
Activity: 1072
Merit: 1181
June 06, 2012, 07:04:08 AM
#8
Recent versions of bitcoind also report this information via the gettransaction RPC call.
sr. member
Activity: 476
Merit: 250
June 06, 2012, 04:22:20 AM
#7
That'd be an overkill, has to be contained inside a java library,

BitcoinJ can do it too.
 - http://code.google.com/p/bitcoinj/

That is what I'm using but no, it can't. You can get a block from its hash, but you can't get a transaction from a transaction hash. Unless I've missed something, but I don't think I have.

edit: you can get transactions but only ones connected to your wallet - which makes sense as it tries to keep saved "blockchain" size at a minimum.
legendary
Activity: 2506
Merit: 1010
June 06, 2012, 03:54:27 AM
#6
That'd be an overkill, has to be contained inside a java library,

BitcoinJ can do it too.
 - http://code.google.com/p/bitcoinj/
sr. member
Activity: 476
Merit: 250
June 06, 2012, 03:36:54 AM
#5
I see.

If you can run your own bitcoind, Armory can layer on top and give you that info:
 - https://bitcointalksearch.org/topic/m.865750

That'd be an overkill, has to be contained inside a java library, so I guess I'll stick with the route I mentioned above. Thanks anyway.
legendary
Activity: 2506
Merit: 1010
June 05, 2012, 11:47:25 PM
#4
I see.

If you can run your own bitcoind, Armory can layer on top and give you that info:
 - https://bitcointalksearch.org/topic/m.865750
sr. member
Activity: 476
Merit: 250
June 05, 2012, 05:38:57 PM
#3
I need to get the block hash of the block containing specified transaction. I have been parsing blockexplorer for this data, but it seems to be having some difficulties lately, so I'm looking for alternatives. Blockchain.info json api doesn't seem to have this information. Are there any other alternatives? Thanks in advance.

Blockchain.info's API is written to be compatible with the BlockExplorer API.

What approach are you taking on BlockExplorer?

The API does give transactions for each block:
 - http://blockchain.info/rawblock/183164

Though how to figure out which block has a transaction, I'm not sure.

yes, this is exactly what I need to do. I have a transaction hash and I need the block hash containing the transaction (so I can download that block later using bitcoinj, but that library has no way of downloading a transaction from given transaction hash). I am currently parsing the http://blockexplorer.com/tx/txhash page for "Appeared in block #" which in turn has a link containing it's hash. But since blockexplorer is stuck on block #182973 this approach is now useless (and it hasn't been working most of the time as of late anyway). I could use the same approach with blockchain (and I will if there are no better alternatives), but that would mean querying it twice per transaction since the block hash is not on the same page as block number.

A workaround would be somehow importing the raw transaction data from blockchain json api into the bitcoinj Transaction object, but that's quite a bit more difficult than parsing for a block hash...
legendary
Activity: 2506
Merit: 1010
June 05, 2012, 04:38:26 PM
#2
I need to get the block hash of the block containing specified transaction. I have been parsing blockexplorer for this data, but it seems to be having some difficulties lately, so I'm looking for alternatives. Blockchain.info json api doesn't seem to have this information. Are there any other alternatives? Thanks in advance.

Blockchain.info's API is written to be compatible with the BlockExplorer API.

What approach are you taking on BlockExplorer?

The API does give transactions for each block:
 - http://blockchain.info/rawblock/183164

Though how to figure out which block has a transaction, I'm not sure.
sr. member
Activity: 476
Merit: 250
June 05, 2012, 09:12:41 AM
#1
I need to get the block hash of the block containing specified transaction. I have been parsing blockexplorer for this data, but it seems to be having some difficulties lately, so I'm looking for alternatives. Blockchain.info json api doesn't seem to have this information. Are there any other alternatives? Thanks in advance.
Jump to: