From 7848d4b671facbb0e6f7c1b30bb1ba140ddd672a Mon Sep 17 00:00:00 2001 From: openoms Date: Thu, 20 Jan 2022 20:03:40 +0000 Subject: [PATCH] add WIP script for ElectrumX related: https://github.com/rootzoll/raspiblitz/issues/1130 --- README.md | 4 ++ electrumx.md | 107 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 111 insertions(+) create mode 100644 electrumx.md diff --git a/README.md b/README.md index 211f870..a36e731 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,10 @@ Start at * #### [BTCPayServer on the RaspiBlitz](BTCPayServer/README.md) This guide will make you have BTCPayServer running on your node using the already synced bitcoin blockchain and local LND node and benefit from the backup and security features of RaspiBlitz and the stock LND. No added synchronization needed. + +* #### [ElectrumX Server](electrumx.md) + A more performant Electrum server for serious hardware. + * #### [Electrum wallet](electrs/electrum_wallet.sh) Download, verify and install the chosen version on a Linux desktop. ``` diff --git a/electrumx.md b/electrumx.md new file mode 100644 index 0000000..59dd829 --- /dev/null +++ b/electrumx.md @@ -0,0 +1,107 @@ +# ElectrumX on a RaspiBlitz + +This is a rought overview, the guide is work in progress. + +Tested environments: + * X86_64 Xeon E5 with 16GB RAM and SSD storage + * bulding the database on a Raspberry Pi will likely take weeks + +## Prepare the system and directories +``` +# create a dedicated user +sudo adduser --disabled-password --gecos "" electrumx +cd /home/electrumx + +sudo -u electrumx git clone https://github.com/spesmilo/electrumx.git +cd electrumx + +# installation +# dependencies +sudo -u electrumx pip install aiohttp pylru +sudo -u electrumx pip3 install . +# sudo -u electrumx python3 setup.py build +# sudo python3 setup.py install + +# create the database directory in /mnt/hdd/app-storage (on the disk) +sudo mkdir -p /mnt/hdd/app-storage/electrumx/db +sudo chown -R electrumx:electrumx /mnt/hdd/app-storage/electrumx + +# create a symlink to /home/electrumx/.electrumx +sudo ln -s /mnt/hdd/app-storage/electrumx /home/electrumx/.electrumx +sudo chown -R electrumx:electrumx /home/electrumx/.electrumx + +``` + +## Create a config file +https://electrumx-spesmilo.readthedocs.io/en/latest/environment.html +Can paste the thsi as a block, but fill in the PASSWORD_B (Bitcoin Core RPC password) +``` +echo "\ +DB_DIRECTORY=/home/electrumx/.electrumx/db +DAEMON_URL=http://raspibolt:PASSWORD_B@127.0.0.1 +COIN=Bitcoin + +SERVICES = tcp://:50010,ssl://:50011,rpc:// +PEER_DISCOVERY = off +COST_SOFT_LIMIT = 0 +COST_HARD_LIMIT = 0 + +NET=mainnet +CACHE_MB=1200 + +SSL_CERTFILE=/home/electrumx/.electrumx/certfile.crt +SSL_KEYFILE=/home/electrumx/.electrumx/keyfile.key +BANNER_FILE=/home/electrumx/.electrumx/banner +DONATION_ADDRESS=your-donation-address +" | sudo -u electrumx tee /home/electrumx/.electrumx/electrumx.conf +``` + +## Create a systemd service +https://github.com/spesmilo/electrumx/blob/master/contrib/systemd/electrumx.service +``` +echo "\ +[Unit] +Description=Electrumx +After=network.target + +[Service] +EnvironmentFile=/home/electrumx/.electrumx/electrumx.conf +ExecStart=/home/electrumx/.local/bin/electrumx_server +User=electrumx +LimitNOFILE=8192 +TimeoutStopSec=30min + +[Install] +WantedBy=multi-user.target +" | sudo tee /etc/systemd/system/electrumx.service +``` + +## Start +``` +sudo systemctl enable electrumx +sudo systemctl start electrumx +``` + +## Monitor +``` +sudo journalctl -fu electrumx +sudo systemctl status electrumx +``` + +## Remove user and installation (not the database) +``` +sudo systemctl disable electrumx +sudo systemctl stop electrumx +sudo userdel -rf electrumx +# to remove the database directory: +# sudo rm -rf /mnt/hdd/app-storage/electrumx +``` + +## Set SSL +https://electrumx-spesmilo.readthedocs.io/en/latest/HOWTO.html#creating-a-self-signed-ssl-certificate + + +## Sources: +https://github.com/spesmilo/electrumx +https://electrumx-spesmilo.readthedocs.io/en/latest/index.html +https://sparrowwallet.com/docs/server-performance.html \ No newline at end of file