View in context in the libbitcoin Slack #general mirror.
Python 3.12.1 (main, Dec 13 2023, 14:03:38) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>>
>>> import zmq
>>> import struct
>>> from binascii import hexlify, unhexlify
>>>
>>>
>>> context = zmq.Context()
>>> socket = context.socket(zmq.REQ)
>>> socket.connect("tcp://mainnet.libbitcoin.net:9091")
<SocketContext(connect='tcp://mainnet.libbitcoin.net:9091')>
>>>
>>>
>>> socket
<zmq.Socket(zmq.REQ) at 0x7f5e51567540>
>>>
>>>
>>> socket.send(b'blockchain.fetch_transaction2', zmq.SNDMORE)
>>>
>>> socket.send(struct.pack('I', 42), zmq.SNDMORE)
>>>
>>>
>>> socket.send(unhexlify('60e030aba2f593caf913a7d96880ff227143bfc370d03dbaee37d582801ebd83')[::-1])
>>>
>>>
>>> response_command = socket.recv()
^CTraceback (most recent call last):
File "<stdin>", line 1, in <module>
File "_zmq.py", line 1156, in zmq.backend.cython._zmq.Socket.recv
File "_zmq.py", line 1191, in zmq.backend.cython._zmq.Socket.recv
File "_zmq.py", line 1278, in zmq.backend.cython._zmq._recv_copy
File "_zmq.py", line 160, in zmq.backend.cython._zmq._check_rc
KeyboardInterrupt
>>>
>>>
>>>