Bitcoin Forum
May 06, 2024, 10:14:34 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: [Solved] ElectrumX Server cannot auth itself to Bitcoin daemon RPC interface  (Read 104 times)
darkv0rt3x (OP)
Hero Member
*****
Offline Offline

Activity: 1204
Merit: 658


I rather die on my feet than to live on my knees


View Profile
January 29, 2021, 09:33:26 PM
Last edit: February 02, 2021, 09:58:24 PM by darkv0rt3x
Merited by hugeblack (2)
 #1

Hello.

I'm trying to setup ElectrumX server so that I can connect Electrum wallet to my node. The ElectrumX server I'm using is hosted here:
https://github.com/spesmilo/electrumx

My config file is this:
Code:
# default /etc/electrumx.conf for systemd

# REQUIRED
DB_DIRECTORY = /home/[REPLACEDUSER]/Storage/electrumx

# Bitcoin Node RPC Credentials
#DAEMON_URL = http://[REPLACEDUSER]:[REPLACEDPASSWD]@localhost:8332/

# Database
DB_ENGINE = leveldb

# Username
USERNAME = [REPLACEDUSER]
# Binary
ELECTRUMX = /home/[REPLACEDUSER]/.local/bin/electrum_server

# COIN = Bitcoin
COIN = Bitcoin

# Logs
ANON_LOGS = fuck off :)

# Daemon URL
DAEMON_URL = http://[REPLACEDUSER]:[REPLACEDPASSWD]@127.0.0.1:8332/

# Misc
CACHE_MB = 1800
MAX_SESSIONS = 500
SERVICES = tcp://:10001,rpc://:8001
#EVENT_LOOP_POLICY = uvloop
PEER_DISCOVERY = self
INITIAL_CONCURRENT = 50
# See http://electrumx.readthedocs.io/en/latest/environment.html for
# information about other configuration settings you probably want to consider.


My bitcoin node config file is:
Code:
dbbatchsize=4294967000
dbcache=12288
par=1 -daemon
server=1
#rpcauth=[REPLACEDUSER]:[REPLACEDHASH]
rpcallowip=127.0.0.1
rpcport=8332
rpcuser=[REPLACEDUSER]
rpcpassword=[REPLACEDPASSWD]
maxtxfee=0.00002000
mintxfee=0.00000002

# Options only for mainnet
[main]
conf=/media/WdElements/blockchain-backup/bitcoin.conf
datadir=/media/WdElements/blockchain-backup
#debug=net
debug=rpc
debuglogfile=/media/WdElements/blockchain-backup/debug.log
addresstype=bech32
changetype=bech32
txindex=1
listen=1


But as soon as I start ElectrumX server, I start seeing this in bitcoind log:
Code:

2021-01-29T21:27:09Z ThreadRPCServer incorrect password attempt from [::1]:41976
2021-01-29T21:27:13Z ThreadRPCServer incorrect password attempt from [::1]:41976
2021-01-29T21:27:17Z ThreadRPCServer incorrect password attempt from [::1]:41976
2021-01-29T21:27:22Z ThreadRPCServer incorrect password attempt from [::1]:41976


I already tried the following and it works:
Code:
$ bitcoin-cli -rpcconnect=127.0.0.1 -rpcport=8332 -rpcuser=[REPLACEDUSER] -rpcpassword=[REPLACEDHASH] getblockchaininfo
{
  "chain": "main",
  "blocks": 668255,
  "headers": 668255,
  "bestblockhash": "0000000000000000000b3d7355f1b412aeca89f52ee3d0b8ee36054320fcc9b2",
  "difficulty": 20823531150111.52,
  "mediantime": 1611952664,
  "verificationprogress": 0.9999906737057773,
  "initialblockdownload": false,
  "chainwork": "000000000000000000000000000000000000000018bda4a3fbdacab0a567a720",
  "size_on_disk": 368883866225,
  "pruned": false,
  "softforks": {
    "bip34": {
      "type": "buried",
      "active": true,
      "height": 227931
    },
    "bip66": {
      "type": "buried",
      "active": true,
      "height": 363725
    },
    "bip65": {
      "type": "buried",
      "active": true,
      "height": 388381
    },
    "csv": {
      "type": "buried",
      "active": true,
      "height": 419328
    },
    "segwit": {
      "type": "buried",
      "active": true,
      "height": 481824
    }
  },
  "warnings": "This is a pre-release test build - use at your own risk - do not use for mining or merchant applications"
}

and I can see this output in bitcoin daemon when I run the above command:
Code:
2021-01-29T21:28:28Z ThreadRPCServer method=getblockchaininfo user=[REPLACEDUSER]

So, what am I missing? I can't run any ElectrumX RPC commands. For instance:
Code:
$ electrumx_rpc -p 8001 getinfo
cannot connect - is ElectrumX catching up, not running, or is 8001 the wrong RPC port?

Bitcoin is energy. Bitcoin is freedom
I rather die on my feet than living on my knees!
1715033674
Hero Member
*
Offline Offline

Posts: 1715033674

View Profile Personal Message (Offline)

Ignore
1715033674
Reply with quote  #2

1715033674
Report to moderator
1715033674
Hero Member
*
Offline Offline

Posts: 1715033674

View Profile Personal Message (Offline)

Ignore
1715033674
Reply with quote  #2

1715033674
Report to moderator
1715033674
Hero Member
*
Offline Offline

Posts: 1715033674

View Profile Personal Message (Offline)

Ignore
1715033674
Reply with quote  #2

1715033674
Report to moderator
BitcoinCleanup.com: Learn why Bitcoin isn't bad for the environment
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715033674
Hero Member
*
Offline Offline

Posts: 1715033674

View Profile Personal Message (Offline)

Ignore
1715033674
Reply with quote  #2

1715033674
Report to moderator
BitMaxz
Legendary
*
Online Online

Activity: 3248
Merit: 2965


Block halving is coming.


View Profile WWW
January 29, 2021, 11:59:31 PM
 #2

Did you run this command under the container?

Can you share your console output here?

use this command:

Code:
$ docker ps

Then share the output here

Also, try other port instead of 8001 use 8000

Code:
$ electrumx_rpc -p 8000 getinfo

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
darkv0rt3x (OP)
Hero Member
*****
Offline Offline

Activity: 1204
Merit: 658


I rather die on my feet than to live on my knees


View Profile
January 30, 2021, 01:43:42 AM
 #3

Did you run this command under the container?

Can you share your console output here?

use this command:

Code:
$ docker ps

Then share the output here

Also, try other port instead of 8001 use 8000

Code:
$ electrumx_rpc -p 8000 getinfo

I'm not using containers. I don't even have a docker application installed.
I cloned the repository, created the service file and the config file and started the server. Then, the rpc interface isn't authorized, I can't figure out why!

A changed the rpc port in /etc/electrumx.conf to 8000 and tried what you suggested, but still the same problem.
Code:
$ electrumx_rpc -p 8000 getinfo
cannot connect - is ElectrumX catching up, not running, or is 8000 the wrong RPC port?

Bitcoin is energy. Bitcoin is freedom
I rather die on my feet than living on my knees!
BitMaxz
Legendary
*
Online Online

Activity: 3248
Merit: 2965


Block halving is coming.


View Profile WWW
January 30, 2021, 07:06:29 AM
 #4

Can you edit the ElectrumX config again and try to change this part

Code:
SERVICES = tcp://:10001,rpc://:8001

Change it with this.

Code:
SERVICES = tcp://:10001,rpc://0.0.0.0:8000

I just got an idea from this issue below.
- https://github.com/lukechilds/docker-electrumx/issues/25#issuecomment-496086157

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
darkv0rt3x (OP)
Hero Member
*****
Offline Offline

Activity: 1204
Merit: 658


I rather die on my feet than to live on my knees


View Profile
January 30, 2021, 10:18:17 AM
 #5

Can you edit the ElectrumX config again and try to change this part

Code:
SERVICES = tcp://:10001,rpc://:8001

Change it with this.

Code:
SERVICES = tcp://:10001,rpc://0.0.0.0:8000

I just got an idea from this issue below.
- https://github.com/lukechilds/docker-electrumx/issues/25#issuecomment-496086157

Same...

Code:
# default /etc/electrumx.conf for systemd

# REQUIRED
DB_DIRECTORY = /home/[REPLACEDUSER]/Storage/electrumx

# Bitcoin Node RPC Credentials
#DAEMON_URL = http://[REPLACEDUSER]:[REPLACEDPASSWD]@localhost:8332/

# Database
DB_ENGINE = leveldb

# Username
USERNAME = [REPLACEDUSER]

# Binary
ELECTRUMX = /home/[REPLACEDUSER]/.local/bin/electrum_server

# COIN = Bitcoin
COIN = Bitcoin

# Logs
ANON_LOGS = fuck off :)

# Daemon URL
#DAEMON_URL = [REPLACEDUSER]:[REPLACEDPASSWD]@127.0.0.1

# Misc
CACHE_MB = 1800
MAX_SESSIONS = 500
SERVICES = tcp://:10001,rpc://0.0.0.0:8000
#EVENT_LOOP_POLICY = uvloop
PEER_DISCOVERY = self
INITIAL_CONCURRENT = 50
# See http://electrumx.readthedocs.io/en/latest/environment.html for
# information about other configuration settings you probably want to consider.


When I start Electrumx_server I get thin in journalctl -u electrumx:
Code:
Jan 30 10:16:21 Host electrumx_server[31259]: INFO:electrumx:ElectrumX server starting
Jan 30 10:16:21 Host electrumx_server[31259]: INFO:electrumx:logging level: INFO
Jan 30 10:16:21 Host electrumx_server[31259]: INFO:Controller:Python version: 3.7.3 (default, Jul 25 2020, 13:03:44)  [GCC 8.3.0]
Jan 30 10:16:21 Host electrumx_server[31259]: INFO:Controller:software version: ElectrumX 1.16.0
Jan 30 10:16:21 Host electrumx_server[31259]: INFO:Controller:aiorpcX version: 0.18.5
Jan 30 10:16:21 Host electrumx_server[31259]: INFO:Controller:supported protocol versions: 1.4-1.4.2
Jan 30 10:16:21 Host electrumx_server[31259]: INFO:Controller:event loop policy: None
Jan 30 10:16:21 Host electrumx_server[31259]: INFO:Controller:reorg limit is 200 blocks
Jan 30 10:16:21 Host electrumx_server[31259]: INFO:Daemon:daemon #1 at localhost:8332/ (current)
Jan 30 10:16:21 Host electrumx_server[31259]: INFO:DB:switching current directory to /home/[RPLACEDUSER]n/Storage/electrumx
Jan 30 10:16:21 Host electrumx_server[31259]: INFO:DB:using leveldb for DB backend
Jan 30 10:16:21 Host electrumx_server[31259]: ERROR:Daemon:daemon service refused: Unauthorized.  Retrying occasionally...

Bitcoin is energy. Bitcoin is freedom
I rather die on my feet than living on my knees!
darkv0rt3x (OP)
Hero Member
*****
Offline Offline

Activity: 1204
Merit: 658


I rather die on my feet than to live on my knees


View Profile
February 01, 2021, 08:31:15 PM
Merited by hugeblack (2)
 #6

Ok, I managed to make it work. It's catching up with bitcoin node now.

So, my setup is the following:

Unit file in /etc/systemd/system/electrumx.service

Code:
[Unit]
Description=Electrumx
After=network.target

[Service]
EnvironmentFile=/etc/electrumx.conf
ExecStart=/home/[REPLACEDUSER]/.local/bin/electrumx_server
User=[REPLACEDUSER]
LimitNOFILE=8192
TimeoutStopSec=20min

[Install]
WantedBy=multi-user.target

and then, there is the config file I saved in the default dir /etc/electrumx.conf with this content:

Code:
# default /etc/electrumx.conf for systemd

# REQUIRED
DB_DIRECTORY = /home/[REPLACEDUSER]/Storage/electrumx

# Database
DB_ENGINE = leveldb

# Username
USERNAME = [REPLACEDUSER]

# Binary
ELECTRUMX = /home/[REPLACEDUSER]/.local/bin/electrum_server

# COIN = Bitcoin
COIN = Bitcoin

# Logs
ANON_LOGS = fuck off :)
LOG_LEVEL = debug

# Daemon URL / RPC interface credentials
DAEMON_URL = [REPLACEDUSER]:[REPLACEDPASSWD]@127.0.0.1:8332

# Misc
CACHE_MB = 1800
MAX_SESSIONS = 500
SERVICES = tcp://:10001,rpc://127.0.0.1:8000
#EVENT_LOOP_POLICY = uvloop
PEER_DISCOVERY = self
INITIAL_CONCURRENT = 50
# See http://electrumx.readthedocs.io/en/latest/environment.html for
# information about other configuration settings you probably want to consider.

At this moment, my data folder is almost 80Gb. Hope this is normal

Thanks
D4rk

Bitcoin is energy. Bitcoin is freedom
I rather die on my feet than living on my knees!
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!