From 888b4888610eda728148a63e55cb919183d0ca03 Mon Sep 17 00:00:00 2001 From: Ape Mithrandir Date: Mon, 27 Feb 2023 11:26:30 +0000 Subject: [PATCH] Updating GUIDE.md --- public-electrum-server/GUIDE.md | 53 ++++++++++++++++++++++++++++++--- 1 file changed, 49 insertions(+), 4 deletions(-) diff --git a/public-electrum-server/GUIDE.md b/public-electrum-server/GUIDE.md index d063ede..974d97c 100644 --- a/public-electrum-server/GUIDE.md +++ b/public-electrum-server/GUIDE.md @@ -1,11 +1,10 @@ # Public Bitcoin Electrum Server -### Pre-amble +### Introduction In this guide I will walk you through how you make your locally hosted Bitcoin Electrum Server accessible via the public domain without exposing your home IP address. -### Requirements -I used @k3tan's [Ministry of Nodes -Guide](https://youtube.com/playlist?list=PLCRbH-IWlcW2A_kpx2XwAMgT0rcZEZ2Cg) 01 to 05 as the basis of my setup +### Pre-requisites +I used @k3tan's [Ministry of Nodes Guide](https://youtube.com/playlist?list=PLCRbH-IWlcW2A_kpx2XwAMgT0rcZEZ2Cg) 01 to 05 as the basis of my setup Setup a Local machine with +1TB SSD: - [UNB22 - 01 - Overview](https://youtu.be/9Kb7TobTNPI) @@ -22,3 +21,49 @@ Setup Fulcrum Server OR ElectrumX Server on Local machine: In addition to the above you will also need a VPS: - [Host4Coins](https://host4coins.net/) - [1984Hosting](https://1984.hosting/) + +### Local Machine Setup + +This guide assumes you have a local machine running Debian-based Linux Distro with a fully sync-ed Bitcoin Node and Bitcoin indexer either ElectrumX or Fulcrum (ElectRS is another option ElectrumX is many times faster than this). + +The way we are going to expose our Bitcoin indexer to the public is via a [Reverse SSH tunnel](https://youtu.be/N8f5zv9UUMI) from our local machine to a VPS. + +This [guide](https://openoms.github.io/bitcoin-tutorials/ssh_tunnel.html) from @openoms covers some of this but not specifically from the perspective of tunnelling your Electrum Server. + +You should have [ssh keys setup](https://www.cyberciti.biz/faq/how-to-set-up-ssh-keys-on-linux-unix/) and copied over to your VPS. For this ssh tunnel daemon to work smoothly you will need ssh keys without a passphrase. + +First install autossh which is a wrapper on ssh: +``` +sudo apt-get update +sudo apt-get upgrade +sudo apt-get install autossh +``` + +Then create a `.service` file to run your ssh tunnel daemon: +``` +sudo vim /etc/systemd/system/ssh-tunnel.service +``` + +Here is a template of this `.service` file: +``` +[Unit] +Description=Remote SSH tunnel for multiple TCP applications +After=network.target + +[Service] +User=statue +Group=statue +Environment="AUTOSSH_GATETIME=0" +ExecStart=/usr/bin/autossh -C -M 0 -v -N -o "ServerAliveInterval=60" -R :localhost:50001 @ +Restart=always +RestartSec=60 +StandardOutput=journal + +[Install] +WantedBy=multi-user.target +``` + +The port you are tunneling should be the regular TCP port 50001 and not the SSL +port 50002. This is because on the VPS we will be using your cert and key from +your Electrum server to apply SSL via nginx when exposing the data to the +public.