All The Reasons You’ve Failed To Connect Electrum to Your Node Via Tor

Connecting your Electrum Desktop Wallet to you own Node is a massive achievement. There are so many steps, so much can go wrong, and so much background knowledge is required to avoid having a bad time. For most people there’s always going to be errors.

The next hurdle is connecting via Tor. This has so many pitfalls that it’s incredible if you manage to connect first shot without running into trouble. Even if you do, you may later occasionally fail, and it’s not obvious why. I think I’ve figured out (maybe) all the potential problems and now I can finally write this guide.

Two huge advantage of connecting to your node via Tor…

  1. You can connect to your node even if you are not home. i.e. you don’t need to be in range of your home network. (There’s probably other much harder ways with port forwarding, but I’m never going there).
  2. You can be an Uncle Jim node, connecting your family and friends to your node, so you don’t necesarrily have to help each of the people you Orange Pill, to start with a node. The alternative is usually to let them connect to a public node (not great), as many newbies are not in the frame of mind to be running a node straight away.

It’s not about privacy. Running a node on your home network is already plenty private. The worst that can come of it is that someone might be able to figure out that your IP address runs a Bitcoin node. There’s no information about your wallets, or how your wallets access the node.

Step 1: Run a node, run a node, run a KNOWDE!

I suggest a Bitcoin node with the MyNode package. It’s easy and beautiful, and I have a guide. You can alternatively (or better, additionally) run a RaspiBlitz node, but you’ll have to adapt the further instructions in this guide to that system. (RaspiBlitz is less beautiful and smooth, but it’s completely free open source software.) Some people like Umbrel, but it’s got more restrictions and furthe away from FOSS (Free open source software). Why is that important? See question 11.

Step 2: Get Electrum and learn to use it.

Here’s an article I wrote (includes video) of setting up Electrum and connecting it to your own node via your home network. You really should do this first before embarking on Tor connections. You don’t lose any privacy connecting your computer to your own node on the same network.

Here’s an article with links to videos, to explain some features of Electrum. Important stuff to know, more important than connecting Electrum to Tor.

Step 3: Get Tor

We need Tor on the computer that runs Electrum Desktop Wallet, not your node.

You can either go “full hacker mode” with command line Tor, or just download the browser (much easier). I’ve tried the command line way but I didn’t take notes while doing it, so can’t add it to the guide, and there’s no need anyway.

Just go to https://www.torproject.org/ and download then install the browser.

Step 4: Check your ​VPN and Tor status.

Running Tor just creates the Tor connections we need to other computers.

This image has an empty alt attribute; its file name is image.jpg

But wait, don’t run it yet. Do this in order…

  1. Decide if your VPN is going to be on or off, execute the choice, then leave it.
  2. Run the Tor Browser and minimise.
  3. Run Electrum
  4. Any change to 1 or 2 means you need to restart Electrum (ie repeat 3)

This needs explaining…

With Electrum running, if you run Tor first, and then if you switch on (or off) your VPN, you’ll run into problems with connecting Electrum to your node. You’ll need to restart Tor completely each time you change the VPN status.​

​Also, if you change your Tor session, or toggle your VPN on or off, Electrum will freak out and will lose connection. You need to restart Electrum to refresh it, so that it notices the new network.

The VPN issue exists with Electrum whether you use Tor or not. I suspect many Bitcoiners have at some point turned off their VPN to connect to their node on their home network, and not been able to connect. The solution is the old “turn it off and on again trick” – not the whole computer, just Electrum.

This I know is a little confusing and hard to explain all the combinations. You wont go wrong if you do what I said earlier (in order!). I’ll repeat…

  1. Decide if your VPN is going to be on or off and leave it.
  2. Run the Tor Browser and minimise.
  3. Run Electrum
  4. Any change to 1 or 2 means you need to restart Electrum (ie repeat 3)

There is another pitfall which occurs when you change your node’s network settings – sometimes Electrum does not connect even though you are entering the network settings in Electrum absolutely accurately. The solution to this is to shut down Electrum first, and then look for the hidden electrum directory where the wallets are kept. Within that hidden directory, there’s a directory caller “certs”. Find it and delete the thing, then restart Electrum.

This is how, and do note, everything is case sensitive…

On a Mac it’s here (notice the “.” before “electrum”):

/Users/Your_Username/.electrum/certs

On a Linux machine, it’s here:

/home/Your_Username/.electrum/certs

A simple way on a Mac or Linux would be to open terminal and type:

cd .electrum

<enter>

rm -r certs

<enter>

This deletes the directory.

In Windows the directory is here:

C:\Users\Your_Username\AppData\Roaming\Electrum\Certs

To delete, open command prompts and type:

cd c:\Users\Your_Username\AppData\Roaming\Electrum

<enter>

rmdir certs

<enter>

These above instructions work for the current version of Electrum (4.1.2). But, to future proof, this is how you can find the hidden directories…

Open electrum and begin the process of selecting a wallet to open. Then click “choose”

Windows is the hardest way to get to the directory so I’ll elaborate further for Windows only. After clicking “choose”, this shows up…

This is not yet satisfactory because it doesn’t show the path in it’s proper form. Click just to the right of the word “wallets”, on the whitespace, and the dislplay changes to this…

Now you can see the proper path and can locate where that Electrum directory is in relation the the c:\ drive.

Step 5: Extract your onion address from the Node.

Go to your MyNode page by typing http:/mynode.local/ into the browser of a computer connected to the same network as your node. You’ll have to turn off your VPN first. Here’s the page you’ll get after putting in your password, assuming you’ve already enabled Electrum Server (it takes a day or to to sync, AFTER bitcoin core syncs).

 

Click on the “info” button on the Electrum Server tab, and you’ll get this…

Now, you need to copy some text to the clipboard. Save it in a document if you wish. Exactly what you copy is very important. Here’s an example:

It’s the blue highlighted bit, including the “.onion” part and the “:50002:s” part. Don’t include the 9050 part. That number is wrong and I’ll explain later (one of the reasons people fail to connect with Tor)

Anyone with this information can connect to your node. I am not a hacker so I don’t know what they can do if they connect to your node. But I suggest not finding out. Just only share the onion address with “Uncle Jim’s nephews and neices”.

Step 6: Enter Tor details into Electrum

Open your Electrum Wallet, and click the circle in the bottom right corner. Mine is already green, meaning it is connect to my node via my home network. If red, it’s disconnected. If blue, it’s connect via Tor. If there are “recycle” arrows, it’s syncing.

You’ll see something like this.

Then click the Proxy tab at the top and you’ll see this…

Make it look like this…

“127.0.0.1” is computer speak for “local network”. We want port 9150, not 9050, explained why at the end of the article.

Then click “Overview” and paste in the onion address with the port details, then click “close”

The cirlce will be red. Don’t be dishartened. Don’t shut it down. Just wait 10 to 20 seconds, and see if it turns blue. It never immediately connects the way the normal network connects. The blue circle takes a bit more time. After 20 seconds, if there is no connection, something is wrong.

This is what success looks like (after syncing arrows, it turns blue)…

Potential Problems and Solutions

  • Don’t forget to turn on Tor. The browser running in the background is easiest​
  • Copy the whole onion address including the port and connection type​
  • For ports, use 50002:s, or 50001:t​
  • 50001:s wont work​, and 50002:t wont work​
  • Wait, it doesn’t connect immediately​
  • Make sure you enabled proxy​
  • Use 9150 if running Tor browser​ (9050 won’t work, that’s reserved for command line Tor)
  • Use 9050 if running command line Tor​ (9150 won’t work, that’s reserved for Tor browser)
  • Use Socks 5 (but Socks 4 works too)​
  • If VPN/Tor status changes occurred while Electrum was running, restart Electrum​ to refresh. (Alternative to restarting, you can just tinker with the network settings in Electrum, exit settings, re-enter settings, correct the settings back to what it was, then exit settings. This forces Electrum to refresh.​)
  • Sometimes restarting Tor is the solution.​
  • Node network settings might have changed. Delete “certs” directory as described earlier.
  • Sometimes, even if you didn’t change the network, restarting Electrum is all you need to do.
  • Sometimes you just need an updated version of Electrum, particularly if you’ve been upgrading your MyNode software and Electrum Wallet has been left behind.

That’s it, hopefully you can now be an Uncle Jim.

Extra info

Some people might like to run Electrum with Tor from the Mac command line. Not easy to figure out. Here’s how you do it…

  • Find the app icon in terminal​
  • cd Electrum 4.2.1.app​ (or whatever it’s called exactly)
  • cd Contents​
  • cd MacOS​
  • ./run_electrum -1 -s YourOnionAddressGoesHere.onion:50002:s -p socks5:localhost:9150​
  • (use 9150 if running tor browser, 9050 if command line tor)​
  • “-1” means connect to one server only
%d bloggers like this: