Raspberry PI 4 BCH Full Node

1 76
Avatar for AndrewStone
4 years ago

For people who want to run a dedicated BCH full node, a Raspberry PI is a good, inexpensive option. It is a 32 bit ARM machine so is less powerful compared to an Intel NUC (small form factor Intel PC), but a full node can be had for less than $200, compared to $500 - $800 for a NUC.

Hardware

I chose a configuration that came in a bit above $200 but was convenient.

I started with the CanaKit Raspberry PI 4, 8GB . You can find cheaper options, or something more beautiful such as a single PI+SSD enclosure or one with a touchscreen.

I chose this because it was simple one-stop shopping, since it contained a full PI 4 setup with case, heat sinks, fans, power supply, on/off switch, and boot flash.

Next, we need a SSD to store the blockchain. Getting a high performance SSD and enclosure is important since the PI's 8GB of RAM does not leave much room for caching. Make sure it is advertised as 500+ MB/sec transfer. I chose the 1TB Samsung 870 QVO since it was competitively priced and fast. However, the BCH blockchain currently consumes only about 250 GB so you can save money by purchasing a lower capacity drive.

For the SSD enclosure, I purchased this one from Inatek. There are a lot of choices here; just make sure that you get one compatible with USB 3.0!

Install the SSD in the enclosure, connect it to the RPI via a USB 3.0 cable, and flip the SSD enclosure's power switch to "on".

I had an old monitor and extra keyboard/mouse for use during setup. After the set up its easy enough to go headless (or maybe dual-purpose the machine as a full node and cryptocurrency ticker/news feed).

The final hardware is very compact, and sits near my router. You can attach the PI and SSD with a bit of double sided tape to keep them together and get a very short usb3 cord to connect them.

Software Setup

At this point, you should boot up your Raspberry PI and go through its basic install and setup. I used the Raspbian (Raspberry PI) OS, which is the first choice in the CanaKit installer.

Once you've completed this install, it will have installed Linux and auto-boot you to a graphical desktop as the "pi" user.

Get the Bitcoin Unlimited Software

Go to https://www.bitcoinunlimited.info/download and download the 32 bit ARM version of BCH Unlimited.

Setup the SSD Volume and Copy the Software

sudo fdisk /dev/sda

Answer the prompts: n, p, <defaults for the rest>. Then "w" to write the changes

sudo mkfs -t ext4 /dev/sda1

Set up the sdd directory and auto-mount it:

sudo mkdir /ssd
sudo nano /etc/fstab

And add this line to the end of the file:

/dev/sda1 /ssd ext4 defaults 0 0

Now mount /ssd, detar BCH Unlimited, and create a bitcoin data directory:

sudo mount /ssd
cd /ssd
sudo tar xvfz ~/bch-unlimited*
sudo chmod -R a+r bch-unlimited*
sudo mkdir .bitcoin
sudo chown pi .bitcoin

cd ~
ln -s /ssd/.bitcoin .

To remain within the Raspi's 8GB, set your bitcoin configuration as follows by creating a new bitcoin.conf file:

nano ~/.bitcoin/bitcoin.conf
server=1
dbcache=100
par=2
maxorphantx=50
maxmempool=100
persistmempool=false
maxconnections=50
maxoutconnections=5
maxreceivebuffer=5000
maxsendbuffer=5000
net.blockDownloadWindow=50

Running BCH Unlimited

Running from the command line

To start it all going to make sure it works, you can run bitcoin-qt or bitcoind from the command line:

/ssd/bch-unlimited*/bin/bitcoin-qt

Automatically Start On Login

mkdir ~/.config/autostart
nano ~/.config/autostart/BCHunlimited.desktop
[Desktop Entry]
Type=Application
Name=Clock
Exec=/ssd/bch-unlimited1.9.0.1/bin/bitcoin-qt

Synchronizing

The Raspberry PI will begin by synchronizing with the blockchain. Since the machine is not high performance, this will likely take a few days (the highest performance desktops with gigabit ethernet connections can do it in hours). In particular, the synchronization may appear to stall around 2016-2017. Progress is still happening, but at this time, the pre-BTC-fork blockchain was filling 1MB blocks. And after we forked, there were a few "stress tests" to prove large blocks in BCH.

These can take awhile, so be patient. Once synchronized, the machine will easily keep up with the block and transaction load.

BCH Unlimited Statistics

As your node is synchronizing, you can pop up the "debug" window to see its connections to other nodes and its upload/download bandwidth.

Exposing Your Node to the Network

It has been argued that an end user running their own full node is worthless. I disagree, although there is a kernel of truth that doing so it not as valuable as mining. But I believe that it is worthwhile for the following reasons.

  1. They serve data to SPV (phone) wallets and other full nodes.

  1. They help hide mining and other economically significant full nodes from eclipse, denial-of-service, and other attacks.

  2. They enforce the consensus rules for your own use, and "carry" the SPV wallets they serve onto whatever fork follows those rules. This makes it harder for a group of miners or other full nodes to choose to change these rules.

  3. From a cryptocurrency community perspective, full nodes (and especially full nodes whose IP address does not resolve to a data center) express an individual who has a persistent interest in the cryptocurrency. While its easy to rent virtual servers in a data center, its pretty hard to get residential IPs.

  4. They choose forks. For example, looking at cashnodes.io and searching for "ABC:0.22" I can see that at the time of this writing only 65 out of 1201 full nodes care enough about the IFP to upgrade! This includes 455 ABC nodes that haven't upgraded. I believe that this clearly indicates negative sentiment around the plan to loot the currency by compromising security commonly called the "IFP". And it indicates that this negative sentiment exists even among people who were previously enough of a proponent of ABC to run a full node. This is a powerful message that ABC should heed if it wants to remain relevant.

But to be helpful in these ways, your node must be visible on the internet. To do so, you very likely need to configure your router/firewall to forward port 8333 to port 8333 on your Raspberry PI. How to accomplish this exactly depends on your router/firewall so is beyond the scope of this article. However, please take the time to do this so that your node helps out the network!

You can determine whether your node is visible from the outside by first Googling
"what's my ip". Then enter that IP address into the query box at coin.dance about halfway down the page here to search for your node.

8
$ 1.87
$ 1.67 from @TheRandomRewarder
$ 0.10 from @tula_s
$ 0.10 from @RufusYoakam
Avatar for AndrewStone
4 years ago

Comments

Update: Been running continuously except for software updates for a year now!

$ 0.00
3 years ago