Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timeout error on Dash and Doge while using unspent #55

Open
x011 opened this issue Jun 5, 2023 · 4 comments
Open

Timeout error on Dash and Doge while using unspent #55

x011 opened this issue Jun 5, 2023 · 4 comments

Comments

@x011
Copy link

x011 commented Jun 5, 2023

I'm getting the error below while using the unspent function on Dash and Doge. Any idea why? Is there a way to increase the timeout or change the blockchain provider for these two coins?

Traceback (most recent call last):
  File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\cryptos\coins_async\base.py", line 397, in unspent
    unspents = await self.client.unspent(value)
  File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\cryptos\electrumx_client\client.py", line 508, in unspent
    return await self.send_request("blockchain.scripthash.listunspent", scripthash)
  File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\cryptos\electrumx_client\client.py", line 389, in send_request
    await self._ensure_connected()
  File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\cryptos\electrumx_client\client.py", line 351, in _ensure_connected
    done, pending = await asyncio.wait([is_connected_task, self._connection_task],
  File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\asyncio\tasks.py", line 384, in wait
    return await _wait(fs, timeout, return_when, loop)
  File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\asyncio\tasks.py", line 491, in _wait
    await waiter
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\asyncio\tasks.py", line 456, in wait_for
    return fut.result()
asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\User\Desktop\wallets\py_bitcoinlib\btc_wallet.py", line 302, in <module>
    balance, balance_float = balance(wallet, network, args.testnet)
  File "C:\Users\User\Desktop\wallets\py_bitcoinlib\btc_wallet.py", line 198, in balance
    inputs = coin.unspent(wallet[network]['addr1'])
  File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\cryptos\coins\base.py", line 152, in unspent
    return self._run_async("unspent", addr, merkle_proof=merkle_proof)
  File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\cryptos\coins\base.py", line 84, in _run_async
    return fut.result(timeout=self.timeout * 2)
  File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\concurrent\futures\_base.py", line 458, in result
    return self.__get_result()
  File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\concurrent\futures\_base.py", line 403, in __get_result
    raise self._exception
  File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\cryptos\coins\base.py", line 68, in run
    result = await asyncio.wait_for(coro, timeout=self.timeout)
  File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\asyncio\tasks.py", line 458, in wait_for
    raise exceptions.TimeoutError() from exc
asyncio.exceptions.TimeoutError
@primal100
Copy link
Owner

Unfortunately it seems there are no ElectrumX servers for these coins at the moment, although there were in the past. There was some silly dispute in the Dash community over the Dash version of ElectrumX. If you know of available ElectrumX servers it it is possible to provide them as input when initializing the Coin instance.

@primal100
Copy link
Owner

primal100 commented Jun 29, 2023

Here's how to provide the servers as input:

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
Copy link
Author

x011 commented Jul 13, 2023

Hi,
Doge wallet provide some servers. Can they be used? if so, how could these values translate to the json format you sent before?

image

@primal100
Copy link
Owner

Should be ok now in v 2.0.9. Thanks for your assistance, @x011 .

python -m pip install --upgrade cryptos

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants