Skip to content

Instantly share code, notes, and snippets.

@acburkhardt
Last active September 19, 2021 11:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save acburkhardt/b3d8d5f61823b7119d58364f56a8c0a5 to your computer and use it in GitHub Desktop.
Save acburkhardt/b3d8d5f61823b7119d58364f56a8c0a5 to your computer and use it in GitHub Desktop.
layout title parent nav_order has_toc
default
Upgrade to 64bit
Bonus Section
130
true

Bonus Guide: Upgrade to 64-bit Ubuntu Server OS

{: .no_toc }

While you can run LND on a 32-bit OS, complications will arise if your channel database exceeds ~950MB, so you may want to upgrade to a 64-bit OS in the long run.

We'll use the Ubuntu Server OS since there is no officially supported 64-bit Raspberry Pi OS{:target="_blank"}.

➕ If you have a spare Pi4 and microSD card handy, you can leave your node online and configure everything on your spare Pi until the final steps in order to decrease downtime. Otherwise...

This guide can be completed with minimal downtime with nothing but the Pi and microSD card on which you're currently running your node.


Table of contents

{: .no_toc .text-delta }

  1. TOC {:toc}

Preparation

With some preparation, we can reduce downtime and ensure that our current system can be quickly restored if need be.

Backup Important Files

You should make a backup of any important files before proceeding with this operation.

Static channel backup

At a minimum, it's recommended to make a backup of the LND static channel backups.

You can do this with Dropbox via the Static Channel Backups guide.

System backup

It's also recommended that you backup your system, especially if you are not using a new microSD card for the 64-bit OS environment and plan to overwrite the existing one.

You can do this via the System Recovery guide.

This way, if you are interrupted before completing the setup of your new system, you can re-flash the existing system's image to your SD card and bring your node back online until you are able to return to the process.

External hard disk backup

It may also be a good idea to backup the essential files on your external hard disk.

You can do this via the System Recovery guide.

Copy configuration files from current microSD

Before taking your node offline, make a copy of any customized system services or configuration files that you'll want on your new system.

Here's a list of the files that you may want to copy from your current system:

/etc/systemd/system/bitcoind.service
/etc/systemd/system/lnd.service
/etc/systemd/system/electrs.service
/etc/systemd/system/btcrpcexplorer.service
/home/btcrpcexplorer/btc-rpc-explorer/.env
/etc/nginx/nginx.conf
/etc/tor/torrc
/home/admin/.bashrc
/home/admin/.profile

Add to your list any other system services, cron jobs, configuration files, or scripts that you may have created or edited which would be helpful to copy from your current system's SD card.

To jog your memory, you could check to see which system services currently depend on bitcoind or lnd:

$ systemctl list-dependencies --before bitcoind --before lnd
bitcoind.service
● ├─btcrpcexplorer.service
● ├─electrs.service
● ├─lnd.service
● ...

lnd.service
● ├─bos-telegram.service
● ├─lit.service
● ...

Once you've finalized your list, you can copy the files to your regular computer via SFTP so you have them handy when setting up your 64-bit OS environment.

  • First, as the admin user on your current 32-bit OS node, create a directory for the files you would like to copy to your regular computer.
~ $ mkdir raspibolt-migrate && cd raspibolt-migrate
  • Copy each of the files in your list to this directory, replacing <file> with the full path to the file:
$ sudo cp <file> ./
  • Change the owner of the directory and all copied files:
$ sudo chown -R admin:admin ./
  • Change to your home directory and establish an SFTP connection to your regular computer:
$ cd
$ sftp bob@bob-thinkpad.local
> bob@bob-thinkpad.locals password:
> Connected to bob@bob-thinkpad.local.
  • Transfer the files to your regular computer:
sftp> put -R raspibolt-migrate

...

sftp> exit

You can find these files on your regular computer in ~/raspibolt-migrate.

Take your node offline

➕ If you're going to use a spare Pi and microSD card to build your 64-bit OS enviroment, skip this section for now. Otherwise...

Now is the time to power down your node:

$ sudo shutdown --poweroff now

Once it has shut down, toggle the power switch to "off" and unplug the external hard drive as we will not need it until later.


Build 64-bit environment

Write OS Image to SD Card

The node runs headless, which means without keyboard or display, so the Ubuntu Server operating system is used.

  1. Download and install the Raspberry Pi Imager{:target="_blank"}.
  2. Choose “Other general-purpose OS” and then the latest 64-bit "Ubuntu Server" OS, choose your SD-card and write the image.

Prepare Wifi

You can run your RaspiBolt over Wifi. To avoid using a network cable for the initial setup, you can pre-configure the wireless settings:

  • Edit the file network-config in the system-boot partition of the microSD card and uncomment the following lines:
wifis:
  wlan0:
    dhcp4: true
    optional: true
    access-points:
      myhomewifi:
        password: "S3kr1t"
  • Replace [WIFI_SSID] and [WIFI_PASSWORD] with the credentials for your own WiFi network. Note that both need to be in double-quotes (like password: "password")
wifis:
  wlan0:
    dhcp4: true
    optional: true
    access-points:
      "[WIFI_SSID]":
        password: "[WIFI_PASSWORD]"

Start your Pi

  • Safely eject the sd card from your computer
  • Insert the sd card into the Pi
  • If you did not already setup Wifi: connect the Pi to your network with an ethernet cable
  • Start the Pi by connecting it to the power adapter using the USB-C cable

Connecting to the Raspberry Pi

Find it
  • On your regular computer, open the Terminal.

  • Try to ping the Ubuntu Server local hostname (press Ctrl-C to interrupt)

    $ ping ubuntu
    > PING ubuntu.xyzroutergateway.com (192.168.1.192) 56(84) bytes of data.
    > 64 bytes from 192.168.1.192 (192.168.1.192): icmp_seq=1 ttl=64 time=88.1 ms
    > 64 bytes from 192.168.1.192 (192.168.1.192): icmp_seq=2 ttl=64 time=61.5 ms
  • If you get a response like above, mDNS works within your local network. Proceed directly to the next section.

  • If the ping command fails or does not return anything, you need to manually look for your Pi. Follow the steps in the section titled Determining the Pi’s IP address in Part 4: Boot Ubuntu Server{:target="_blank"} of the official Ubuntu Server Raspiberry Pi installation guide.

  • You should now be able to reach your Pi, either with the hostname ubuntu or an IP address like 192.168.0.20.

Access with Secure Shell

Now it’s time to connect to the Pi via SSH and get to work building your 64-bit environment.

If you need to provide connection details, use the following settings:

  • host name: ubuntu or the ip address like 192.168.0.20
  • port: 22
  • username: ubuntu
  • password: ubuntu

Install and start the SSH client for your operating system:

  • Windows: PuTTY (Website{:target="_blank"})

  • MacOS and Linux: from the Terminal, use the native command:

    • ssh ubuntu@ubuntu or
    • ssh ubuntu@192.168.0.20

    Once you've logged in, you will be prompted to set a new password. Confirm the current password before changing it to your password [A].

    You will be logged out and can now log back in using your password [A].

Change hostname

Give your node your preferred local hostname, like "raspibolt".

➕ If you are using a spare Pi and your 32-bit OS node is still online, choose a temporary hostname that does not conflict with your 32-bit OS node's, such as "raspibolt64". You can change back to the hostname you would like to use later when your 32-bit OS node is offline.

  • Change your hostname and save and exit:
$ sudo nano /etc/hostname
  • Edit your hosts file:
$ sudo nano /etc/hosts
  • Add the following line underneath 127.0.0.1 localhost, replacing <hostname> with the hostname you've chosen:
127.0.1.1 <hostname>

Finally, install avahi, which will allow you to access your Raspibolt locally at <hostname>.local:

$ sudo apt install avahi-daemon

Important: if you connected using the hostname ubuntu, you now need to use the new hostname (e.g. raspibolt or raspibolt.local)

Software update

💡 Do this regularly every few months to get security related updates.

$ sudo apt update
$ sudo apt full-upgrade

If asked which services should be restarted, hit esc for now, as we will be rebooting soon.

Make sure that all necessary software packages are installed:

$ sudo apt install htop git curl bash-completion jq qrencode dphys-swapfile hdparm --install-recommends

Add users

  • Create the new user "admin", set password [A] and add it to the group "sudo":

    $ sudo adduser admin --ingroup sudo
  • While you’re at it, change the password of the “root” admin user to your password [A].

    $ sudo passwd root
  • Create the "bitcoin" user, set your password [A] and confirm all questions with the enter/return key.

    $ sudo adduser bitcoin
  • Add the "admin" user to the "bitcoin" group, giving it read-only privileges to configuration files.

    $ sudo adduser admin bitcoin

    Add any other users and groups required for additional tooling you may have installed.

  • Restart your RaspiBolt.

    $ sudo reboot

Security

Follow all the steps outlined in Security{:target="_blank"}.

Privacy

Follow all the steps outlined in Privacy{:target="_blank"}.

Bitcoin

⚠️ Ensure that you download and install the same version of Bitcoin Core that you were running on your 32-bit OS node.

  • Login as "admin" and change to the tmp directory, which is cleared on reboot.

    cd /tmp
  • Get the latest download links at bitcoincore.org/en/download{:target="_blank"} (ARM Linux 64 bit), they change with each update. Then run the following commands (with adjusted filenames) and check the output where indicated:

    # download Bitcoin Core binary
    $ wget https://bitcoincore.org/bin/bitcoin-core-0.21.1/bitcoin-0.21.1-aarch64-linux-gnu.tar.gz
    $ wget https://bitcoincore.org/bin/bitcoin-core-0.21.1/SHA256SUMS.asc
    $ wget https://bitcoin.org/laanwj-releases.asc
    
    # check that the reference checksum matches the real checksum
    # (ignore the "lines are improperly formatted" warning)
    $ sha256sum --check SHA256SUMS.asc --ignore-missing
    > bitcoin-0.21.1-aarch64-linux-gnu.tar.gz: OK
    
    # import the public key of Wladimir van der Laan, verify the signed  checksum file
    # and check the fingerprint again in case of malicious keys
    $ gpg --import ./laanwj-releases.asc
    $ gpg --refresh-keys
    $ gpg --verify SHA256SUMS.asc
    > gpg: Good signature from "Wladimir J. van der Laan ..."
    > Primary key fingerprint: 01EA 5486 DE18 A882 D4C2 6845 90C8 019E 36C2 E964
  • Extract the Bitcoin Core binaries, install them and check the version.

    $ tar -xvf bitcoin-0.21.1-aarch64-linux-gnu.tar.gz
    $ sudo install -m 0755 -o root -g root -t /usr/local/bin bitcoin-0.21.1/bin/*
    $ bitcoind --version
    > Bitcoin Core version v0.21.1
    
    
Configuration
  • Create a symbolic link to the bitcoin working directory

    $ cd
    $ ln -s /mnt/ext/bitcoin .bitcoin
    $ ls -la
  • Do the same for the "bitcoin" user, as well as any other users you've created which require it

$ sudo su - bitcoin
$ ln -s /mnt/ext/bitcoin .bitcoin
$ ls -la
$ exit
Autostart on boot

As the "admin" user, create the configuration file in the Nano text editor and copy and paste from the version you copied to your regular computer. Save and exit.

 $ sudo nano /etc/systemd/system/bitcoind.service

⚠️ Do not enable or start the service yet.

Lightning

Download

⚠️ Ensure that you download and install the same version of LND that you were running on your 32-bit OS node.

Download and install LND:

$ wget https://github.com/lightningnetwork/lnd/releases/download/v0.13.1-beta/lnd-linux-arm64-v0.13.1-beta.tar.gz
$ wget https://github.com/lightningnetwork/lnd/releases/download/v0.13.1-beta/manifest-v0.13.1-beta.txt
$ wget https://github.com/lightningnetwork/lnd/releases/download/v0.13.1-beta/manifest-roasbeef-v0.13.1-beta.sig
$ wget -O roasbeef.asc https://keybase.io/roasbeef/pgp_keys.asc

$ sha256sum --check manifest-v0.13.1-beta.txt --ignore-missing
> lnd-linux-armv7-v0.13.1-beta.tar.gz: OK

$ gpg ./roasbeef.asc
> pub rsa4096 2019-10-13 [C] E4D85299674B2D31FAA1892E372CBD7633C61696
> uid Olaoluwa Osuntokun <laolu32@gmail.com>

$ gpg --import ./roasbeef.asc
$ gpg --verify manifest-roasbeef-v0.13.1-beta.sig manifest-v0.13.1-beta.txt
>gpg: Signature made Mon 19 Jul 2021 22:41:37 BST
>gpg:                using RSA key 60A1FA7DA5BFF08BDCBBE7903BBD59E99B280306
>gpg: Good signature from "Olaoluwa Osuntokun <laolu32@gmail.com>" [unknown]
>gpg: WARNING: This key is not certified with a trusted signature!
>gpg:          There is no indication that the signature belongs to the owner.
>Primary key fingerprint: E4D8 5299 674B 2D31 FAA1  892E 372C BD76 33C6 1696
>     Subkey fingerprint: 60A1 FA7D A5BF F08B DCBB  E790 3BBD 59E9 9B28 0306

$ tar -xzf lnd-linux-arm64-v0.13.1-beta.tar.gz
$ sudo install -m 0755 -o root -g root -t /usr/local/bin lnd-linux-arm64-v0.13.1-beta/*
$ lnd --version
> lnd version 0.13.1 commit=v0.13.1-beta
Configuration
  • Create a symbolic link to the LND working directory

    $ ln -s /mnt/ext/lnd .lnd
    $ ls -la
  • Do the same for the "bitcoin" user, as well as any other users you've created which require it

$ sudo su - bitcoin
$ ln -s /mnt/ext/lnd .lnd
$ ls -la
$ exit
Autostart on boot

As the "admin" user, create the configuration file in the Nano text editor and copy and paste from the version you copied to your regular computer. Save and exit.

 $ sudo nano /etc/systemd/system/lnd.service

⚠️ Do not enable or start the service yet.

Auto-unlock on boot

If you have an auto-unlock script, you can set it up now.

You can follow the steps in Auto-unlock LND on startup or set up whichever solution you were using on your 32-bit OS node.

Alternatively, you can skip this section for now and manually unlock LND on first startup; be sure to comment out any applicable lines in your LND system service that call scripts which have yet to be set up.


Bring node back online

Now we're ready to configure the external hard drive with our 64-bit OS and bring our node back online.

➕ If you are using a spare Pi, you can skip ahead to Remaining software and configuration and set up any remaining software before returning to this section. If you want to wait until later to install remaining software, you can take your 32-bit OS node offline, unplug your external drive, and swap out the 32-bit OS microSD card with the 64-bit one before turning on your node and proceeding.

External hard drive

Make sure USB3 is performant
  • First, lets get some information about your drive from the kernel messages. Clear the kernel buffer, and follow the new messages (let the last command run):

    $ sudo dmesg -C
    $ sudo dmesg -w
  • Connect your external drive to the blue USB3 ports of the running Raspberry Pi, preferably with a good cable that came with the drive.

    Once the system recognizes it, details are automatically displayed by the dmesg command.

    [  726.547907] usb 2-1: new SuperSpeed Gen 1 USB device number 3 using xhci_hcd
    [  726.579304] usb 2-1: New USB device found, idVendor=152d, idProduct=0578, bcdDevice= 3.01
    [  726.579321] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
    [  726.579333] usb 2-1: Product: USB 3.0 Device
    [  726.579346] usb 2-1: Manufacturer: USB 3.0 Device
    [  726.579357] usb 2-1: SerialNumber: 000000005B3E
    [  726.582254] usb 2-1: UAS is blacklisted for this device, using usb-storage instead
    [  726.582350] usb 2-1: UAS is blacklisted for this device, using usb-storage instead
    [  726.582364] usb-storage 2-1:1.0: USB Mass Storage device detected
    [  726.582674] usb-storage 2-1:1.0: Quirks match for vid 152d pid 0578: 1800000
    [  726.582783] scsi host0: usb-storage 2-1:1.0
    [  727.598422] scsi 0:0:0:0: Direct-Access     INTENSO  SATA III SSD     0301 PQ: 0 ANSI: 6
    [  727.599182] sd 0:0:0:0: Attached scsi generic sg0 type 0
    [  727.605796] sd 0:0:0:0: [sda] 937703088 512-byte logical blocks: (480 GB/447 GiB)
    [  727.606519] sd 0:0:0:0: [sda] Write Protect is off
    [  727.606536] sd 0:0:0:0: [sda] Mode Sense: 47 00 00 08
    [  727.607982] sd 0:0:0:0: [sda] Disabling FUA
    [  727.607998] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
    [  727.611337]  sda: sda1
    [  727.614890] sd 0:0:0:0: [sda] Attached SCSI disk
    
  • Make a note of the values shown for idVendor and idProduct (in this case "152d" and "0578"). Then, exit dmesg with Ctrl-C.

  • List all block devices with additional information. The list shows the devices (e.g. sda) and the partitions they contain (e.g. sda1).

    Make a note of the partition name you want to use (in this case "sda1").

    $ lsblk -o NAME,MOUNTPOINT,UUID,FSTYPE,SIZE,LABEL,MODEL
    > NAME        MOUNTPOINT UUID                                 FSTYPE   SIZE LABEL  MODEL
    > sda                                                                447.1G        SATA_III_SSD
    > └─sda1                 9ec0b784-d448-4757-a3b2-8abd57c544f3 ext4   447.1G
    > mmcblk0                                                             14.9G
    > ├─mmcblk0p1 /boot      5203-DB74                            vfat     256M boot
    > └─mmcblk0p2 /          2ab3f8e1-7dc6-43f5-b0db-dd5759d51d4e ext4    14.6G rootfs
  • Now, let's test the read performance of your drive. Make sure to use the right partition name (used with the /dev/ prefix).

    $ sudo hdparm -t --direct /dev/sda1
    
    /dev/sda1:
    Timing O_DIRECT disk reads:   2 MB in 31.18 seconds =  65.69 kB/sec
  • In this case, the performance is really bad: 65 kB/sec is so 1990's. If the measured speed is more than 50 MB/s, you can skip the rest of this section and go directly to mounting the external drive.

    Otherwise we need to configure the USB driver to ignore the UAS interface of your drive. This configuration must be passed to the Linux kernel on boot:

    • Open the cmdline.txt file of the bootloader.

      $ sudo nano /boot/firmware/cmdline.txt
    • At the start of the line of parameters, add the text usb-storage.quirks=aaaa:bbbb:u where aaaa is the "idVendor" and bbbb is the "idProduct" value. Make sure that there is a single space character ( ) between our addition and the next parameter. Save and exit.

      usb-storage.quirks=152d:0578:u ..............
      
    • Reboot the Raspberry Pi with the external drive still attached.

      $ sudo reboot
    • After you logged in as "admin" again, let's test the read performance once more.

      $ sudo hdparm -t --direct /dev/sda1
      
      /dev/sda1:
      Timing O_DIRECT disk reads: 510 MB in  3.01 seconds = 169.59 MB/sec
    • You should see a significant increase in performance. If the test still shows a very slow read speed, your drive or USB adapter might not be compatible with the Raspberry Pi. In that case I recommend visiting the Raspberry Pi Troubleshooting forum{:target="_blank"} or simply try out hardware alternatives.

Mount external drive
  • List the devices once more and copy the UUID into a text editor on your local computer.

    $ lsblk -o NAME,MOUNTPOINT,UUID,FSTYPE,SIZE,LABEL,MODEL
  • Edit the fstab file and add the following as a new line at the end, replacing 123456 with your own UUID.

    $ sudo nano /etc/fstab
    UUID=123456 /mnt/ext ext4 rw,nosuid,dev,noexec,noatime,nodiratime,auto,nouser,async,nofail 0 2
    

    🔍 more: complete fstab guide{:target="_blank"}

  • Create the directory to add the hard disk and set the correct owner

    $ sudo mkdir /mnt/ext
  • Mount all drives and check the file system. Is “/mnt/ext” listed?

    $ sudo mount -a
    $ df -h /mnt/ext
    > Filesystem      Size  Used Avail Use% Mounted on
    > /dev/sda1       440G   73M  417G   1% /mnt/ext
Check write access in bitcoin directory
  • Switch to user "bitcoin" and navigate to the external drive.

    $ sudo su - bitcoin
    $ cd /mnt/ext
  • Create a testfile in the new directory and delete it.

    $ touch bitcoin/test.file
    $ rm bitcoin/test.file

    If this command gives you an error, chances are that your external hard disk is mounted as “read only”. This must be fixed before proceeding.

  • Exit the "bitcoin" user session

    $ exit
Move swap file
  • Move the old swapfile on your external hard drive.
$ sudo mv /mnt/ext/swapfile /mnt/ext/swapfile-32.bak
  • Edit the configuration file and replace existing entries with the ones below. Save and exit.

    $ sudo nano /etc/dphys-swapfile
    CONF_SWAPFILE=/mnt/ext/swapfile
    
    # comment or delete the CONF_SWAPSIZE line. It will then be created dynamically
    #CONF_SWAPSIZE=
  • Recreate new swapfile on external drive (will be active after reboot)

$ sudo dphys-swapfile install

Start bitcoind

Enable and start the bitcoind system service; watch the logs to ensure it's running smoothly:

 $ sudo systemctl enable bitcoind --now & sudo tail -f .bitcoin/debug.log 

Start lnd

Enable and start the lnd system service; watch the logs to ensure it starts up smoothly:

 $ sudo systemctl enable lnd --now & sudo journalctl -fu lnd

If you do not have an auto-unlock solution set up, you can hit ctrl+c to exit the log and unlock your wallet manually when the time comes:

 $ lncli unlock

Congratulations! Your node is now back online, running on a 64-bit OS.

Remaining software and configuration

We can now return to installing the remaining software that we skipped earlier in order to get back online faster.

Electrs

Install dependencies
  • Install the Rust programming language:

    # download
    $ cd /tmp
    $ curl https://static.rust-lang.org/dist/rust-1.54.0-aarch64-unknown-linux-gnu.tar.gz -o rust.tar.gz
    $ curl https://static.rust-lang.org/dist/rust-1.54.0-aarch64-unknown-linux-gnu.tar.gz.asc -o rust.tar.gz.asc
    $ curl https://keybase.io/rust/pgp_keys.asc | gpg --import
    
    # verify
    $ gpg --verify rust.tar.gz.asc rust.tar.gz
    > gpg: Signature made Do 07 Nov 2019 13:25:50 GMT
    > gpg:                using RSA key C13466B7E169A085188632165CB4A9347B3B09DC
    > gpg: Good signature from "Rust Language (Tag and Release Signing Key) <rust-key@rust-lang.org>" [unknown]
    > gpg: WARNING: This key is not certified with a trusted signature!
    > gpg:          There is no indication that the signature belongs to the owner.
    > Primary key fingerprint: 108F 6620 5EAE B0AA A8DD  5E1C 85AB 96E6 FA1B E5FE
    >     Subkey fingerprint: C134 66B7 E169 A085 1886  3216 5CB4 A934 7B3B 09DC
    
    # install
    $ mkdir /home/admin/rust
    $ tar --strip-components 1 -C /home/admin/rust -xzvf rust.tar.gz
    $ cd /home/admin/rust
    $ sudo ./install.sh
  • Install build tools:

    $ sudo apt install -y build-essential clang cmake
Build from source code

⚠️ Ensure that you download, build, and install the same version of electrs that you were running on your 32-bit OS node.

Now we download the latest release of the Electrs source code, compile it to an executable binary and install it. The whole process takes about 30 minutes.

# download
$ cd /home/admin/rust
$ electrsgit=$(curl -s https://api.github.com/repos/romanz/electrs/tags | jq -r '.[0].name')
$ git clone --branch ${electrsgit} https://github.com/romanz/electrs.git
$ cd electrs

# compile
$ cargo build --locked --release

# install
$ sudo cp ./target/release/electrs /usr/local/bin/
Configuration
  • Login as the "bitcoin" user and create a symbolic link to the electrs working directory
$ sudo su - bitcoin
$ ln -s /mnt/ext/electrs .electrs
$ ls -la
$ exit
SSL encryption
  • Install NGINX

    $ sudo apt install -y nginx
  • Create a self-signed TLS certificate (valid for 10 years)

    $ sudo openssl req -x509 -nodes -newkey rsa:2048 -keyout /etc/ssl/private/nginx-selfsigned.key -out /etc/ssl/certs/nginx-selfsigned.crt -subj "/CN=localhost" -days 3650
  • Remove the default configuration, create a new configuration file in the Nano text editor and copy and paste from the version you copied to your regular computer. Save and exit.

    $ sudo mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bak
    $ sudo nano /etc/nginx/nginx.conf
Autostart on boot

As the "admin" user, create the configuration file in the Nano text editor and copy and paste from the version you copied to your regular computer. Save and exit.

 $ sudo nano /etc/systemd/system/electrs.service

➕ If you are still using your spare Pi and your 32-bit OS node is still online, do not enable or start the service yet. Otherwise...

Enable and start the service:

 $ sudo systemctl enable electrs --now

Block Explorer

Preparation
Install NodeJS
  • Starting with user "admin", we switch to user "root" and add the Node JS package repository. We'll use version 14 which is the most recent stable one. Then, exit the "root" user session.

    $ sudo su
    $ curl -sL https://deb.nodesource.com/setup_14.x | bash -
    $ exit
  • Install NodeJS using the apt package manager.

    $ sudo apt-get install nodejs
Firewall
  • Configure firewall to allow incoming HTTP requests from your local network to the web server.

    $ sudo ufw allow from 192.168.0.0/16 to any port 3002 comment 'allow BTC RPC Explorer from local network'
    $ sudo ufw status
BTC RPC Explorer
Installation
  • Create a new user with your password [ A ] and open a new session

    $ sudo adduser btcrpcexplorer
    $ sudo su - btcrpcexplorer
  • Download the source code directly from GitHub and install all dependencies using NPM. Since the program is written in JavaScript, there is no need to compile.

    $ git clone --branch v3.1.0 https://github.com/janoside/btc-rpc-explorer.git
    $ cd btc-rpc-explorer
    $ npm install
Configuration
  • Create the configuration file in the Nano text editor and copy and paste from the version you copied to your regular computer. Save and exit.
    $ nano .env
First start

➕ If you are still using your spare Pi and your 32-bit OS node is online, skip this section. Otherwise...

  • Let's do a first start to make sure it's running as expected. Make sure we are in the BTC RPC Explorer directory and start the web server.

    $ cd ~/btc-rpc-explorer
    $ npm run start
  • Now point your browser to http://raspibolt.local:3002 (or whatever you chose as hostname) or the ip address (e.g. http://192.168.0.20:3002). You should see the home page of the BTC RPC Explorer.

  • If you see a lot of errors on the RaspiBolt command line, then Bitcoin Core might still be indexing the blockchain. You need to wait until reindexing is done before using the BTC RPC Explorer.

  • Stop the Explorer in the terminal with Ctrl-C and exit the "btcrpcexplorer" user session.

    $ exit
Autostart on boot
  • As the "admin" user, create the configuration file in the Nano text editor and copy and paste from the version you copied to your regular computer. Save and exit.
    $ sudo nano /etc/systemd/system/btcrpcexplorer.service

➕ If you are still using your spare Pi and your 32-bit OS node is online, do not enable or start the service yet. Otherwise...

  • Enable the service, start it and check log output.

    $ sudo systemctl enable btcrpcexplorer.service --now
    $ sudo journalctl -fu btcrpcexplorer
  • You can now access your own BTC RPC Explorer from within your local network by browsing to http://raspibolt.local:3002 (or your equivalent ip address).

Remaining environment configuration files

Tor
  • As the "admin" user, edit the configuration file in the Nano text editor and copy and paste from the version you copied to your regular computer. Save and exit.
    $ sudo nano /etc/tor/torrc
  • Restart tor
    $ sudo systemctl restart tor
Admin user (.bashrc & .profile)
  • As the "admin" user, edit your .bashrc file in the Nano text editor and copy and paste from the version you copied to your regular computer. Save and exit.
    $ nano ~/.bashrc
  • Load the file to your current session:
    $ source ~/.bashrc
  • Edit your .profile file in the Nano text editor and copy and paste from the version you copied to your regular computer. Save and exit.
    $ nano ~/.profile
  • Load the file to your current session:
    $ source ~/.profile

Additional tooling

Install and configure any additional software or tooling that you use.

➕ If you are still using your spare Pi and your 32-bit OS node is online, you can now shut down your spare Pi, take your 32-bit OS node offline, unplug your external drive, and swap out the 32-bit OS microSD card with the 64-bit one before powering on and bringing your node back online.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment