Bitcoin full node and query server

Jan 26, 2025

View in context in the libbitcoin Slack #general mirror.

neillm03:27
$ telnet mainnet.libbitcoin.net 9091
Trying 72.65.246.83...
Connected to mainnet.libbitcoin.net.
Escape character is '^]'.
^]
telnet> quit
Connection closed.
neillm02:40
$ cat libbitcoin.py 
#!python3
import zmq
import struct
from binascii import hexlify, unhexlify

# Connect to the server.
context = zmq.Context()
socket = context.socket(zmq.REQ)
socket.connect("tcp://mainnet.libbitcoin.net:9091")

# Make the request in parts.
socket.send(b'blockchain.fetch_transaction2', zmq.SNDMORE)
socket.send(struct.pack('I', 42), zmq.SNDMORE)
socket.send(unhexlify('60e030aba2f593caf913a7d96880ff227143bfc370d03dbaee37d582801ebd83')[::-1])

# Collect the response in parts.
response_command = socket.recv()
response_id = socket.recv()
response_body = socket.recv()

# Decode and print transaction from message payload.
print(hexlify(response_body[4:]).decode('ascii'))
🔥 1