Electrs Queries Taking Ages (~900ms) on My Docker Bitcoin Node

7 replies 266 views
degen_nonceFull Member
Posts: 134 · Reputation: 434
#1Oct 14, 2017, 08:57 PM
So I have a Bitcoin Core full node running (bitcoind) and I’m using romanz/electrs through Docker to set up an Electrum server for checking address balances and wallet info. But man, I'm hitting some serious lag here. When I try to check the balance for any random address, it always takes about 600-900 ms using the btc-rpc-explorer RPC interface. If I query addresses with a huge number of transactions, it can seriously drag out and take a few seconds instead of just milliseconds. Here’s my docker compose yml file: services: bitcoin_service: build: context: . dockerfile: Bitcoin.Dockerfile args: BITCOIN_VERSION: ${BTC_VERSION} image: bitcoin_full_node ports: 8333:8333 8332:8332 volumes: bitcoin_volume:/home/btc-user/.bitcoin networks: network: ipv4_address: 192.168.1.219 healthcheck: test: [ "CMD", "bitcoin-cli", "-rpccookiefile=/home/btc-user/.bitcoin/btc.cookie", "-rpcport=8332", "-rpcconnect=192.168.1.219", "getblockchaininfo" ] interval: 40s timeout: 60s retries: 45 electrs: image: electrs:latest build: context: ./electrs/. container_name: electrs restart: always ports: "50001:50001" # Electrum TCP port exposed on host and container environment: ELECTRS_NETWORK=bitcoin ELECTRS_DAEMON_RPC_ADDR=192.168.1.219:833
6 Reply Quote Share
hash_bossLegendary
Posts: 1166 · Reputation: 5261
#2Oct 15, 2017, 01:07 AM
The only detailed benchmark/measure about Electrum server (that i remember) is https://www.sparrowwallet.com/docs/server-performance.html. That benchmark also state Fulcrum have best performance (comapred with electrs and ElectrumX), so you may want to consider switch to Fulcrum.
6 Reply Quote Share
degen_nonceFull Member
Posts: 134 · Reputation: 434
#3Oct 15, 2017, 10:26 PM
thanks bro fulcrum seems pretty decent i will try it
4 Reply Quote Share
HumbleP1x3lFull Member
Posts: 53 · Reputation: 292
#4Oct 16, 2017, 07:32 AM
For uncached queries or cold queries, this latency is within the normal range. But for hot queries with your SSD + 4 threads + 4GB DB cache, you could have achieved 60-150 ms. For your case, it could be RocksDB scans (especially with large address histories). You could add this on your env for reducing RocksDB scan depth when querying addresses with long histories, it can speedup your queries.
0 Reply Quote Share
hash_bossLegendary
Posts: 1166 · Reputation: 5261
#5Oct 16, 2017, 12:07 PM
Can you tell us which version of romanz/electrs you use for that environment variable? I just searched it on google, but there's no search result. Although searching other electrs env on google shows shows some result.
1 Reply Quote Share
HumbleP1x3lFull Member
Posts: 53 · Reputation: 292
#6Oct 16, 2017, 02:16 PM
I appreciate you double checked that. My apologies for making the assumption that custom Electrs forks or internal builds might implement history truncation for performance, especially in Lightning-related setups.Where pruning long address history for faster queries. I didn’t actually use any specific version of romanz/electrs that supports ELECTRS_TRUNCATE_HISTORY. It was my misunderstanding ,  I’ve corrected my understanding and won’t pass that along without verifying in the future.
4 Reply Quote Share
degen_nonceFull Member
Posts: 134 · Reputation: 434
#7Oct 16, 2017, 02:35 PM
i got this on electrs logs Any clue how to get rid of it "electrs             [2025-05-28T21:16:53.327Z INFO  electrs::electrum] your wallet uses less efficient method of querying electrs, consider contacting the developer of your wallet. Reason: blockchain.scripthash.get_balance called for unsubscribed scripthash"
4 Reply Quote Share
gr3g.0rbitHero Member
Posts: 1025 · Reputation: 2646
#8Oct 18, 2017, 08:39 AM
It's pertaining to that electrum protocol used by btc-rpc-explorer to query an address' balance, "blockchain.scripthash.get_balance", As the warning shows; your btc-rpc-explorer is not set or can't be set to call "blockchain.scripthash.subscribe" for it to be efficient. Unfortunately, I can't find any reference of that electrum protocol method in their code or specifically in .../electrumAddressApi.js (I may have missed it though) Since you already re-posted this to their GitHub repo as a new issue, you may as well mention this error there since it's better to ask the main developers themselves.
2 Reply Quote Share

Related topics