primal100 / pybitcointools

Simple, common-sense Bitcoin-themed Python ECC library
Other
338 stars 152 forks source link

ElectrumX servers #57

Open maxclax opened 1 year ago

maxclax commented 1 year ago

Hello, when test new major branch with ElectrumX I have problem with servers. Some servers from .json files are down. And I can't check unspent, balance. Scrypt take one of them without check works it or not. How to update servers list and hold actual only?

api = Doge(testnet=False)
print(f"coin_symbol: {api.coin_symbol}")

priv = sha256('a big long brainwallet password')
pub = api.privtopub(priv)
addr = api.pubtoaddr(pub)
api.get_balances(addr)
print(f"priv: {priv}")
print(f"pub: {pub}")
print(f"addr: {addr}")
print(f"Balance: {api.get_balances(addr)}")

TimeoutError: 493 finally:
    494     timeout_handle.cancel()
maxclax commented 1 year ago

This project is dead, don't expect answers.

I hope not, because last month owner had added new major update with ElectrumX. I have testet it and only with Doge servers problem and sometime with other. Need some logic for update servers

primal100 commented 1 year ago

Hi @maxclax,

If you know of any Doge ElectrumX servers than you can provide them as input to the Doge coin class.

Create a servers.json file like this:

{
    "hostname_or_ip_address": {
        "pruning": "-",
        "t": "50001",
        "s": "50002",
        "version": "1.4"
    }
}

Once you have the .json file you can try this:

d = Doge(client_kwargs={'server_file': 'servers.json'})

You can also let me know any Doge ElectrumX servers you know about and I can update it in the file in this repository (cryptos/electrumx_client/servers/doge.json) so they will be in future releases.

x011 commented 1 year ago

Can this servers be used:

https://docs.komodoplatform.com/mmV1/coin-integration/electrum-servers-list.html#world-2

primal100 commented 1 year ago

Thanks @x011 that's a great resource. Will try in the next day or two.

primal100 commented 1 year ago

Version 2.0.9 up on pypi now with added servers for Doge and Dash. Your example is working now @maxclax.

python -m pip install --upgrade cryptos
>>> api.get_balances(addr)
[{'confirmed': 0, 'unconfirmed': 0, 'address': 'DLvceoVN5AQgXkaQ28q9qq7BqPpefFRp4E'}]