I'm trying to connect to Bitcoin's ZeroMQ queue, having no success and don't even know where my problem is. Here is what I did so far on my Ubuntu 14.04:
- Installed Bitcoin via
sudo apt-get install bitcoin-qt
- installed ZeroMQ via
wget http://download.zeromq.org/zeromq-4.1.2.tar.gz && cd libzmq/ && ./autogen.sh && ./configure && make -j 4 && make check && make install
- In my Scala application I use
jeromq
:libraryDependencies += "org.zeromq" % "jeromq" % "0.3.5"
- In Bitcoin's
bitcoin.conf
I add the following line:zmqpubhashtx=tcp://127.0.0.1:28332
(i'm only interested in incoming tx id's)
After doing all that I launch Bitcoin, then I launch my Scala app with the following code:
import org.zeromq.ZMQ
val context = ZMQ.context(1)
val socket = context.socket(ZMQ.SUB) // Since server side is PUB
socket.connect("tcp://127.0.0.1:28332")
while (true) {
logger info socket.recv.length.toString
}
And I receive no messages. Thing is I don't even know what the problem is or how to test it. Does apt-get
version of Bitcoin even has ZeroMQ support? On jeromq
github it is stated that it's Based on libzmq 3.2.5
while Bitcoin requires ZeroMQ API version 4.x or newer
, could that be a reason? Or perhaps it's something else entirely?