sparrow: Can't Connect to external Electrum server (electrs) on Whonix
Hi. I’m trying to connect a sparrow wallet, running on whonix, to a tor hidden service of an electrum server of mine (running electrs on another machine). Connection works fine for Electrum on Whonix, but sparrow fails to connect.
The tor part seems to be the problem. Does sparrow run an internal tor client? It seems to try to connect to my hidden service starting a tor instance, but then fails because it’s running on whonix and the 9050 port is busy (I’ve read this on the connection-test log).
Starting Tor
Aug 26 14:46:16.974 [notice] Tor 0.4.3.6 (git-30711296fd5b7f51) running on Linux with Libevent 2.1.11-stable, OpenSSL 1.1.1g, Zlib 1.2.11, Liblzma N/A, and Libzstd N/A.
Aug 26 14:46:16.974 [notice] Tor can't help you if you use it wrong! Learn how to be safe at https://www.torproject.org/download/download#warning
Aug 26 14:46:16.974 [notice] Read configuration file "/tmp/tor10679590390238463793/torrc".
Aug 26 14:46:16.976 [notice] Opening Control listener on 127.0.0.1:0
Aug 26 14:46:16.976 [notice] Control listener listening on port 33409.
Aug 26 14:46:16.977 [notice] Opened Control listener on 127.0.0.1:33409
Aug 26 14:46:16.983 [notice] DisableNetwork is set. Tor will not make or accept non-control network connections. Shutting down all existing connections.
Then it suggests that I configure the proxy:
Could not connect:
Error reply: Unable to set option: Failed to bind one of the listener ports.
Is a Tor proxy already running on port 9050?
Assuming Tor proxy is running on port 9050 and trying again...
I’ve tried using localhost:9050 and also 10.152.152.10:9111 (following https://www.whonix.org/wiki/Electrum). The result is that it exhausts the max retries to connect.
My electrum server doesn’t log anything so it seems that messages are not reaching it.
Here is some of the log file of the wallet:
2022-08-26 14:46:18,263 ERROR [JavaFX Application Thread] c.s.s.p.ServerPreferencesController [null:-1] Connection error
com.sparrowwallet.sparrow.net.TorServerAlreadyBoundException: Tor server already bound
at com.sparrowwallet.sparrow@1.6.6/com.sparrowwallet.sparrow.net.TorService$1.call(Unknown Source)
at com.sparrowwallet.sparrow@1.6.6/com.sparrowwallet.sparrow.net.TorService$1.call(Unknown Source)
at javafx.graphics@18/javafx.concurrent.Task$TaskCallable.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at javafx.graphics@18/javafx.concurrent.Service.lambda$executeTask$6(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Unknown Source)
at javafx.graphics@18/javafx.concurrent.Service.lambda$executeTask$7(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: net.freehaven.tor.control.TorControlError: Error reply: Unable to set option: Failed to bind one of the listener ports.
at com.github.JesusMcCloud.jtorctl@1.5/net.freehaven.tor.control.TorControlConnection.sendAndWaitForResponse(Unknown Source)
at com.github.JesusMcCloud.jtorctl@1.5/net.freehaven.tor.control.TorControlConnection.setConf(Unknown Source)
at com.github.JesusMcCloud.jtorctl@1.5/net.freehaven.tor.control.TorControlConnection.setConf(Unknown Source)
at netlayer.jpms@0.6.8/org.berndpruenster.netlayer.tor.TorController.enableNetwork(Unknown Source)
at netlayer.jpms@0.6.8/org.berndpruenster.netlayer.tor.NativeTor.<init>(Unknown Source)
at netlayer.jpms@0.6.8/org.berndpruenster.netlayer.tor.NativeTor.<init>(Unknown Source)
at netlayer.jpms@0.6.8/org.berndpruenster.netlayer.tor.NativeTor.<init>(Unknown Source)
... 10 common frames omitted
2022-08-26 14:46:21,495 WARN [Thread-229] c.s.s.n.TcpTransport [null:-1] No response from server, setting read timeout to 8 secs
2022-08-26 14:46:29,965 WARN [Thread-229] c.s.s.n.TcpTransport [null:-1] No response from server, setting read timeout to 16 secs
2022-08-26 14:46:47,883 WARN [Thread-229] c.s.s.n.TcpTransport [null:-1] No response from server, setting read timeout to 34 secs
2022-08-26 14:50:32,003 ERROR [ElectrumServerReadThread] c.s.s.n.TcpTransport [null:-1] Error opening socket inputstream
java.net.SocketException: Socket is closed
at java.base/sun.security.ssl.SSLSocketImpl.getInputStream(Unknown Source)
at com.sparrowwallet.sparrow@1.6.6/com.sparrowwallet.sparrow.net.TcpTransport.readInputLoop(Unknown Source)
at com.sparrowwallet.sparrow@1.6.6/com.sparrowwallet.sparrow.net.ElectrumServer$ReadRunnable.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
2022-08-26 14:50:32,005 ERROR [ElectrumServerReadThread] c.s.s.n.TcpTransport [null:-1] Error opening socket inputstream
java.net.SocketException: Socket is closed
at java.base/sun.security.ssl.SSLSocketImpl.getInputStream(Unknown Source)
at com.sparrowwallet.sparrow@1.6.6/com.sparrowwallet.sparrow.net.TcpTransport.readInputLoop(Unknown Source)
at com.sparrowwallet.sparrow@1.6.6/com.sparrowwallet.sparrow.net.ElectrumServer$ReadRunnable.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
2022-08-26 14:55:07,859 ERROR [ElectrumServerReadThread] c.s.s.n.TcpTransport [null:-1] Error opening socket inputstream
java.net.SocketException: Socket is closed
at java.base/sun.security.ssl.SSLSocketImpl.getInputStream(Unknown Source)
at com.sparrowwallet.sparrow@1.6.6/com.sparrowwallet.sparrow.net.TcpTransport.readInputLoop(Unknown Source)
at com.sparrowwallet.sparrow@1.6.6/com.sparrowwallet.sparrow.net.ElectrumServer$ReadRunnable.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
2022-08-26 14:55:11,811 ERROR [JavaFX Application Thread] c.s.s.w.WalletForm [null:-1] Could not determine payment codes for wallet user
com.sparrowwallet.sparrow.net.ServerException: Failed to subscribe to path: m/0
at com.sparrowwallet.sparrow@1.6.6/com.sparrowwallet.sparrow.net.ElectrumServer.subscribeWalletNodes(Unknown Source)
at com.sparrowwallet.sparrow@1.6.6/com.sparrowwallet.sparrow.net.ElectrumServer.getHistory(Unknown Source)
at com.sparrowwallet.sparrow@1.6.6/com.sparrowwallet.sparrow.net.ElectrumServer$PaymentCodesService$1.call(Unknown Source)
at com.sparrowwallet.sparrow@1.6.6/com.sparrowwallet.sparrow.net.ElectrumServer$PaymentCodesService$1.call(Unknown Source)
at javafx.graphics@18/javafx.concurrent.Task$TaskCallable.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at javafx.graphics@18/javafx.concurrent.Service.lambda$executeTask$6(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Unknown Source)
at javafx.graphics@18/javafx.concurrent.Service.lambda$executeTask$7(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: com.sparrowwallet.sparrow.net.ServerException: Retries exhausted
at com.sparrowwallet.sparrow@1.6.6/com.sparrowwallet.sparrow.net.RetryLogic.getResult(Unknown Source)
at com.sparrowwallet.sparrow@1.6.6/com.sparrowwallet.sparrow.net.SimpleElectrumServerRpc.subscribeScriptHashes(Unknown Source)
... 12 common frames omitted
Caused by: java.lang.IllegalStateException: I/O error during a request processing
at simple.json.rpc.client@1.0/com.github.arteam.simplejsonrpc.client.builder.RequestBuilder.executeRequest(Unknown Source)
at simple.json.rpc.client@1.0/com.github.arteam.simplejsonrpc.client.builder.RequestBuilder.executeAndConvert(Unknown Source)
at simple.json.rpc.client@1.0/com.github.arteam.simplejsonrpc.client.builder.RequestBuilder.executeNullable(Unknown Source)
at com.sparrowwallet.sparrow@1.6.6/com.sparrowwallet.sparrow.net.SimpleElectrumServerRpc.lambda$subscribeScriptHashes$6(Unknown Source)
... 14 common frames omitted
Caused by: java.net.SocketException: Socket is closed
at java.base/sun.security.ssl.SSLSocketImpl.getOutputStream(Unknown Source)
at com.sparrowwallet.sparrow@1.6.6/com.sparrowwallet.sparrow.net.TcpTransport.writeRequest(Unknown Source)
at com.sparrowwallet.sparrow@1.6.6/com.sparrowwallet.sparrow.net.TcpTransport.pass(Unknown Source)
... 18 common frames omitted
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 22 (11 by maintainers)
{"IsTor":true,
So the socks proxy is working. It should also work for Sparrow.
Looks like the wallet loaded successfully - the error you got was temporary in nature and probably Tor related. Certainly the connection to your Electrum is now configured correctly. Closing this off.
tor-ctrl-stream should be run before testing the connection.
Don’t know, will leave this to Craig, but you should search the sparrow issues and electrum github issues about that problem.