ElectrumX method blockchain.address.get_balance removed, how to get the script hash of a public addres and get balance? Reading the ElectrumX documentation, found that the method for getting balance of any public address was: blockchain.address.get_balance, but was removed. Now, I understand that blockchain.scripthash.get_balance is the way for getting balances for any public address, but it requires a &quot;scriphash&quot;.
Checking documentation for Script Hashes shows stepts for hashing the address to get script hash.
With this python code, I can get the electrum server data:
import json
from time import sleep

port = 50001
host = '127.0.0.1'

content = {
    &quot;method&quot;: &quot;blockchain.scripthash.get_balance&quot;,
    &quot;params&quot;: [&quot;af6df685465a42b753bf72dfdf36c43ea3c2931025411940609da6f2404b00c4&quot;], # this is a tx_hash
    &quot;id&quot;: 0
}

def electrumx(host, port, content):
    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    sock.connect((host, port))
    sock.sendall(json.dumps(content).encode('utf-8')+b'\n')
    sleep(0.5)
    sock.shutdown(socket.SHUT_WR)
    res = &quot;&quot;
    while True:
        data = sock.recv(1024)
        if (not data):
            break
        res += data.decode()
    print(res)
    sock.close()

electrumx(host, port, content)

With a transaction hash, it throws some results, not exactly the balance of any address involved:
{&quot;id&quot;:0,&quot;jsonrpc&quot;:&quot;2.0&quot;,&quot;result&quot;:{&quot;confirmed&quot;:0,&quot;unconfirmed&quot;:0}}

My questions are:

What means &quot;script hash&quot; of a public address?
Is required to use a transaction hash, like in the code?
Why when using tx hash always shows &quot;result&quot;:{&quot;confirmed&quot;:0,&quot;unconfirmed&quot;:0}
even if the address has funds.
Can the script hash be obtained just from a public address?

Thank you very much.
Well, it's been a long time, but I've been able to find a way by myself.
The python function for getting script hash is this:
from pycoin.symbols.btc import network
import hashlib
def get_script_hash(addr):
    script = network.parse.address(addr).script()
    return hashlib.sha256(script).digest()[::-1].hex()

And the full code to check the balance of a public address from a local electrum server is:
import socket
import json
from time import sleep
from pycoin.symbols.btc import network
import hashlib

port = 50001
host = '127.0.0.1'


def get_script_hash(addr):
    script = network.parse.address(addr).script()
    return hashlib.sha256(script).digest()[::-1].hex()


def electrumx(host, port, content):
    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    sock.connect((host, port))
    sock.sendall(json.dumps(content).encode('utf-8') + b'\n')
    sleep(0.5)
    sock.shutdown(socket.SHUT_WR)
    res = &quot;&quot;
    while True:
        data = sock.recv(1024)
        if not data:
            break
        res += data.decode()
    print(res)
    balance = eval(res)['result']
    print(f'{addr} has {balance[&quot;confirmed&quot;] / 100000000} confirmed bitcoins')
    print(f'{addr} has {balance[&quot;unconfirmed&quot;] / 100000000} unconfirmed bitcoins')
    sock.close()


if __name__ == &quot;__main__&quot;:
    addr = &quot;1x8cQ1gKJ5dwBRr1mjsYfsJbWBHJDnxg9&quot;
    script_hash = get_script_hash(addr)
    content = {
        &quot;method&quot;: &quot;blockchain.scripthash.get_balance&quot;,
        &quot;params&quot;: [script_hash],
        &quot;id&quot;: 0}
    electrumx(host, port, content)

Thank you.