Switching to Knots on Raspiblitz

How to switch from Core to Knots on Raspiblitz (1.11.4)

#SSH into your pi as admin:

ssh admin@raspberrypi.local

#Download the official knots bonus script from the raspiblitz repo, and make it executable:

cd /home/admin/config.scripts
wget -O bonus.knots.sh "https://github.com/raspiblitz/raspiblitz/raw/eb2d2dc43e057281adde3e7b909b65bb3573226d/home.admin/config.scripts/bonus.knots.sh"
chmod +x bonus.knots.sh

#If you are running Core Lightning, stop it:

sudo systemctl stop lightningd

#Otherwise, stop LND if you are running it:

sudo systemctl stop lnd

#Stop bitcoind, and after it is fully shutdown, replace it witth Knots:

sudo systemctl stop bitcoind && sleep 30
sudo -u admin bash -x ./bonus.knots.sh on

#Confirm that you are now running Knots!

bitcoin-cli -version

Important Note:

Core 26.x ignores some corrupt blockchain data, but Knots 28.x does not. You may need to re-index!

How to re-index the blockchain (if necessary)

#Check if a re-index is needed:

bitcoin-cli -rpcwait getblockchaininfo | jq '.blocks, .verificationprogress'

If the above command hangs forever, then you will need to re-index!

#(Optional) Confirm that corrupt blockchain data is actually the problem:

sudo grep -i -A2 -B2 "error" /mnt/hdd/bitcoin/debug.log | tail -n 40

#(if the blockchain data is corrupt, it should print log output that includes: “Corrupted block database detected. Please restart with -reindex or -reindex-chainstate to recover.”)

#Stop bitcoind, and after it fully shuts down, restart it with the -reindex directive:

sudo systemctl stop bitcoind && sleep 30
sudo -u bitcoin /usr/local/bin/bitcoind -conf=/mnt/hdd/bitcoin/bitcoin.conf -datadir=/mnt/hdd/bitcoin -reindex -daemon

#Watch the paint dry (i.e. follow the re-indexing logs). Press Ctrl+C when it finally finishes:

sudo journalctl -u bitcoind -f

#Confirm that it is actually finished (should output two identical numbers and the word “false”):

bitcoin-cli getblockchaininfo | jq '.blocks, .headers, .initialblockdownload'

#Stop bitcoind, and once it has fully shut down, reboot the pi:

bitcoin-cli stop && sleep 30
sudo reboot

If Electrs index is also corrupt

(Manifests in Raspiblitz as Mempool future blocks and fee estimates never loading)

#Stop electrs and bitcoind, and when fully shut down, delete the index and reboot:

sudo systemctl stop electrs
sudo systemctl stop bitcoind && sleep 30
sudo rm -rf /mnt/hdd/app-storage/electrs/db/bitcoin
sudo reboot

If you need to revert back to Core 26.x

#Run the bonus script’s “off” command, and reboot:

cd /home/admin/config.scripts
sudo systemctl stop bitcoind && sleep 30
sudo -u admin bash -x ./bonus.knots.sh off && sleep 30
sudo systemctl stop bitcoind && sleep 30
sudo reboot

#Note: You will need to re-index the blockchain after switching back to Core 26.x, as the 28.x database format is not backwards compatible

How to get your node’s public Tor address

(to check if you are reachable on BitNodes.io)

#While SSH’d in as admin, lookup the address via “getnetworkinfo”:

bitcoin-cli getnetworkinfo | jq -r '.localaddresses[] | "\(.address)"'

1 Like

Thanks so much Paul, love your work. Slight issue. I carried out the above and everything on Bitcoin side is great but its broke LND. It keeps asking for the lightning wallet to be unlocked but just loops when you enter correct password and asks again. Also get generic Server 500 error. I did try a full rebuild of the node (as I had just got it set up) and tried switching to Knots prior to Setup process - end result was just the same. Are there possibly API’s in Core which do not exist in Knots? Any help would be greatly appreciated!

2 Likes

Ok, let me do a little experimenting. I mainly tested with Core Lightning, so I’ll set up LND and see what I can find out.

2 Likes

Thanks Paul, your video and the above post convinced me to switch to Knots too.

And just to add, I also experienced the same error in LND as Gman.

1 Like

Thanks. I had a hardware problem with my NVMe on my Raspberry Pi, so I have a new one ordered and on the way. In the mean time, I’ll check if I can emulate a virtual Raspiblitz, but in any case it will likely be at least a couple days before I can get to investigating the LND problem.

2 Likes

Quick update: I was able to get this running in a VM (preferable to a physical Pi for debugging, since I can easily create and switch between snapshots). I just need to wait for everything to sync and I can start digging into the LND problem.

I followed tutorial, had the same LND wallet unlock failure. I was running the default LND version which is 18.3. I did the following to update to the latest version of LND which fixed the problem.

cd /home/admin/config.scripts

./lnd.update.sh reckless

this installed LND 19.1. Reboot and fixed the problem.

The only remaining issue that I can see is the web UI doesn’t report the status of Bitcoin version, etc. The status screen is correct.

2 Likes

Excellent! I’ll recreate the scenario on my VM once it is synced up, and see if I can figure out the status UI. I appreciate the help! I’ll include this info when I record Part 2.

1 Like

You guys are awesome.

I can confirm the same behavior with the LND update.

1 Like