Raspberry Pi - Project 07 (STORJ Farming Guide)

Raspberry Pi - Project 07 (STORJ Farming Guide)

By Mynima | Hobbyist Mining | 22 May 2020


In my previous article I gave a brief overview of the Storj project, a decentralized cloud storage solution. This time we're going to look at how to set up our trusty old Raspberry Pi as a storage node and 'farm' some STORJ tokens for our efforts. Before we being I will say that this step-up process can be a bit long winded and a little technical so make sure you give yourself a suitable amount of time before having a go at this. 

As we begin there are a few prerequisites. This guide assume the following:

Finally, there are a couple of things to remember; I take no responsibility for any issues you run into if you try this at home (be smart, download any software at your own risk). This is provided for educational purposes only.


1. Setting up the Pi

Before we go through the setup we need to prepare our Pi. They ask for a 64 bit operating system. Fortunately, upgrading to this on Raspbian is quite straight forward. So, as is always it is good practice to begin with an update and upgrade of your existing OS.

sudo apt-get update
sudo apt-get upgrade

Then we need to upgrade and update our boot config file using the nano text editor. Submit the first two lines below and then add the rest into the text file.

sudo rpi-update
sudo nano /boot/config.txt

#Enable 64bit

Once added press CRTL-O and then ENTER followed by CRTL-X and ENTER, this will save and close the config file. Afterwards we should reboot the Pi.

sudo reboot

Now that it has rebooted we can check by typing "uname -a" into the terminal and should see something like this.



2.  Port forwarding/Firewall

Next we need to set up our port forward to make sure connections are stable for communication with the Storj network. The main guide from Storj suggests signing up for free with NoIP. You're more than welcome to go with that method and skip this next step. However, I'm going to show you how to set the Pi up with a static IP so we shouldn't need NoIP.

The first two lines below get the info you need for updating then we open up the DHCP config file in the nano text editor.

ip route | grep default | awk '{print $3}'
cat /etc/resolv.conf

sudo nano /etc/dhcpcd.conf

Then scroll down to the example static IP configuration section that looks like below and modify for your own router etc.

#Ethernet connection
interface eth0

static ip_address=     #Add your chosen IP here with /24 at the end
static routers=             #The address of your home router
static domain_name_servers= #This is the IP of your DNS most likely the router 

#If you have a Pi with built in WiFi use this as well
interface wlan0

static ip_address=
static routers=
static domain_name_servers=

Once added press CTRL-O and then ENTER followed by CTRL-X and ENTER, this will save and close the config file and reboot the Pi again. We can then check this by executing the "ifconfig" in the terminal. Scroll down to check that the address is the one you added.

We an now more to the port forwarding, we can do this from our router directly, there are a bunch of guides for each router. What we're looking for specifically is to forward the following port:

  • 28967 - The main network port

With that done we need to open up the port and then also, if you are using the UFW (uncomplicated firewall) on the Raspberry Pi, you will need to add acceptations to firewall too.

sudo iptables -A INPUT -p tcp --dport 28967 -j ACCEPT
sudo iptables -A INPUT -p udp --dport 28967 -j ACCEPT

sudo ufw allow 28967 comment 'Storj Network'

You can execute "sudo ufw verbose" into the terminal to check on your firewall rules.


3. Mounting our external drive

This is the last step before to dive into the Storj specific setup and it is one of the most important because we need to make sure out drive is hooked up to the Pi as that is where our file storage will take place. Before doing this make sure, if you are using an old drive, you have wiped it or removed all items you previously wanted to keep.

To prepare our drive we're going to prepare the mount location and give full read/write access

sudo mkdir /mnt/storagenode
sudo chown -R pi:pi /mnt/storagenode
sudo chmod -R 775 /mnt/storagenode

Next with the new drive plugged in we need to find it.

sudo fdisk -l

After we've taken the disc location (in my case /dev/sda) we want to open up the disc utility and clear it and create a new partition.

sudo fdisk /dev/sda

Option "p" show you the current partitions followed by "d" to delete the partitions (repeat for each). Followed by "n" for a new partition then hit enter until you get back around to "Command (m for help):", at which point we can press "w" to write and exit out of the utility.

With that done we need to create an ext4 file system.

sudo mkfs.ext4 /dev/sda1

Note here "sda1", this is "sda" for my drive and "1" for the partition, as there is only one partition on this drive.

We can then go on to mount the drive, to do this we're first looking at the correct UUID for the drive and then opening up the fsdtab in the text editor and then mounting there. Using the UUID help avoid issue with using the sda1 address. Just add the line beginning "UUID" but replace the "xxx" section with your drives UUID.

sudo blkid
sudo nano /etc/fstab
UUID=xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx  /mnt/storagenode ext4    defaults,nofail 0 2

Press CTRL-O and ENTER followed by CTRL-X and ENTER to save and close the fstab file, then follow it up with the commands below to mount the drive and check that it is correctly mounted.

sudo mount -a 
df -h

All being well you should see something like the following.


Last, but by no means least we need to make sure that we add cgroup memory support if you don't you'll get a warning from the docker running later. The first command below opens up the cmdline file where we will add the remaining to the end of the file.

sudo nano /boot/cmdline.txt

cgroup_enable=memory cgroup_memory=1 swapaccount=1

Press CTRL-O and ENTER followed by CTRL-X and ENTER to save and exit the file. Go ahead and reboot your Pi again here, recheck the mounted drives after boot to make sure everything looks correct.


4. Setting up your node identity

Congratulation if you're with me so far. As I said at the beginning it is quite a long process so just take your time. Next up it is critical that you completed step 4 of the prerequisites at the top, if you haven't got your token then you cannot continue to the next bit.

First we need to download the binary and unzip it and finally create the node identity.

curl -L https://github.com/storj/storj/releases/latest/download/identity_linux_arm64.zip -o identity_linux_arm64.zip
unzip -o identity_linux_arm64.zip
chmod +x identity
sudo mv identity /usr/local/bin/identity
identity create storagenode

You will see it cycle through the key generation until it finds one of an appropriate difficulty (min 36). It may take a bit of time (I left it running over night), but when it is done it will look like this.


Afterwards open up the email with your authorization token in it and enter the following command into the terminal (replacing the last part).

identity authorize storagenode <email:characterstring>

We can then run the following commands to check it all went as expected. The first should resolve as "2" and the second "3"

grep -c BEGIN ~/.local/share/storj/identity/storagenode/ca.cert
grep -c BEGIN ~/.local/share/storj/identity/storagenode/identity.cert

Take a minute here to copy the content of the ./home/pi/.local/share/storj/ folder to somewhere else (not on your Pi if you can). If you need to go through the setup again this will speed things up. 

5. The command line interface (CLI)

For this part Storj uses docker so first we need to go download and install this along with the docker container.

curl -sSL https://get.docker.com | sh
sudo docker pull storjlabs/storagenode:beta

With that done we're almost ready to start running our node, to do this we're going to setup a script to run the node and pass all the commands needed. Create a file and open it in the text editor with the following:

sudo touch ~/00_Start_Storj.sh
sudo nano ~/00_Start_Storj.sh

Then paste in the following file and update the items as mentioned below.

sudo docker run -d --restart always --stop-timeout 300 \
-p 28967:28967 \
-p 14002:14002 \
-e WALLET="0x0000…." \
-e EMAIL="your@email.com" \
-e ADDRESS="externaladdress:28967" \
-e STORAGE="500GB" \
--memory=800m \
--log-opt max-size=50m \
--log-opt max-file=10 \
--mount type=bind,source=<identity-dir>,destination=/app/identity \
--mount type=bind,source=/mnt/storagenode,destination=/app/config \
--name storagenode storjlabs/storagenode:beta
  • Update the "-e" line with your payout wallet, email address, external IP address (can check with https://ping.eu/port-chk/ if you don't know it) and then the amount of storage space you have available (minus 10%, so 500GB would mean you have 550GB of space).
  • Replace <identity-dir> location of your identity files, the path from the command we ran in the previous step

Once updated press CTRL-O and ENTER followed by CTRL-X and ENTER to save and close the script. Submit the command below to make the script the executable.

sudo chmod +x ~/00_Start_Storj.sh

Finally, submit the command below to start the node.


Before we move on to check on our stats lets also go ahead and set it up to automatically update as and when it needs to. We can do this using the commands below (the idea here being we want ti to look after itself).

sudo docker pull storjlabs/watchtower
sudo docker run -d --restart=always --name watchtower -v /var/run/docker.sock:/var/run/docker.sock storjlabs/watchtower storagenode watchtower --stop-timeout 300s --interval 21600


6. Checking on your stats

Now we've got the node up and running we need to check on our stats. All we need to do for this is to head on over to our favorite web browser (#BRAVE) and type in the following http://<your-nodes-local-ip>:14002/. The top section include the network stats of usage.


The bottom section includes the payout information.


In case you need to stop and then restart you need to make sure to both stop the docker and remove the container. The following commands will do this.

sudo docker stop -t 300 storagenode
sudo docker rm storagenode


Well that one was a mammoth!! Either way, Congratulations!! You're farming STORJ!!


Hope you enjoyed the guide, good luck y'all! If you got stuck anyway look at the reference documents below for help.



Donations Welcome (STORJ): 0x46B756702b865AF30Cc0edba27e6d550e775A904

Support References:




How do you rate this article?




Hobby miner and Crypto interested programmer. https://mynima.github.io/

Hobbyist Mining
Hobbyist Mining

Mining: Tips and how-to guides from one beginner to another.

Send a $0.01 microtip in crypto to the author, and earn yourself as you read!

20% to author / 80% to me.
We pay the tips from our rewards pool.