electrumx icon indicating copy to clipboard operation
electrumx copied to clipboard

server terminated abnormally immediately after starting

Open naphelge opened this issue 5 months ago • 5 comments

After building electrumx in ~, and systemctl enable/start the server terminates abnormally with the following:

Jul 31 01:29:52 home71 systemd[1]: Started Electrumx.
Jul 31 01:29:52 home71 electrumx_server[28652]: INFO:electrumx:ElectrumX server starting
Jul 31 01:29:52 home71 electrumx_server[28652]: ERROR:electrumx:ElectrumX server terminated abnormally
Jul 31 01:29:52 home71 electrumx_server[28652]: Traceback (most recent call last):
Jul 31 01:29:52 home71 electrumx_server[28652]:   File "~/electrumx/electrumx_server", line 31, in main
Jul 31 01:29:52 home71 electrumx_server[28652]:     env = Env()
Jul 31 01:29:52 home71 electrumx_server[28652]:   File "~/electrumx/electrumx/server/env.py", line 50, in __init__
Jul 31 01:29:52 home71 electrumx_server[28652]:     self.coin = Coin.lookup_coin_class(coin_name, network)
Jul 31 01:29:52 home71 electrumx_server[28652]:                 ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
Jul 31 01:29:52 home71 electrumx_server[28652]:   File "~/electrumx/electrumx/lib/coins.py", line 65, in lookup_coin_class
Jul 31 01:29:52 home71 electrumx_server[28652]:     raise CoinError('unknown coin {} and network {} combination'
Jul 31 01:29:52 home71 electrumx_server[28652]:                     .format(name, net))
Jul 31 01:29:52 home71 electrumx_server[28652]: electrumx.lib.coins.CoinError: unknown coin Bitcoin and network mainnet combination
Jul 31 01:29:52 home71 systemd[1]: electrumx.service: Deactivated successfully.

in /etc/electrumx.conf I have COIN = Bitcoin which seemed to be a common param for COIN in several howtos I looked at for reference.

Any ideas what could be the issue or what to look at? Thks.

naphelge avatar Jul 31 '25 06:07 naphelge

What version of electrumx? Please try with latest.

SomberNight avatar Jul 31 '25 11:07 SomberNight

I just cloned the link listed when the code button the page is clicked, the link (https://github.com/spesmilo/electrum.git) labeled: "Clone using the web URL". I just assumed that would clone the latest version.

How can I confirm the version # as I don't see anything referencing version number in the cloned electrumx folder? Thks.

naphelge avatar Jul 31 '25 20:07 naphelge

the link (https://github.com/spesmilo/electrum.git) labeled: "Clone using the web URL"

That link is for the client repo. We are talking about the server here.

Jul 31 01:29:52 home71 electrumx_server[28652]:   File "~/electrumx/electrumx/server/env.py", line 50, in __init__
Jul 31 01:29:52 home71 electrumx_server[28652]:     self.coin = Coin.lookup_coin_class(coin_name, network)

This version can't be anywhere near latest. Look at the file paths and line numbers.

https://github.com/spesmilo/electrumx/blob/be58fd8f553b0226200633ce1baa9e8d7aa41b73/src/electrumx/server/env.py#L54

instead of electrumx/electrumx/server/env.py it should be electrumx/src/electrumx/server/env.py

and instead of line 50, it should be line 54.

How can I confirm the version # as I don't see anything referencing version number in the cloned electrumx folder? Thks.

There are multiple ways but maybe in your case you should locate this file: https://github.com/spesmilo/electrumx/blob/be58fd8f553b0226200633ce1baa9e8d7aa41b73/src/electrumx/init.py#L6

SomberNight avatar Aug 01 '25 12:08 SomberNight

Ok thks. Yeah my paste of the url to clone in my reply above was a typo. I did actually git clone some version of electrumx, but it must be a different/earlier version as there was no "src" folder in the main folder, but a setup.py file that I used to build with.

Anyway, I did get 1.18.0 cloned in dedicated user electrumx's home folder ~/electrumx, and I eventually satisfied all of the setup systemd and electrumx.conf params to get the server finally running:

$systemctl status electrumx
● electrumx.service - Electrumx
     Loaded: loaded (/etc/systemd/system/electrumx.service; enabled; preset: disabled)
     Active: active (running) since Sat 2025-08-02 03:52:04 CDT; 19s ago
 Invocation: a3dbdcbb29664604bfabbd49ba3d5e9c
   Main PID: 128708 (python3)
      Tasks: 2 (limit: 18996)
     Memory: 25.1M (peak: 25.5M)
        CPU: 203ms
     CGroup: /system.slice/electrumx.service
             └─128708 python3 /home/electrumx/electrumx/electrumx_server

Aug 02 03:52:04 home71 electrumx_server[128708]: INFO:Controller:Python version: 3.13.5 (main, Jun 21 2025, 09:35:00) [GCC 15.1.1 20250425]
Aug 02 03:52:04 home71 electrumx_server[128708]: INFO:Controller:software version: ElectrumX 1.18.0
Aug 02 03:52:04 home71 electrumx_server[128708]: INFO:Controller:aiorpcX version: 0.25.0
Aug 02 03:52:04 home71 electrumx_server[128708]: INFO:Controller:supported protocol versions: 1.4-1.4.3
Aug 02 03:52:04 home71 electrumx_server[128708]: INFO:Controller:event loop policy: None
Aug 02 03:52:04 home71 electrumx_server[128708]: INFO:Controller:reorg limit is 200 blocks
Aug 02 03:52:04 home71 electrumx_server[128708]: INFO:Daemon:daemon #1 at localhost:8332/ (current)
Aug 02 03:52:04 home71 electrumx_server[128708]: INFO:DB:switching current directory to /mnt/bdata/electrumx/db
Aug 02 03:52:04 home71 electrumx_server[128708]: INFO:DB:using leveldb for DB backend
Aug 02 03:52:04 home71 electrumx_server[128708]: ERROR:Daemon:daemon service refused: Unauthorized.  Retrying occasionally...

But as you can see I am getting a "daemon service refused: Unauthorized" error, which I assume is bitcoind refusing to let electrumx connect.

Here is my electrumx.conf:

# default /etc/electrumx.conf for systemd

# REQUIRED
#DB_DIRECTORY = /db
DB_DIRECTORY = /mnt/bdata/electrumx/db
# Bitcoin Node RPC Credentials
#DAEMON_URL = http://username:password@hostname:port/
#DAEMON_URL = bitcoin@localhost
DAEMON_URL = bitcoin:bitcoin@localhost
SERVICES = tcp://0.0.0.0:50001
# COIN = BitcoinSegwit
COIN = Bitcoin
PEER_DISCOVERY = off
COST_SOFT_LIMIT = 0
COST_HARD_LIMIT = 0

# See http://electrumx.readthedocs.io/en/latest/environment.html for
# information about other configuration settings you probably want to consider.

I run bitcoind with a dedicated user "bitcoin" that was initially setup without a password, but then when I saw the "service refused" error from electrumx, I went ahead and set a passwd for user bitcoin to see if perhaps adding a passwd (bitcoin:bitcoin) would resolve the issue, but apparently not.

I wonder if you have any obvious suggestions for this issue by chance? Thks.

naphelge avatar Aug 02 '25 09:08 naphelge

you need to specify the port... like this: DAEMON_URL = http://bitcoin:[email protected]:8332/

cipig avatar Aug 02 '25 13:08 cipig