romanz / electrs

An efficient re-implementation of Electrum Server in Rust
MIT License
1.09k stars 403 forks source link

Config: Cannot log into bitcoin core #1107

Closed MichaelMichaelMichaelMichaelMichael closed 3 days ago

MichaelMichaelMichaelMichaelMichael commented 3 days ago

Have you read the documentation? Yes.

How did you configure electrs?

bitcoin.conf on server side: ``` rpcport=50332 rpcauth = admin:70fd8c76061dc5549c7169c52253c94e$25358180edbf7c998bbbbde2da2948cdefa12e5c382f872e3e29384b3c699a51 port=50333 ```
/etc/electrs/config.toml ```# Bitcoin Core RPC Konfiguration [server] rpc_addr = "bitcoincore24.mybitcoinspace.svc.mycluster.local:50332" # Electrs Konfiguration [electrs] auth = "admin:70fd8c76061dc5549c7169c52253c94e$25358180edbf7c998bbbbde2da2948cdefa12e5c382f872e3e29384b3c699a51" network = "bitcoin" daemon_dir = "/var/lib/electrs/daemon" daemon_rpc_addr = "bitcoincore.mybitcoinspace.svc.mycluster.local:50332" daemon_p2p_addr = "bitcoincore.mybitcoinspace.svc.mycluster.local:50333" ```

Environment variables: none Arguments:

--conf /etc/electrs/config.toml
--daemon-rpc-addr bitcoincore.mybitcoinspace.svc.mycluster.local:50332
--daemon-p2p-addr bitcoincore.mybitcoinspace.svc.mycluster.local:50333
--network bitcoin
--db-dir /var/lib/electrs

Debug output of configuration

Starting electrs 0.10.6 on x86_64 linux with Config { network: Bitcoin, db_path: "/var/lib/electrs/bitcoin", db_log_dir: None, daemon_auth: CookieFile("/root/.bitcoin/.cookie"), daemon_rpc_addr: 10.43.38.yyy:50332, daemon_p2p_addr: 10.43.38.yyy:50333, electrum_rpc_addr: 127.0.0.1:50001, monitoring_addr: 127.0.0.1:4224, wait_duration: 10s, jsonrpc_timeout: 15s, index_batch_size: 10, index_lookup_limit: None, reindex_last_blocks: 0, auto_reindex: true, ignore_mempool: false, sync_once: false, skip_block_download_wait: false, disable_electrum_rpc: false, server_banner: "Welcome to electrs 0.10.6 (Electrum Rust Server)!", signet_magic: f9beb4d9 }
Error: electrs failed

Caused by:
    0: bitcoind RPC polling failed
    1: daemon not available
    2: JSON-RPC error: transport error: unexpected HTTP code: 401

On the bitcoin core server, I get this message with each restart of electrs:

2024-11-04T21:41:29Z ThreadRPCServer incorrect password attempt from 10.42.16.xxx:43328
2024-11-04T21:42:35Z ThreadRPCServer incorrect password attempt from 10.42.16.xxx:57666
2024-11-04T21:42:37Z ThreadRPCServer incorrect password attempt from 10.42.16.xxx:57678

Expected behavior Hi, I have installed electrs in a Kubernetes Cluster, and I'm trying to connect to a bitcoin core installation from electrs. I am capable to connect like the following:

bitcoin-cli -rpcconnect=10.43.38.150 -rpcpassword=FQhLdvusTlNX-pGhxQDLdW3vD5-NAgDcePWU_fDX98E  -rpcport=50332 -rpcuser=admin uptime

So trying the same parameters in electrs doesn't work for me. I've also tried to change the auth line in /etc/electrs/config.toml to:

auth = "admin:FQhLdvusTlNX-pGhxQDLdW3vD5-NAgDcePWU_fDX98E"

Actual behavior No connection to bitcoin core

MichaelMichaelMichaelMichaelMichael commented 3 days ago

Closing with this solution:

config.toml:

    network = "bitcoin"
    daemon_dir = "/var/lib/electrs/daemon"
    auth = "admin:FQhLdvusTlNX-pGhxQDLdW3vD5-NAgDcePWU_fDX98E"
    daemon_rpc_addr = "bitcoincore.mybitcoinspace.svc.mycluster.local:50332"
    daemon_p2p_addr = "bitcoincore.mybitcoinspace.svc.mycluster.local:50333"
    log_filters = "INFO"

(feel free to comment on solution)