<p>Beginning with v0.8.2 of the Bitcoin-Qt/bitcoind client is -walletnotify option that can run a process when a transaction that affects the wallet is seen.</p>

CC BY-SA 3.0
2013-05-28T14:32:13.543Z
2013-05-28T14:32:13.543Z
Stephen Gornick
<p>You can do this using BitcoinJ by implementing the <a href="http://code.google.com/p/bitcoinj/source/browse/core/src/main/java/com/google/bitcoin/core/PeerEventListener.java" rel="nofollow">PeerEventListener</a> interface.</p>

<p>The <a href="http://code.google.com/p/bitcoinj/source/browse/core/src/main/java/com/google/bitcoin/core/PeerEventListener.java#74" rel="nofollow">OnTransaction</a> will be called every time a new Transaction is broadcast out and received from a Peer.</p>

CC BY-SA 3.0
2017-11-24T14:10:38.767Z
moved to https://bitcoinj.github.io/
jordiburgos
CC BY-SA 3.0
2013-03-05T00:25:00.580Z
2013-03-05T00:25:00.580Z
Pelle
<p>I searched with all terms I could think of, but could not find anything in direction that helps me.</p>

<p>In the context of a research project, I am trying to listen to all transactions that are broadcasted over the Bitcoin network. So we are especially interested in transactions, that will not occur in the blockchain later (e.g. got "lost", took very  long to get accepted, double spent, etc.).</p>

<p>I know of bitcoind, but the list of transactions is rather pull-oriented, whereby I'd like to have something like a callback, that informs me of a new transaction.</p>

<p>Can anybody recommend any software/libs/projects here?</p>

<p>PS: all I intend to do is read-only, so there does not have to be any wallet-support etc. I just like to get a deeper view into how the Bitcoin network actually works.</p>

CC BY-SA 3.0
2013-03-05T02:13:13.650Z
Related: http://bitcoin.stackexchange.com/questions/7942
Stephen Gornick
CC BY-SA 3.0
2014-10-28T04:49:50.813Z
Did you finalize on bitcoinj? Can you share sample code?
Jus12
<network><logging>
Listening to all transactions of the Bitcoin network
Bouncner
# Listening to all transactions of the Bitcoin network

(Asked by: username_0 on 2013-03-05)

I searched with all terms I could think of, but could not find anything in direction that helps me.

In the context of a research project, I am trying to listen to all transactions that are broadcasted over the Bitcoin network. So we are especially interested in transactions, that will not occur in the blockchain later (e.g. got "lost", took very long to get accepted, double spent, etc.).

I know of bitcoind, but the list of transactions is rather pull-oriented, whereby I'd like to have something like a callback, that informs me of a new transaction.

Can anybody recommend any software/libs/projects here?

PS: all I intend to do is read-only, so there does not have to be any wallet-support etc. I just like to get a deeper view into how the Bitcoin network actually works.

**Tags:** network, logging

> **Comments:**
> **username_1**: Related: http://bitcoin.stackexchange.com/questions/7942  
> **username_2**: Did you finalize on bitcoinj? Can you share sample code?  

---

## 2 answers

### Answer by username_3 on 2013-03-05. Score: 4 | Accepted answer

You can do this using BitcoinJ by implementing the [PeerEventListener](http://code.google.com/p/bitcoinj/source/browse/core/src/main/java/com/google/bitcoin/core/PeerEventListener.java) interface.

The [OnTransaction](http://code.google.com/p/bitcoinj/source/browse/core/src/main/java/com/google/bitcoin/core/PeerEventListener.java#74) will be called every time a new Transaction is broadcast out and received from a Peer.

> **Comments:**
> **username_4**: moved to https://bitcoinj.github.io/  

---

### Answer by username_1 on 2013-05-28. Score: 1

Beginning with v0.8.2 of the Bitcoin-Qt/bitcoind client is -walletnotify option that can run a process when a transaction that affects the wallet is seen.


---

