Error: electrs failed
Caused by:
0: bitcoind RPC polling failed
1: daemon not available
2: JSON-RPC error: transport error: Couldn't connect to host: Connection refused (os error 111)
hcp@HCP-PC:~/electrs$
Really not sure what is causing the issue... any one else come across this?
![Huh](https://bitcointalk.org/Smileys/default/huh.gif)
I can easily reproduce this when bitcoin core is running, but it's not synced.
So I'd start with getting full sync.
If that's not the cause, maybe take a look at rpcbind or rpcallowip in bitcoin.conf...
I had same problem. I am using Debian under WSL2 (but I'd guess Ubuntu would work as well).
The issue is WSL2 is different from WSL1 because WSL2 uses a VM that is not perfectly bidirectional in its implementation of ip ports:
https://learn.microsoft.com/en-us/windows/wsl/networking
To understand this better, on the Windows side use:
resmon
ss -l
To fix,
1) in Debian run:
ip route show | grep -i default | awk '{ print $3}'
this returns the ip to use w/in Debian to refer to the Windows host (which is NOT 127.0.0.1) eg.:
172.27.176.1
then, change electrs.toml to:
#cookie_file = "/mnt/x/BitcoinDataDir/.mycookie"
auth="rt1:rt1"
daemon_dir = "/mnt/x/BitcoinDataDir"
# ip route show | grep -i default | awk '{ print $3}'
daemon_rpc_addr = "172.27.176.1:8332"
daemon_p2p_addr = "172.27.176.1:8333"
#daemon_p2p_addr = "127.0.0.1:18444"
db_dir = "/mnt/y/ElectrsData"
network = "bitcoin"
electrum_rpc_addr = "127.0.0.1:50001"
#verbose = 2 -> obsolete, was working with version 0.9.0, no longer works in 0.9.3
#use log-filters for version 0.9.3+
# OFF TRACE DEBUG INFO WARN ERROR
log_filters = "TRACE"
server_banner = "Electrs @ NeuroticFish, -jd"
and in bitcoin.conf:
rpcallowip=0.0.0.0/0
rpcbind=0.0.0.0
The above allows me to run my Bitcoin in Windows and my Electrs in WSL2 Debian. It accounts for the lopsided ip ports directionality between Win11 & WSL2.
Further troubleshooting tools:
On wsl2 side try both the windows .exe bitcoin
/mnt/c/BTCwin/daemon/bitcoin-cli.exe -rpcuser=rt1 -rpcpassword=rt1 -rpcport=8332 getblockchaininfo
/mnt/d/bitcoin-27.0/bin/bitcoin-cli -rpcuser=rt1 -rpcpassword=rt1 -rpcconnect=172.27.176.1 -rpcport=8332 getblockchaininfo