spesmilo / electrum

Electrum Bitcoin Wallet
https://electrum.org
MIT License
7.44k stars 3.09k forks source link

Error connecting to electrs server via secure connection #6700

Open tehelsper opened 4 years ago

tehelsper commented 4 years ago

Some myNode users are having an issue connecting to the electrs electrum server via nginx on myNode. It seems to work in the vast majority of cases, but some users do seem to have issues. Electrs does appear to be running properly and can be accessed via port 50001. The failure only occurs on port 50002.

Here is one of the logs:

20200825T165229.866903Z |     INFO | logging | Electrum version: 4.0.2 - https://electrum.org - https://github.com/spesmilo/electrum
20200825T165229.879539Z |     INFO | logging | Python version: 3.7.7 (default, Jun 23 2020, 16:29:54) 
[Clang 11.0.0 (clang-1100.0.33.17)]. On platform: Darwin-19.6.0-x86_64-i386-64bit
20200825T165229.879913Z |     INFO | logging | Logging to file: /Users/xxx/.electrum/logs/electrum_log_20200825T165229Z_5552.log
20200825T165229.880026Z |     INFO | logging | Log filters: verbosity '', verbosity_shortcuts ''
20200825T165229.882462Z |     INFO | plugin.Plugins | registering hardware bitbox02: ('hardware', 'bitbox02', 'BitBox02')
20200825T165229.882991Z |     INFO | plugin.Plugins | registering hardware coldcard: ('hardware', 'coldcard', 'Coldcard Wallet')
20200825T165229.883851Z |     INFO | plugin.Plugins | registering hardware digitalbitbox: ('hardware', 'digitalbitbox', 'Digital Bitbox wallet')
20200825T165229.886555Z |     INFO | plugin.Plugins | registering hardware keepkey: ('hardware', 'keepkey', 'KeepKey wallet')
20200825T165229.887426Z |     INFO | plugin.Plugins | registering hardware ledger: ('hardware', 'ledger', 'Ledger wallet')
20200825T165229.888352Z |     INFO | plugin.Plugins | registering hardware safe_t: ('hardware', 'safe_t', 'Safe-T mini wallet')
20200825T165229.888839Z |     INFO | plugin.Plugins | registering hardware trezor: ('hardware', 'trezor', 'Trezor wallet')
20200825T165229.889349Z |     INFO | plugin.Plugins | registering wallet type ('2fa', 'trustedcoin')
20200825T165229.890032Z |    DEBUG | util.profiler | Plugins.__init__ 0.0096
20200825T165229.890937Z |     INFO | network | blockchains [0]
20200825T165229.892045Z |     INFO | exchange_rate.FxThread | using exchange CoinGecko
20200825T165229.893200Z |    DEBUG | util.profiler | Daemon.__init__ 0.0030
20200825T165229.893365Z |     INFO | daemon.Daemon | launching GUI: qt
20200825T165229.893530Z |     INFO | network | starting network
20200825T165229.893929Z |     INFO | network | setting proxy None
20200825T165229.894339Z |     INFO | daemon.Daemon | starting taskgroup.
20200825T165229.894606Z |     INFO | network | connecting to 192.168.1.175:50002:s as new interface
20200825T165229.895753Z |     INFO | network | starting taskgroup.
20200825T165229.969097Z |     INFO | gui.qt.history_list | could not import electrum.plot. This feature needs matplotlib to be installed.
20200825T165229.974841Z |     INFO | gui.qt.ElectrumGui | Qt GUI starting up... Qt=5.14.2, PyQt=5.14.2
20200825T165229.991422Z |     INFO | interface.[192.168.1.175:50002] | succeeded in getting cert
20200825T165229.997467Z |  WARNING | interface.[192.168.1.175:50002] | Cannot connect to main server due to SSL error (maybe cert changed compared to "/Users/xxx/.electrum/certs/192.168.1.175"). Exc: ConnectError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1076)'))
20200825T165229.997946Z |     INFO | network | couldn't launch iface 192.168.1.175:50002:s -- CancelledError()
20200825T165230.107390Z |    DEBUG | util.profiler | ElectrumGui.__init__ 0.1341
20200825T165230.107949Z |     INFO | storage.WalletStorage | wallet path /Users/xxx/.electrum/wallets/test
20200825T165230.317067Z |     INFO | storage.WalletStorage | wallet path /Users/xxx/.electrum/wallets/test
20200825T165232.689555Z |     INFO | network | connecting to 192.168.1.175:50002:s as new interface
20200825T165232.705269Z |  WARNING | interface.[192.168.1.175:50002] | Cannot connect to main server due to SSL error (maybe cert changed compared to "/Users/xxx/.electrum/certs/192.168.1.175"). Exc: ConnectError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1076)'))
20200825T165232.705618Z |     INFO | network | couldn't launch iface 192.168.1.175:50002:s -- CancelledError()
20200825T165233.954141Z |    DEBUG | util.profiler | WalletDB._load_transactions 0.0006
20200825T165233.956009Z |    DEBUG | util.profiler | AddressSynchronizer.load_local_history 0.0002
20200825T165233.956431Z |    DEBUG | util.profiler | AddressSynchronizer.check_history 0.0003
20200825T165233.957539Z |    DEBUG | util.profiler | WalletDB._load_transactions 0.0001
20200825T165233.957702Z |    DEBUG | util.profiler | AddressSynchronizer.load_local_history 0.0000
20200825T165233.957815Z |    DEBUG | util.profiler | AddressSynchronizer.check_history 0.0000
20200825T165233.996306Z |    DEBUG | util.profiler | AddressList.update 0.0000
20200825T165234.072132Z |    DEBUG | util.profiler | Deterministic_Wallet.try_detecting_internal_addresses_corruption 0.0137
20200825T165234.072485Z |    DEBUG | util.profiler | ElectrumWindow.load_wallet 0.0457
20200825T165234.185144Z |     INFO | gui.qt.update_checker.UpdateCheckThread | valid sig for version announcement '3.3.8' from address '13xjmVAB1EATPP8RshTE8S8sNwwSUM9p1P'
20200825T165234.309427Z |     INFO | gui.qt.history_list.HistoryModel | refreshing... reason: update_tabs
20200825T165234.310427Z |    DEBUG | util.profiler | Abstract_Wallet.get_full_history 0.0008
20200825T165234.310925Z |    DEBUG | util.profiler | HistoryModel.refresh 0.0015
20200825T165234.312243Z |    DEBUG | util.profiler | AddressList.update 0.0000
20200825T165236.024076Z |     INFO | gui.qt.main_window.[test] | close_wallet /Users/xxx/.electrum/wallets/test
20200825T165236.029462Z |     INFO | storage.WalletStorage | saved /Users/xxx/.electrum/wallets/test
20200825T165236.029650Z |    DEBUG | util.profiler | WalletStorage.write 0.0034
20200825T165236.038409Z |     INFO | gui.qt.ElectrumGui | closing GUI
20200825T165236.038613Z |     INFO | daemon.Daemon | shutting down network
20200825T165236.038926Z |     INFO | network | stopping network
20200825T165236.039386Z |     INFO | network | taskgroup stopped.
20200825T165236.039666Z |     INFO | daemon.Daemon | stopping taskgroup
20200825T165236.040003Z |     INFO | daemon.Daemon | taskgroup stopped.
20200825T165236.040156Z |     INFO | daemon.Daemon | removing lockfile
20200825T165236.040428Z |     INFO | daemon.Daemon | stopped
20200825T165236.082718Z |     INFO | plugin.Plugins | stopped

More info is on the mynode issue tracking this. https://github.com/mynodebtc/mynode/issues/360

Any ideas?

bitromortac commented 4 years ago

You could try to delete the certificate in your .electrum folder: 20200825T165229.997467Z | WARNING | interface.[192.168.1.175:50002] | Cannot connect to main server due to SSL error (maybe cert changed compared to "/Users/xxx/.electrum/certs/192.168.1.175"). Exc: ConnectError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1076)')). It could be that via some process you have updated the ssl cert on your server.

SomberNight commented 4 years ago

Are all affected users on macOS?

SomberNight commented 4 years ago

Also, is the cert self-signed or CA-signed? I expect self-signed from the domain, but can you confirm? Is that the case for all affected users?

SomberNight commented 4 years ago

Could you get someone who can reproduce to share the contents of the cert file on disk? So e.g. this file /Users/xxx/.electrum/certs/192.168.1.175

tehelsper commented 4 years ago

The cert is self-signed.

All users are not affected. It appears to be a small minority and may be related to the device being used to access the server. AFAIK, it may have only affected one user on MacOS, but they claimed they reset all certs on both ends and repeatedly ran into the same issue.

scramblr commented 3 years ago

Having the same issue, latest version with deleted certs folder. No change.

20201114T225216.500548Z |     INFO | interface.[electrumx.erbium.eu:50002] | connection established. version: ['ElectrumX 1.15.0', '1.4']
20201114T225216.560675Z |     INFO | network | fee_histogram [[69, 100873], [38, 126078], [28, 106198], [20, 142205], [12, 149310], [9, 243471], [5, 209123], [4, 139971], [3, 989630], [2, 269088], [1, 529860]]
20201114T225216.561111Z |     INFO | lnwatcher.WatchTower.[local_tower] | set_up_to_date: True
20201114T225216.561322Z |     INFO | lnwatcher.LNWalletWatcher.[wallet_2-LNW] | set_up_to_date: True
20201114T225216.562882Z |     INFO | interface.[xtrum.com:50002] | connection established. version: ['ElectrumX 1.15.0', '1.4']
20201114T225216.657310Z |  WARNING | interface.[167.172.226.175:50002] | disconnecting due to RPCError(2, "daemon error: DaemonError({'code': -5, 'message': 'No such mempool or blockchain transaction. Use gettransaction for wallet transactions.'})")
20201114T225216.657598Z |    DEBUG | interface.[167.172.226.175:50002] | (disconnect) trace for RPCError(2, "daemon error: DaemonError({'code': -5, 'message': 'No such mempool or blockchain transaction. Use gettransaction for wallet transactions.'})")
Traceback (most recent call last):
  File "electrum/interface.py", line 474, in wrapper_func
  File "electrum/interface.py", line 498, in run
  File "electrum/interface.py", line 638, in open_session
  File "aiorpcx/curio.py", line 242, in __aexit__
  File "aiorpcx/curio.py", line 211, in join
  File "electrum/synchronizer.py", line 82, in _start_tasks
  File "aiorpcx/curio.py", line 242, in __aexit__
  File "aiorpcx/curio.py", line 211, in join
  File "electrum/synchronizer.py", line 241, in main
  File "electrum/synchronizer.py", line 209, in _request_missing_txs
  File "aiorpcx/curio.py", line 242, in __aexit__
  File "aiorpcx/curio.py", line 211, in join
  File "electrum/synchronizer.py", line 214, in _get_transaction
  File "electrum/interface.py", line 906, in get_transaction
  File "electrum/interface.py", line 166, in send_request
  File "asyncio/tasks.py", line 414, in wait_for
  File "aiorpcx/session.py", line 529, in send_request
  File "aiorpcx/session.py", line 499, in _send_concurrent
aiorpcx.jsonrpc.RPCError: (2, "daemon error: DaemonError({'code': -5, 'message': 'No such mempool or blockchain transaction. Use gettransaction for wallet transactions.'})")
20201114T225216.669991Z |     INFO | network | switching to blackie.c3-soft.com:57002:s
20201114T225216.689547Z |     INFO | lnwatcher.WatchTower.[local_tower] | set_up_to_date: False
20201114T225216.690318Z |     INFO | lnwatcher.LNWalletWatcher.[wallet_2-LNW] | set_up_to_date: False
20201114T225216.691647Z |     INFO | interface.[endthefed.onthewifi.com:50002] | set blockchain with height 656952
20201114T225216.691934Z |     INFO | interface.[endthefed.onthewifi.com:50002] | skipping header 656952
20201114T225216.692676Z |     INFO | interface.[orannis.com:50002] | disconnecting due to: ErrorGettingSSLCertFromServer(ConnectError(ConnectionRefusedError(61, "Connect call failed ('50.35.73.78', 50002)")))
SomberNight commented 3 years ago

@scramblr that's unrelated. probably duplicate of https://github.com/spesmilo/electrum/issues/6686 see https://github.com/spesmilo/electrum/issues/6686#issuecomment-716548084 in particular

SomberNight commented 4 months ago

note: similar error message in https://github.com/spesmilo/electrum/commit/02a9ab80be819468352f773bd7120421868d38f0 (but related to CA-signed certs there)