Using a publisher socket to publish three things when they are happening in the Bitcoin client:
- New transactions
- New blocks
- New ipaddresses
This way there are no need to ask the bitcoin client if something new has happen. You will be notified!
To compile:
make -f makefile.unix USE_ZMQ=1
To run:
bitcoind -zmqpubbind="ipc://.bitcoin.pub"
A Python client that will print all the information:
[CODE] import zmq
def main():
context = zmq.Context()
socket = context.socket(zmq.SUB)
socket.setsockopt(zmq.SUBSCRIBE, "")
socket.connect("ipc://.bitcoin.pub")
while True:
msg = socket.recv()
print "%s" % (msg[8:])
if name == 'main': main() [/CODE]
For more commandline options, see bitcoind --help.