Skip to main content

Storage Node Operators Storj V3

Awhile ago I was a node operator on Storj’s previous decentralized storage network that was meant to compete with the likes of Amazon’s storage services…

Raspberry Pi 3

Due to <insert Storj’s history> it was no longer profitable and shortly after no longer available to run your own Storj nodes as Storj itself was under going changes. Not saying it’s profitable now, not saying it isn’t. I’m doing this for the pure badassery of it all.

Edit: My memory was hazy — it was always possible to run a V2 node: “we (Storj) did limit the upload of new data and new developer accounts”

Why? To earn STORJ — an ERC-20 utility token hosted on the Ethereum blockchain.

I, myself, am in the middle of setting up my node. Currently waiting for rsync to finish so I can re-purpose my 8TB HDD for Storj.

Onward with the tutorial.

If you don’t have your official invite received in your email, you cannot currently join the network!

I’m going to make this as brief as possible, which assumes you have Networking, Linux, and various other hardware/software skills already obtained. Or you know how to Google…

Things you need:

  • Raspberry Pi 3 (sd card & power supply)
  • 8TB External HDD via USB (min 500GB needed)
  • Stable high speed internet (minimums: 25 Mbps down/5 Mbps up, 2TB bandwidth/month)

Raspberry Pi

Pi Setup

You’ll need to enable ssh access to your Pi in one of two ways:

  • Drop a sshfile under the boot partition

or

  • Login as pi:raspberry and run the command raspi-config Under Interfaces, enable ssh. sudo reboot to confirm you can ssh into your Pi.

Change your password using passwd

Install ufw

Allow the proper ports & sudo ufw enable to turn on the firewall

sudo ufw allow ssh // SSH port (default 22)

sudo ufw allow 28967 // Default Storj Port

sudo ufw allow 14002 // GUI Dashboard

(If you already turned on the firewall before running the above commands, hit your pi with this command to reload the new rules: sudo ufw reload)

At this point we have a secured (behind your router I’m assuming else you may want to dabble with ssh keys instead of plain-jane passwords) Raspberry Pi 3 Ready for some software.

Don’t forget to setup a static IP for your Pi device on the primary (ethernet > wifi recommended) network. Setup port forwarding to this IP on the port used below: 28967.

Hit your Pi with sudo apt update && sudo apt upgrade

Install Docker

curl -sSL https://get.docker.com | sh

Pull the Storj Image

docker pull storjlabs/sotragenode:beta

Create a script to run docker with proper parameters

nano storjNode.sh

Contents:

docker run -d --restart always -p 28967:28967 -p 14002:14002 \
-e WALLET="0x0000…." \
-e EMAIL="your@email.com" \
-e ADDRESS="externaladdress:28967" \
-e BANDWIDTH="32TB" \
-e STORAGE="7TB" \
--memory=800m \
--log-opt max-size=50m \ 
--log-opt max-file=10 \
--mount type=bind,source=/home/pi/.local/share/storj/identity/storagenode,destination=/app/identity \
--mount type=bind,source=/mnt/storagenode,destination=/app/config \
--name storagenode storjlabs/storagenode:beta

Hit the file with an executable permission change

sudo chmod +X storjNode.sh

Pause.
At this point we have everything but …

  1. 8TB HDD connected & configured
  2. Your Storj Node Identity files on the Pi’s SD card

HDD Setup

Make sure no important files on stored on this drive!
!!! These commands will wipe the drive !!!

Plug in your drive. Leave unmounted.

Make sure this path exists!/mnt/storagenode

mkdir /mnt/storagenode

Find your HDD: sudo fdisk -l

Wipe Partitions:

sudo fdisk /dev/sdX  // enters fdisk utility 
p // print out partition(s)
d // delete partition(s), run several times to delete all
n // new partition, (default partition number) enter, 
  // (default first sector) enter, (default last sector) enter
w // write changes to disk
// Create ext4 files system
sudo mkfs.ext4 /dev/sdXN  // Ex: /dev/sda1 (sda = device) 
                          //               (1 = partition)
// Mount device at boot
// Side Note: it's bad practice to use "/dev/sda1" to mount as these // are "pointers" to the UUID of the partition. A reboot when      // different devices are detected can change which "dev/sdXN" gets // assigned to the UUID. Breaking the configuration. 
// List UUIDs
sudo blkid 
// Copy the proper UUID listed for your partition.
// Open fstab
sudo nano /etc/fstab
// add this line, save and exit - filling the UUID with the above
UUID=3b5d3076-caa2-4ad2-9ffb-c8e6263b8e06  /mnt/storagenode ext4    defaults,nofail 0 2
sudo mount -a // mount the drive
df -h // display disk free space by Filesystem, size, used, avail,
      // use%, Mounted on

Reboot your device, re-run the last command above for a sanity check!

Bare with me, we are almost there!

Identity Setup

Look back at the storjNode.sh contents.
Near the bottom

/home/pi/.local/share/storj/identity/storagenode

Make sure this path exists!

mkdir --parents ~/.local/share/storj/identity/storagenode

Now lets create that identity!
You want to use a much more powerful computer (your desktop or laptop) as it will reportedly take the Pi device 24 hours to create.

Download the identity binary for your platform:

Assuming Windows, open cm or powershell and run

./identity_windows_amd64.exe create storagenode

These file are located here:

$Env:APPDATA/Storj/Identity/storagenode

Sign your identity with your official invite!

Format: email:key replace the text below with yours

./identity_windows_amd64.exe authorize storagenode user@example.com:ohihioHiohohIOhUyTUfyufVJHvufUyvJHvyFTYdhVJGionOoHib

Copy these files (via WinSCP) to the Pi directory we created earlier.

~/.local/share/storj/identity/storagenode

Run it!

sudo ./storjNode.sh

Check status: sudo docker ps

Navigate to the UI screen → IP:14002

#MicDrop

Raspberry Pi

Bonus Tip:
Want your docker image to update automatically?
Hit your Pi terminal with this:

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
nodejsjavascriptnode-jsraspberry-pipi

Comments

Popular posts from this blog

4 Ways to Communicate Across Browser Tabs in Realtime

1. Local Storage Events You might have already used LocalStorage, which is accessible across Tabs within the same application origin. But do you know that it also supports events? You can use this feature to communicate across Browser Tabs, where other Tabs will receive the event once the storage is updated. For example, let’s say in one Tab, we execute the following JavaScript code. window.localStorage.setItem("loggedIn", "true"); The other Tabs which listen to the event will receive it, as shown below. window.addEventListener('storage', (event) => { if (event.storageArea != localStorage) return; if (event.key === 'loggedIn') { // Do something with event.newValue } }); 2. Broadcast Channel API The Broadcast Channel API allows communication between Tabs, Windows, Frames, Iframes, and  Web Workers . One Tab can create and post to a channel as follows. const channel = new BroadcastChannel('app-data'); channel.postMessage(data); And oth...

Certbot SSL configuration in ubuntu

  Introduction Let’s Encrypt is a Certificate Authority (CA) that provides an easy way to obtain and install free  TLS/SSL certificates , thereby enabling encrypted HTTPS on web servers. It simplifies the process by providing a software client, Certbot, that attempts to automate most (if not all) of the required steps. Currently, the entire process of obtaining and installing a certificate is fully automated on both Apache and Nginx. In this tutorial, you will use Certbot to obtain a free SSL certificate for Apache on Ubuntu 18.04 and set up your certificate to renew automatically. This tutorial will use a separate Apache virtual host file instead of the default configuration file.  We recommend  creating new Apache virtual host files for each domain because it helps to avoid common mistakes and maintains the default files as a fallback configuration. Prerequisites To follow this tutorial, you will need: One Ubuntu 18.04 server set up by following this  initial ...

Working with Node.js streams

  Introduction Streams are one of the major features that most Node.js applications rely on, especially when handling HTTP requests, reading/writing files, and making socket communications. Streams are very predictable since we can always expect data, error, and end events when using streams. This article will teach Node developers how to use streams to efficiently handle large amounts of data. This is a typical real-world challenge faced by Node developers when they have to deal with a large data source, and it may not be feasible to process this data all at once. This article will cover the following topics: Types of streams When to adopt Node.js streams Batching Composing streams in Node.js Transforming data with transform streams Piping streams Error handling Node.js streams Types of streams The following are four main types of streams in Node.js: Readable streams: The readable stream is responsible for reading data from a source file Writable streams: The writable stream is re...