I would like to be able to get some response from ElectrumX/Fulcrum servers using Linux command line tools. I know I can query servers using Python and other programming language but I wonder if it's easily possibly in bash or similar shells.
Python example:
import socket
import ssl
from time import sleep
hostname = 'chipnet.c3-soft.com'
port = 64002
context = ssl.create_default_context()
data = """{"method":"server.version","params":[],"id":194}"""
with socket.create_connection((hostname, port)) as sock:
with context.wrap_socket(sock, server_hostname=hostname) as ssock:
ssock.send(data.encode('utf-8')+b'\n')
sleep(0.5)
print(ssock.recv(1024))
Servers are usually availables as TCP, SSL, WS or WSS, I'm mostly interested of connecting to TCP or SSL.