diff --git a/data/subscribe-block.py b/data/subscribe-block.py new file mode 100644 index 00000000..0b827085 --- /dev/null +++ b/data/subscribe-block.py @@ -0,0 +1,24 @@ +#!python3 +import sys +import zmq +import struct +from binascii import hexlify, unhexlify + +# Connect to the public block service. +url = 'tcp://mainnet.libbitcoin.net:9093' +if len(sys.argv) > 1: + url = sys.argv[1] + +context = zmq.Context() +socket = context.socket(zmq.SUB) +socket.connect(url) +socket.setsockopt(zmq.SUBSCRIBE, '') + +while True: + # Collect the response in parts. + sequence = struct.unpack(' 1: + url = sys.argv[1] + +context = zmq.Context() +socket = context.socket(zmq.SUB) +socket.connect(url) +socket.setsockopt(zmq.SUBSCRIBE, '') + +while True: + # Collect the response in parts. + sequence = struct.unpack(' 1: + url = sys.argv[1] + +context = zmq.Context() +socket = context.socket(zmq.SUB) +socket.connect(url) +socket.setsockopt(zmq.SUBSCRIBE, '') + +while True: + # Collect the response in parts. + sequence = struct.unpack('