5

I am developing simple Bitcoin application using the bitcoinj library: The user enters the hash of a transaction and my application should return detailed information about that transaction.

How can I load that transaction? Is there a function like peer.getBlock() for transactions?

1 Answers1

2

BitCoinJ is a Simplified Payment Verification (SPV) client library

This means that it only downloads the headers for transactions, and only those that are relevant to the private keys contained in its wallet only. This greatly reduces the blockchain download (very quick to get started), but at the cost of not seeing all the other transactions (reduced overall network security).

So, in short, you can't download an arbitrary transaction through BitCoinJ.

However, to answer your requirement have you considered just using the Blockchain.info API?

Gary
  • 7,543
  • 3
  • 33
  • 59
  • Well how does then bitcoinj downloads relevant transaction from it's peers ? Isn't it possible to ask peers to get particular transaction ? – Pavel Niedoba Feb 21 '16 at 14:03
  • @PavelNiedoba Here's a link to more details on how SPV works: https://multibit.org/en/help/hd0.2/how-spv-works.html – Gary Feb 21 '16 at 21:41