spesmilo / electrumx

Alternative implementation of spesmilo/electrum-server
MIT License
432 stars 343 forks source link

Clients cannot connect to my server/daemon error #194

Closed HotCrypt closed 1 year ago

HotCrypt commented 1 year ago

Hi, I correctly installed Electrumx (clearnet) on Raspberry 4 8go as well as Btc core v22 with onlynet=ipv6(i don't want onion). I would like to solve these problems please:

WARNING:Env: reduction of the maximum number of sessions from 2500 to 674 because your limit of open files is 1024 Do you know where the file is to modify this directly?

Another thing, I don't get any incoming connection, I use electrumx_rpc getinfo:

"tx hashes cache": "0 lookups 0 hits 0 entries"

Peers works, I have 92 good peers, my personal ip is also present.

Thank you ✌️

SomberNight commented 1 year ago

WARNING:Env: reduction of the maximum number of sessions from 2500 to 674 because your limit of open files is 1024 Do you know where the file is to modify this directly?

Depends on how you are launching electrumx. e.g.: https://github.com/spesmilo/electrumx/blob/fb037fbd23b8ce418cd67d68bbf8d32e69ecef62/contrib/systemd/electrumx.service#L10

Another thing, I don't get any incoming connection

Can you connect to your own server?

HotCrypt commented 1 year ago

WARNING:Env: reduction of the maximum number of sessions from 2500 to 674 because your limit of open files is 1024

Do you know where the file is to modify this directly?

Depends on how you are launching electrumx. e.g.: https://github.com/spesmilo/electrumx/blob/fb037fbd23b8ce418cd67d68bbf8d32e69ecef62/contrib/systemd/electrumx.service#L10

hi, thanks for your help. I looked and my file is ok: 8192. It maybe not be here to change my problem limit.

Another thing, I don't get any incoming connection

Can you connect to your own server?

*Yes, I’m well connected, here are my script variables env:


REQUIRED env variables
export COIN=BitcoinSegwit
export DB_DIRECTORY=/home/bitcoin/electrumx/electrumx/server
export DAEMON_URL="http://X@localhost:8332"
export CACHE_MB=800
export MAX_SESSIONS=2500

Optional env variables

export PUBLIC_IP=$(curl -s http://whatismyip.akamai.com/)
export SERVICES=rpc://127.0.0.1:8000,tcp://:50001,ssl://:50002,ws://:50003,wss://:50004
export REPORT_SERVICES=ssl://$PUBLIC_IP:50002
export SSL_CERTFILE=/etc/ssl/certs/ssl-cert-snakeoil.pem
export SSL_KEYFILE=/etc/ssl/private/ssl-cert-snakeoil.key

replace with your wallet address!

export DONATION_ADDRESS="X"

log all sent transactions electrumx_server


*And my Btc core file config:


server=1
daemon=1
txindex=1
listen=1

rpcuser=X
rpcpassword=X
rpcallowip=192.168.1.18
rpcport=8332

onlynet=ipv6
zmqpubrawblock=tcp://127.0.0.1:28332
zmqpubrawtx=tcp://127.0.0.1:28333

dbcache=2000
maxorphantx=10
maxmempool=50
maxconnections=40
maxuploadtarget=2500

ElectrumX start:

INFO:electrumx:ElectrumX server starting
WARNING:Env:lowered maximum sessions from 2,500 to 674 because your open file limit is 1,024
INFO:electrumx:logging level: INFO
INFO:Controller:Python version: 3.9.2 (default, Feb 28 2021, 17:03:44)  [GCC 10.2.1 20210110]
INFO:Controller:software version: ElectrumX 1.16.0
INFO:Controller:aiorpcX version: 0.22.1
INFO:Controller:supported protocol versions: 1.4-1.4.2
INFO:Controller:event loop policy: None
INFO:Controller:reorg limit is 200 blocks
INFO:Daemon:daemon #1 at localhost:8332/ (current)
INFO:DB:switching current directory to /home/bitcoin/electrumx/electrumx/server
INFO:DB:using leveldb for DB backend
INFO:DB:opened UTXO DB (for sync: True)
INFO:DB:UTXO DB version: 8
INFO:DB:coin: BitcoinSegwit
INFO:DB:network: mainnet
INFO:DB:height: 757,262
INFO:DB:tip: 0000000000000000000609044abb0ff2ea363ec53400ed7ea361ed2378495250
INFO:DB:tx count: 769,907,375
INFO:DB:flushing DB cache at 800 MB
INFO:History:history DB version: 1
INFO:History:flush count: 2,753
INFO:DB:deleted 513 stale undo entries
INFO:SessionManager:RPC server listening on 127.0.0.1:8000
INFO:Prefetcher:catching up to daemon height 757,268 (6 blocks behind)
INFO:Prefetcher:new block height 757,269 hash 00000000000000000005e9077a6e40a6b296b916181a1183967a81140acb0435
INFO:BlockProcessor:our height: 757,268 daemon: 757,269 UTXOs 13MB hist 14MB
INFO:BlockProcessor:processed 6 blocks size 8.69 MB in 662.7s
INFO:BlockProcessor:our height: 757,269 daemon: 757,269 UTXOs 15MB hist 16MB
INFO:BlockProcessor:processed 1 block size 1.51 MB in 52.3s
INFO:BlockProcessor:caught up to height 757269
INFO:DB:flushed filesystem data in 0.02s
INFO:History:flushed history in 0.6s for 84,306 addrs
INFO:DB:flushed 7 blocks with 18,230 txs, 55,546 UTXO adds, 38,023 spends in 0.4s, committing...
INFO:DB:flush #2,754 took 1.5s.  Height 757,269 txs: 769,925,605 (+18,230)
INFO:DB:tx/sec since genesis: 421, since last flush: 26
INFO:DB:sync time: 21d 03h 35m  ETA: 00s
INFO:DB:closing DBs to re-open for serving
INFO:DB:opened UTXO DB (for sync: False)
INFO:DB:UTXO DB version: 8
INFO:DB:coin: BitcoinSegwit
INFO:DB:network: mainnet
INFO:DB:height: 757,269
INFO:DB:tip: 00000000000000000005e9077a6e40a6b296b916181a1183967a81140acb0435
INFO:DB:tx count: 769,925,605
INFO:History:history DB version: 1
INFO:History:flush count: 2,754
INFO:DB:deleted 7 stale undo entries
INFO:DB:populating header merkle cache...
INFO:MemPool:beginning processing of daemon mempool.  This can take some time...
INFO:DB:header merkle cache populated in 16.0s
INFO:SessionManager:max session count: 674
INFO:SessionManager:session timeout: 600 seconds
INFO:SessionManager:session cost hard limit 10,000
INFO:SessionManager:session cost soft limit 1,000
INFO:SessionManager:bandwidth unit cost 5,000
INFO:SessionManager:request sleep 2,500ms
INFO:SessionManager:request timeout 30s
INFO:SessionManager:initial concurrent 10
INFO:SessionManager:max response size 1,000,000 bytes
INFO:SessionManager:advertising service ssl://90.89.48.32:50002
INFO:MemPool:synced in 86.63s
INFO:MemPool:2,530 txs 1.23 MB touching 16,737 addresses
INFO:MemPool:compact fee histogram: [(22.4, 30218), (13.9, 36704), (10.8, 37487), (9.5, 42040), (8.4, 51153), (7.0, 70590), (5.2, 72176), (5.0, 68403), (4.2, 111077), (3.0, 88775), (2.0, 123225), (1.3, 37192), (1.2, 191773), (1.0, 272985)]
INFO:SessionManager:TCP server listening on all_interfaces:50001
INFO:SessionManager:SSL server listening on all_interfaces:50002
INFO:SessionManager:WS server listening on all_interfaces:50003
INFO:SessionManager:WSS server listening on all_interfaces:50004
INFO:PeerManager:peer discovery: ON
INFO:PeerManager:announce ourself: True
INFO:PeerManager:my clearnet self: 90.89.48.32
INFO:PeerManager:force use of proxy: False
INFO:PeerManager:beginning peer discovery...
INFO:PeerManager:trying to detect proxy on "localhost" ports [9050, 9150, 1080]
INFO:PeerManager:accepted new peer 90.89.48.32 from env
INFO:PeerManager:accepted new peer electrum.vom-stausee.de from env
INFO:PeerManager:accepted new peer electrum.hsmiths.com from env
INFO:PeerManager:accepted new peer helicarrier.bauerj.eu from env

Thanks again.

HotCrypt commented 1 year ago
~ $ electrumx_rpc getinfo
{
    "coin": "BitcoinSegwit",
    "daemon": "localhost:8332/",
    "daemon height": 757272,
    "db height": 757272,
    "db_flush_count": 2757,
    "groups": 0,
    "history cache": "0 lookups 0 hits 0 entries",
    "merkle cache": "0 lookups 0 hits 0 entries",
    "peers": {
        "bad": 1,
        "good": 115,
        "never": 0,
        "stale": 0,
        "total": 116
    },
    "pid": 4243,
    "request counts": {
        "blockchain.block.header": 1,
        "blockchain.headers.subscribe": 4,
        "getinfo": 1,
        "server.features": 4,
        "server.peers.subscribe": 4,
        "server.version": 4
    },
    "request total": 18,
    "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": "01h 16m 08s",
    "version": "ElectrumX 1.16.0"
SomberNight commented 1 year ago

In your log you have:

INFO:SessionManager:advertising service ssl://90.89.48.32:50002

I see electrumx is configured as:

export PUBLIC_IP=$(curl -s http://whatismyip.akamai.com/)
export REPORT_SERVICES=ssl://$PUBLIC_IP:50002

However, my client cannot connect to 90.89.48.32:50002.

HotCrypt commented 1 year ago

Ok thank you, yes I noticed that clients can’t connect to me.

Do I change by: REPORT_SERVICS=ssl://90.89.48.32:50002 ?

And after that, can I delete the variable?: export PUBLIC_IP=$(curl -s http://whatismyip.akamai.com/)

Thx👍💪

SomberNight commented 1 year ago

Can you connect to your own server?

*Yes, I’m well connected

and now you say:

Ok thank you, yes I noticed that clients can’t connect to me.

... confusing. Not sure what you meant originally, but the answer then should have been "no".


Do I change by: REPORT_SERVICS=ssl://90.89.48.32:50002 ?

And after that, can I delete the variable?: export PUBLIC_IP=$(curl -s http://whatismyip.akamai.com/)

No, that won't work. You need an open port that you can listen on. Typically you would either need a publicly routable IP address, or at least some service that has one and can forward a port to you. Alternatively you can run a Tor .onion service.

HotCrypt commented 1 year ago

Can you connect to your own server?

*Yes, I’m well connected

and now you say:

Ok thank you, yes I noticed that clients can’t connect to me.

... confusing. Not sure what you meant originally, but the answer then should have been "no".


Do I change by:

REPORT_SERVICS=ssl://90.89.48.32:50002 ?

And after that, can I delete the variable?:

export PUBLIC_IP=$(curl -s http://whatismyip.akamai.com/)

No, that won't work. You need an open port that you can listen on.

Typically you would either need a publicly routable IP address, or at least some service that has one and can forward a port to you. Alternatively you can run a Tor .onion service.

Port 50002 is open.

SomberNight commented 1 year ago

I've tested now with $ telnet 90.89.48.32 50002, and that port is not open. I think you might be confused about external/routable IPs. Closing as there is no bug here.

HotCrypt commented 1 year ago

Problem solved thank you very much for your help, I’m really sorry:

The port was well open but only for my IP address 🤦‍♂️. I changed this and immediately saw incoming connections 😀, it works properly.

HotCrypt commented 1 year ago

Hi, I run electrumX, btc core full node (incom10/10output) and an LND node with channel on a raspberry4 8go hdd 2to, graphic version (from time to time I need to access the internet from the raspberry). Also i mine solo Btc with usbminer on cgminer/raspberry.

How much RAM do I have to assign to electrumX for it to work properly please? I assigned 3000mo to btc node. Do you have any other tips to optimize my ram and cpu? My bluewallet (btc) work well with my server electrumx,The connection is being made.

I ask because I run lnd and btc core without any problem. When I launch electrumx (1000mo) it runs well for a few hours and then I get this error message and my rasp throttled with 100% cpu and i force reboot.

Error:Daemon:daemon service refused: work queue depth exceeded. Retrying occasionally...

Is it possible to run all this software on a hdd rather than on an ssd? I know that it’s better to have an ssd but I do it only out of passion and the price of a good quality 2to ssd is still expensive.

Thx again Sir,