In this post I detail the steps needed to enable fan control, install electrs Electrum personal server, and install and configure nginx to provide an SSL proxy for the electrs server, to make it easy to use with the Electrum client software.

  1. enable the case fan using Active Thermal Service, follow github instruction

  2. install c language and git (if not already installed)

    sudo apt install clang git
  3. install rust tools per instructions

    curl --proto '=https' --tlsv1.2 -sSf | sh
    source $HOME/.cargo/env
  4. clone and build the electrs project

    git clone
    cd electrs
    cargo build --release
  5. add a new electrs system user and make it part of bitcoin group

    sudo adduser --system --home /var/lib/electrs --ingroup bitcoin electrs
  6. create a new LVM logical volume for electrs data, I allocate 40% of bitcoin volume size which is needed during indexing, but can lowered later after the indexes are compacted if I need the space back.

    sudo lvcreate -n electrs -L 200g rockpro64
  7. format my new electrs logical volume, identify it's UUID and mount it via fstab

    sudo mkfs.ext4 /dev/rockpro64/electrs
    sudo blkid
    sudo vi /etc/fstab

    add line to /etc/fstab:

    UUID=<THE UUID OF MY NEW LOGICAL PARTITION> /var/lib/electrs ext4 errors=remount-ro 0 1
    sudo mount -a
    sudo chown electrs:bitcoin /var/lib/electrs
    sudo chmod -R o-rwx /var/lib/electrs
    sudo chmod u+rxw /var/lib/electrs
    sudo chmod g+x /var/lib/electrs
  8. copy electrs binary to /var/lib/electrs

    sudo mkdir /var/lib/electrs/bin
    sudo chown electrs:bitcoin /var/lib/electrs/bin
    sudo cp target/release/electrs /var/lib/electrs/bin
    sudo chown electrs:bitcoin /var/lib/electrs/bin/electrs
  9. create systemd startup file for electrs

    sudo vi /usr/lib/systemd/system/electrs.service

    and add below content to file

    ExecStart=/var/lib/electrs/bin/electrs -vvv --db-dir ./db --index-batch-size=10 --jsonrpc-import --cookie-file /var/lib/bitcoind/.cookie --daemon-dir /var/lib/bitcoind --electrum-rpc-addr=""
  10. edit the bitcoind service to enable the rpc server, restart bitcoind

    sudo vi /usr/lib/systemd/system/bitcoind.service

    add -server=1 to the ExecStart line

    sudo systemctl daemon-reload
    sudo systemctl restart bitcoind
  11. update the permission for bitcoind .cookie file so electrs can use it to connect to the bitcoind rpc api

    sudo chmod -R g+r /var/lib/bitcoind/
    sudo chmod g+x /var/lib/bitcoind
    sudo chmod g+x /var/lib/bitcoind/blocks /var/lib/bitcoind/chainstate /var/lib/bitcoind/database
  12. create /run/electrs directory, reload systemd services and start the electrs daemon

    sudo mkdir /run/electrs
    sudo chown electrs:bitcoin /run/electrs
    sudo systemctl daemon-reload
    sudo syste:qqmctl start electrs

    At this point electrs will start indexing, this took almost 24 hours on my system.

  13. install nginx

    sudo apt install nginx
  14. create a new nginx cert

    sudo mkdir /etc/nginx/ssl
    sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/nginx/ssl/nginx.key -out /etc/nginx/ssl/nginx.crt
  15. add the below block to the nginx config file

    sudo vi /etc/nginx/nginx.conf

    stream {
            upstream electrs {
            server {
                    listen 50002 ssl;
                    proxy_pass electrs;
                    ssl_certificate /etc/nginx/ssl/nginx.crt;
                    ssl_certificate_key /etc/nginx/ssl/nginx.key;
                    ssl_session_cache shared:SSL:1m;
                    ssl_session_timeout 4h;
                    ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
                    ssl_prefer_server_ciphers on;
  16. unlink the nginx default site in the sites-active directory and restart nginx

    sudo rm /etc/nginx/sites-enabled/default
    sudo systemctl restart nginx

Done! I now have an electrum server at https://localhost:50001 that I can use as a back end to an electrum client, or any other service that uses the electrum server apis to browse the bitcoin block chain.