<p>GetData can fetch only <strong>unconfirmed</strong> transactions, and that's what <code>Peer.downloadDependenciesInternal</code> is doing.</p>

<p>You might want to contact the developer of the now defunct biteasy.com block explorer, he was using (and extending on) bitcoinj.</p>

CC BY-SA 3.0
2017-06-20T08:29:35.263Z
2017-06-20T08:29:35.263Z
Andreas
<p>So far, what I found out is that bitcoinj can only fetch unconfirmed 
transactions using:</p>

<pre><code>GetDataMessage message = new GetDataMessage();
message.addTransaction(hash);
peer.sendMessage(message);
</code></pre>

<p>Message should then be received by some listener, for example:</p>

<pre><code>peer.addPreMessageReceivedEventListener(...);
</code></pre>

<p>But confirmed transactions will not be received by this nor any similar method. If I'm wrong here I would be very happy. Simply there's no such functionality without running full node (bitcoind) with hash index. </p>

CC BY-SA 3.0
2017-02-18T02:20:25.620Z
Given that a Bitcoin Core full node cannot locate individual transactions by txid (unless txindex is enabled) for local usage, how would those same nodes be able to provide it to you over the network? If you want to find confirmed transactions, you need to synchronize the blocks (potentially with BIP37 filtering, but that has severe privacy implications).
Pieter Wuille
CC BY-SA 3.0
2016-03-16T12:07:58.630Z
2016-07-22T22:13:07.000Z
2016-07-22T22:13:07.000Z
Pavel Niedoba
<p>If your goal is to replace a 3rd-party service like <a href="http://blockchain.info" rel="nofollow">blockchain.info</a>, then you have to run a full <code>bitcoind</code> node with <code>-txindex=1</code> and write your service to interface with it (see <a href="https://bitcoin.stackexchange.com/questions/35707/what-are-pros-and-cons-of-txindex-option">here</a>)</p>

<p>As far as I can tell, the only way to get <code>bitcoinj</code> to only download <strong>your own</strong> confirmed TXs (by ID) is by setting up <strong>your</strong> wallet with it and using the Bloom filter feature to download Merkle proofs w.r.t. to the block headers. However, this will not be helpful for your application, where you want to download <strong>any</strong> transaction. You will have to run a full node!</p>

CC BY-SA 3.0
2016-07-22T20:56:01.890Z
2016-07-22T20:56:01.890Z
Alin Tomescu
<p>I'm pretty sure bitcoinj is capable of downloading any Bitcoin transaction from P2P nodes by broadcasting <code>GetDataMessage</code> because that's what it  does in the <code>peer.downloadDependenciesInternal</code> method. </p>

<p>I'm trying to find/implement a very simple method which would download a transaction with its inputs and outputs and the block in which it's included (if any) but, because of Guava asynchronous futures, I cannot figure it out. </p>

<p>Very simply, I would like to replace 3rd-party services like <a href="https://blockchain.info/tx/22164ca0760980161a8e1d8e2f962a782ce0134d535255cf8bbd49c5724008db?format=json" rel="nofollow">blockchain.info</a> with something decentralized.</p>

<bitcoinj>
get any transaction in p2p manner using bitcoinj
Pavel Niedoba
# get any transaction in p2p manner using bitcoinj

(Asked by: username_0 on 2016-03-14)

I'm pretty sure bitcoinj is capable of downloading any Bitcoin transaction from P2P nodes by broadcasting `GetDataMessage` because that's what it does in the `peer.downloadDependenciesInternal` method.

I'm trying to find/implement a very simple method which would download a transaction with its inputs and outputs and the block in which it's included (if any) but, because of Guava asynchronous futures, I cannot figure it out.

Very simply, I would like to replace 3rd-party services like [blockchain.info](https://blockchain.info/tx/22164ca0760980161a8e1d8e2f962a782ce0134d535255cf8bbd49c5724008db?format=json) with something decentralized.

**Tags:** bitcoinj


---

## 3 answers

### Answer by username_1 on 2017-06-20. Score: 1

GetData can fetch only **unconfirmed** transactions, and that's what `Peer.downloadDependenciesInternal` is doing.

You might want to contact the developer of the now defunct biteasy.com block explorer, he was using (and extending on) bitcoinj.


---

### Answer by username_0 on 2016-03-16. Score: 0

So far, what I found out is that bitcoinj can only fetch unconfirmed 
transactions using:
GetDataMessage message = new GetDataMessage();
message.addTransaction(hash);
peer.sendMessage(message);

Message should then be received by some listener, for example:
peer.addPreMessageReceivedEventListener(...);

But confirmed transactions will not be received by this nor any similar method. If I'm wrong here I would be very happy. Simply there's no such functionality without running full node (bitcoind) with hash index.

> **Comments:**
> **username_2**: Given that a Bitcoin Core full node cannot locate individual transactions by txid (unless txindex is enabled) for local usage, how would those same nodes be able to provide it to you over the network? If you want to find confirmed transactions, you need to synchronize the blocks (potentially with BIP37 filtering, but that has severe privacy implications).  

---

### Answer by username_3 on 2016-07-22. Score: 0

If your goal is to replace a 3rd-party service like [blockchain.info](http://blockchain.info), then you have to run a full `bitcoind` node with `-txindex=1` and write your service to interface with it (see [here](https://bitcoin.stackexchange.com/questions/35707/what-are-pros-and-cons-of-txindex-option))

As far as I can tell, the only way to get `bitcoinj` to only download **your own** confirmed TXs (by ID) is by setting up **your** wallet with it and using the Bloom filter feature to download Merkle proofs w.r.t. to the block headers. However, this will not be helpful for your application, where you want to download **any** transaction. You will have to run a full node!


---

