Bitcoin Forum
June 17, 2024, 04:21:29 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Cannot connect wallet to my own ElectrumX server  (Read 125 times)
velhoti (OP)
Member
**
Offline Offline

Activity: 84
Merit: 28


View Profile
April 21, 2022, 09:43:47 PM
Merited by ABCbits (1)
 #1

Hi all.

I installed the ElectrumX server but i can not connect to my server from my electrum wallet. I am behind CG-NAT, so it is a pure Tor server. I create the tor service in /etc/tor/torrc:

Code:
.
.
.
HiddenServiceDir /var/lib/tor/electrumx/
HiddenServicePort 50001 127.0.0.1:50001
HiddenServicePort 50002 127.0.0.1:50002
.
.
.

and this is my ElectrumX configuration file:


Code:
DB_DIRECTORY = <path>/electrumx/db
DAEMON_URL = <user>:<password>@127.0.0.1:8332/
COIN=Bitcoin
DONATION_ADDRESS=1LM9kqiRPMavcgocXmexw5vNn2XhVSi5Rq
BANNER_FILE= <path>/electrumx/banner
SERVICES = rpc://127.0.0.1:8000,wss://:50001
REPORT_SERVICES = wss://y32svarehxecrpvg62upqq7lgqhcrr3m35y4cqogy4nubsic2y3fofyd.onion:50001
SSL_CERTFILE =  <path>/electrumx/server.crt
SSL_KEYFILE =  <path>/electrumx/server.key
FORCE_PROXY = on
TOR_PROXY_HOST = 127.0.0.1
TOR_PROXY_PORT = 9050


The server is synced and have peers, the output of $electrumx_rpc getinfo:

Code:
{
    "coin": "Bitcoin",
    "daemon": "127.0.0.1:8332/",
    "daemon height": 732924,
    "db height": 732924,
    "db_flush_count": 1511,
    "groups": 0,
    "history cache": "0 lookups 0 hits 0 entries",
    "merkle cache": "0 lookups 0 hits 0 entries",
    "peers": {
        "bad": 25,
        "good": 55,
        "never": 5,
        "stale": 50,
        "total": 135
    },
    "pid": 2762,
    "request counts": {
        "getinfo": 15
    },
    "request total": 15,
    "sessions": {
        "count": 1,
        "count with subs": 0,
        "errors": 0,
        "logged": 0,
        "pending requests": 1,
        "subs": 0
    },
    "tx hashes cache": "0 lookups 0 hits 0 entries",
    "txs sent": 0,
    "uptime": "07h 18m 48s",
    "version": "ElectrumX 1.16.0"
}

I want to connect using two methods, the first is via Tor, i am trying the command:

Code:
$./electrum-4.1.5-x86_64.AppImage -1 -s y32svarehxecrpvg62upqq7lgqhcrr3m35y4cqogy4nubsic2y3fofyd.onion:50001:t -p socks5:localhost:9050

the second method is to use a ssh tunnel from other PC inside my own network to connect via rpc:

Code:
$ssh -p <port> -L 8000:127.0.0.1:8000 <user>@192.168.0.104
$./electrum-4.1.5-x86_64.AppImage -1 -s localhost:8000

Using both methods the dot indicating connection in electrum wallet stay red and do not connect to the server. I am using a new wallet to test . Do i missing some configuration or using some command with wrong sintaxe? Any help is welcome.

edit: Also https://1209k.com/bitcoin-eye/ele.php is showing my node as "Closed".
BitMaxz
Legendary
*
Offline Offline

Activity: 3290
Merit: 3018


BTC price road to $80k


View Profile WWW
April 21, 2022, 11:33:56 PM
Merited by velhoti (2), Pmalek (1)
 #2

Can you try to change your Daemon URL into localhost instead and edit the services replace them with the configuration below?

Code:
DB_DIRECTORY = <path>/electrumx/db
DAEMON_URL = rpcusername:rpcpassword@localhost
SERVICES = tcp://0.0.0.0:50001
COIN = Bitcoin
PEER_DISCOVERY = off
Source: https://www.youtube.com/watch?v=QiX0rR_o_fI


Also, try to change Peer_discovery on or off and check if your server will show up automatically in "electrumx_rpc peers".
Check this Reddit post below to get some idea about configuration.
- https://www.reddit.com/r/Electrum/comments/ggmduo/electrumx_over_tor_configuration_help/

I search more and it seems it's not easy to set up ElectrumX through TOR I have never seen someone succeed or share a guide on how they succeed in configuring their ElectrumX with TOR.

█▀▀▀











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











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

Activity: 84
Merit: 28


View Profile
April 22, 2022, 12:00:20 AM
 #3

Can you try to change your Daemon URL into localhost instead and edit the services replace them with the configuration below?


Also, try to change Peer_discovery on or off and check if your server will show up automatically in "electrumx_rpc peers".

With this configuration i lost the RPC connection, adding
Code:
SERVICES = tcp://0.0.0.0:50001,rpc://
i can run "electrumx_rpc peers" wich shows a list of peer only if  PEER_DISCOVERY = on.

Check this Reddit post below to get some idea about configuration.
- https://www.reddit.com/r/Electrum/comments/ggmduo/electrumx_over_tor_configuration_help/
I've tried this already, not worked, i believe is outdated, old electrum version.

I search more and it seems it's not easy to set up ElectrumX through TOR I have never seen someone succeed or share a guide on how they succeed in configuring their ElectrumX with TOR.
Run the server through ssh tunnel is a half solution already.

Unfortunately the suggested conf file not worked, the same behavior trying to connect be through ssh tunnel or TOR.
vv181
Legendary
*
Offline Offline

Activity: 1932
Merit: 1273


View Profile
April 22, 2022, 12:12:36 AM
 #4

Using your default config, try to connect using this:

Code:
$./electrum-4.1.5-x86_64.AppImage -1 -s y32svarehxecrpvg62upqq7lgqhcrr3m35y4cqogy4nubsic2y3fofyd.onion:50001:s -p socks5:localhost:9050

If that doesn't work, try to post your Electrum and Electrum server logs.
velhoti (OP)
Member
**
Offline Offline

Activity: 84
Merit: 28


View Profile
April 22, 2022, 12:21:32 AM
 #5

Using your default config, try to connect using this:

Code:
$./electrum-4.1.5-x86_64.AppImage -1 -s y32svarehxecrpvg62upqq7lgqhcrr3m35y4cqogy4nubsic2y3fofyd.onion:50001:s -p socks5:localhost:9050

If that doesn't work, try to post your Electrum and Electrum server logs.

the ElectrumX log:

Code:
.
.
.
Apr 22 01:14:26 <machine> electrumx_server[5086]: INFO:PeerManager:accepted new peer vps5.hsmiths.com from coins.py
Apr 22 01:14:26 <machine> electrumx_server[5086]: INFO:PeerManager:accepted new peer electrum.emzy.de from coins.py
Apr 22 01:14:27 <machine> electrumx_server[5086]: INFO:PeerManager:detected SOCKS5 proxy at 127.0.0.1:9050, auth: none
Apr 22 01:14:37 <machine> electrumx_server[5086]: INFO:PeerManager:blacklist from https://electrum.org/blacklist.json has 689 entries

the electrum wallet prints nothing, neither i found logs.

Possible missing user and password.
vv181
Legendary
*
Offline Offline

Activity: 1932
Merit: 1273


View Profile
April 22, 2022, 12:42:07 AM
Merited by velhoti (1)
 #6

Add -v when you execute the command, the log will be outputted into the CLI.

Code:
$./electrum-4.1.5-x86_64.AppImage -v -1 -s y32svarehxecrpvg62upqq7lgqhcrr3m35y4cqogy4nubsic2y3fofyd.onion:50001:s -p socks5:localhost:9050

Code:
Apr 22 01:14:27 <machine> electrumx_server[5086]: INFO:PeerManager:detected SOCKS5 proxy at 127.0.0.1:9050, auth: none
Possible missing user and password.
I believe there isn't any something wrong about that.
velhoti (OP)
Member
**
Offline Offline

Activity: 84
Merit: 28


View Profile
April 22, 2022, 12:53:39 AM
Merited by ABCbits (1), Pmalek (1)
 #7

Found the solution, following the reddit post:
https://www.reddit.com/r/Electrum/comments/ggmduo/electrumx_over_tor_configuration_help/
but with a slight difference in the command:

Code:
./electrum-4.1.5-x86_64.AppImage -1 -s y32svarehxecrpvg62upqq7lgqhcrr3m35y4cqogy4nubsic2y3fofyd.onion:50001:t -p socks5:localhost:9050
the connection must be throught TCP, not explicitly TOR.

I still investigating if use TCP+SSL instead TOR have implications in privacy, but works.

thanks for all help
vv181
Legendary
*
Offline Offline

Activity: 1932
Merit: 1273


View Profile
April 22, 2022, 01:20:17 AM
Merited by Pmalek (1)
 #8

Yes but you are connecting over an unencrypted network.

The reason why I suggest using :s instead of :t[1] is to make the Electrum wallet make an SSL/TCP connection as OP ElectrumX configuration(wss://:50001)[2].

If you are following the Reddit thread, with
Code:
SERVICES = tcp://127.0.0.1:50001,ssl://127.0.0.1:50002,rpc://127.0.0.1:8000
REPORT_SERVICES = tcp://xxxxxxxx.onion:50001,ssl://xxxxxxxx.onion:50002
Code:
./electrum-4.1.5-x86_64.AppImage -1 -s y32svarehxecrpvg62upqq7lgqhcrr3m35y4cqogy4nubsic2y3fofyd.onion:50001:t -p socks5:localhost:9050
Then it is should work, but you are transferring data over an unencrypted protocol, which surely not the recommended way.

[1] https://electrum.readthedocs.io/en/latest/protocol.html?highlight=tcp#server-peers-subscribe
[2] https://electrumx.readthedocs.io/en/latest/environment.html#services

the connection must be throught TCP, not explicitly TOR.
The connection is using TCP over Tor.

I still investigating if use TCP+SSL instead TOR have implications in privacy, but works.
Other than the two references above, try to see https://electrumx.readthedocs.io/en/latest/HOWTO.html#creating-a-self-signed-ssl-certificate
velhoti (OP)
Member
**
Offline Offline

Activity: 84
Merit: 28


View Profile
April 22, 2022, 01:41:20 AM
 #9

it works also with ssl connection, i configured already SSl certificates, with the command:
Code:
./electrum-4.1.5-x86_64.AppImage -1 -s y32svarehxecrpvg62upqq7lgqhcrr3m35y4cqogy4nubsic2y3fofyd.onion:50002:s -p socks5:localhost:9050

at least not plain text
vv181
Legendary
*
Offline Offline

Activity: 1932
Merit: 1273


View Profile
April 23, 2022, 09:53:12 PM
 #10

it works also with ssl connection, i configured already SSl certificates, with the command:
~
at least not plain text
Yup that's good Wink

That should explain why the OP configurations doesn't work. I thought the wss:// electrum server protocol can be used with Electrum wallet tcp/tls config.
velhoti (OP)
Member
**
Offline Offline

Activity: 84
Merit: 28


View Profile
April 24, 2022, 02:00:27 PM
 #11

I was inspecting the electrum wallet code:

Code:
help="set server host:port:protocol, where protocol is either t (tcp) or s (ssl)")
Source: https://github.com/spesmilo/electrum/blob/bb2e4109422dc46652bc6579bcfc8149e3c86758/electrum/commands.py

There is no option to create a WSS connection, only TCP and SSL (through tor). Then i presume it is the correct configuration.
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!