How to Host a STORJ Node

Step by step guide to run STORJ Node, an open-source cloud storage platform, S3-compatible platform and suite of decentralized applications.
On this page

Storj (pronounced as “storage”), is an open-source cloud storage platform, S3-compatible platform and suite of decentralized applications that allows you to store data in a secure and decentralized manner. Basically, it uses a decentralized network of nodes to host user data. The platform also secures hosted data using advanced encryption.

In a white paper published in December,2014, Storj was first introduced to the world as a concept. It was to be a decentralized peer-to-peer encrypted cloud storage platform.

To host a Node, your hardware and bandwidth will need to meet a few requirements:

  • One processor core
  • Minimum 550GB of available disk space
  • Minimum of 2TB of available bandwidth a month
  • Minimum upstream bandwidth of 5 Mbps
  • Minimum download bandwidth of 25 Mbps
  • Keep your node online 24/7
  • Read and agree to the Storj Storage Node Operator Terms and Conditions

If you can follow above requirement, you are good to go. In this article, I use Ubuntu 18.04 running on VPS with public IP address, 4 cores processor, 2GB RAM and 600GB additional disk partition for Storj data.

Request authorization token

Sign up and request authorization token. Make sure you have received your personal single-use authorization token. It looks like this:

StorJ Auth Token

The entire string, including your email is your auth token.

Prepare the system

Make sure your system is up to date by running apt update and apt upgrade.

UDP config

UDP transfers on high-bandwidth connections can be limited by the size of UDP recieve buffer.

Storj sofware attemps to increase the UDP recieve buffer size. However, on Linux, an application is only allowed to increase the buffer size up to a max value set in the kernel, and the the default maximum value is too small for high bandwidth UDP transfers.

Its is recommended to increase the max buffer size by running the following command to increase it to 2.5MB.

1echo "net.core.rmem_max=2500000" >> /etc/sysctl.conf
2sysctl -w net.core.rmem_max=2500000

Generate node identity

Every node is required to have a unique identifier on the network.

You need to download StorJ identity binary to generate your node identity (as regular user, not as root):

1curl -L https://github.com/storj/storj/releases/latest/download/identity_linux_amd64.zip -o identity_linux_amd64.zip
2unzip -o identity_linux_amd64.zip
3chmod +x identity
4sudo mv identity /usr/local/bin/identity

Run command below to create an identity:

1identity create storagenode

This process can take several minutes or hours or days, depending on your machines processing power and luck.

This process will continue until it reaches a difficulty of at least 36. On completion, it will look something like this:

1Generated 5186393 keys; best difficulty so far: 36
2Found a key with difficulty 36!
3Unsigned identity is located in "/home/USERNAME/.local/share/storj/identity/storagenode"
4Please *move* CA key to secure storage - it is only needed for identity management and isn't needed to run a storage node!
5        /home/USERNAME/.local/share/storj/identity/storagenode/ca.key

Authorize the identity

Authorize your Storage Node identity using your single-use authorization token from “Request authorization token” section above. (replace the placeholder <email:characterstring> to your actual authorization token):

1identity authorize storagenode <email:characterstring>

When it’s done and success, you will get result similar like this:

12021/10/26 02:07:22 proto: duplicate proto type registered: node.SigningRequest
22021/10/26 02:07:22 proto: duplicate proto type registered: node.SigningResponse
3Identity successfully authorized using single use authorization token.
4Please back-up "/home/USERNAME/.local/share/storj/identity/storagenode" to a safe location.

To make sure the authorizing identity is successful, run these 2 following commands:

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

The first command should return 2, and the second command should return 3.

Move the identity to the subfolder in the storage location (optional)

In this example, I use /dev/sdb1 partition and mount it to /mnt/storj1 directory using /etc/fstab conffiguration file (don’t forget to change the /mnt/storj1 ownership to your regular user using chown command).

Create 2 folder named identity and data under /mnt/storj1 directory (we will use them latter).

1mkdir /mnt/storj1/{identity,data}

Then, copy your generated identity folder to /mnt/storj1/identity :

1cp -rfv ~/.local/share/storj/identity/storagenode /mnt/storj1/identity/

Install docker and download the Storage Node Docker Container

To setup a Storage Node, you first must have Docker installed. You can follow this official Ubuntu Docker Installation.

After docker is successfully installed and running, download the Storage Node Docker Container:

1docker pull storjlabs/storagenode:latest

Setting up the storage node

You must static mount your storage partition via /etc/fstab. Failure to do so will put you in high risk of failing audits and getting disqualified.

The setup step must be performed only once. If a node has already been set up, running with the SETUP flag will result in failure.

1docker run --rm -e SETUP="true" \
2    --mount type=bind,source="<identity-dir>",destination=/app/identity \
3    --mount type=bind,source="<storage-dir>",destination=/app/config \
4    --name storagenode storjlabs/storagenode:latest

Replace the <identity-dir> and <storage-dir> with your parameters.

In this article I use /mnt/storj1/identity/storagenode for <identity-dir> and /mnt/storj1/data for <storage-dir> (see section “Move the identity to the subfolder in the storage location” above).

After running the command above, your node has been set up.

Run the Storage Node

Run the command below (edit the WALLET, EMAIL, ADDRESS, STORAGE and replace the <identity-dir>, and <storage-dir> with your parameters)

 1docker run -d --restart unless-stopped --stop-timeout 300 \
 2    -p 28967:28967/tcp \
 3    -p 28967:28967/udp \
 4    -p 14002:14002 \
 5    -e WALLET="0xXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" \
 6    -e EMAIL="[email protected]" \
 7    -e ADDRESS="host.yourdomain.com:28967" \
 8    -e STORAGE="500GB" \
 9    --mount type=bind,source="<identity-dir>",destination=/app/identity \
10    --mount type=bind,source="<storage-dir>",destination=/app/config \
11    --name storagenode storjlabs/storagenode:latest

You’re officially a Storage Node operator! You can also check to see if the node was started properly by by running the following command in the terminal

1docker ps -a

Check the status of your node

You can check the status of your node, along with many other statistics by accessing web dashboard from browser: http://host.yourdomain.com:14002.

Or using command line:

1docker exec -it storagenode /app/dashboard.sh

Resources: