The Storj Developer Hub

Welcome to the Storj developer hub. You'll find comprehensive guides and documentation to help you start working with Storj as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    Discussions

Storj Share + PIA (VPN)

Can't connect to the network via TCP/UPnP directly?, try this guide.

Run Storj Share anonymously and safely anywhere in the world without the possibility of censorship from ISPs, governments or the necessity of router configuration

1. Introduction

Internet anonymity and freedom is something that is becoming less and less common in the current digital age, both corporations and governments are increasingly interested in monitoring and tracking the user’s activity on the World Wide Web, from mass surveillance programs to ISP blocking of certain types of network traffic or even blocking entire websites. There are many countries in the world that are blocking Storj Share from being able to connect to the network via all three connection mechanisms (TCP, UPnP and tunnel connections), more so, some ISP’s do not allow its clients to connect via both TCP and or UPnP. All of these issues prevent the Storj Share user from ever being able to run a successful Storj Share farm. ISP’s are continuously monitoring the client’s network activity, even if the farmer manages to successfully connect to the network, the ISP will know he or she is running Storj Share, which can lead to network throttling or even ISP warnings of unusual network activity. Although connecting via TCP is the most stable connection mechanism, configuring port forwarding in the router settings is a tedious task for a lot of people unfamiliar with port forwarding. In this guide we will set up a VPN called Private Internet Access (PIA) ™ and configure [Storj Share GUI] https://github.com/Storj/storjshare-gui/releases) to connect via TCP to the Storj Share network through PIA. In this guide we will do the following: (1) Set up a hostname with a service called NoIP to continuously keep track of the VPN's public IP address to prevent the node from going offline, (2) Private internet access will be downloaded and configured to be able to use port forwarding, (3) NetTime will be configured to constantly maintain our network clock synchronized with the rest of the network, (4) Storj Share will be configured to use both the NoIP hostname and the given TCP port by PIA, (5) The method will be explained on how to add as many nodes as required on a single PIA TCP port, (6) Different techniques will be used to test if the Storj Share node(s) with TCP configuration are working correctly.

2. Why use Private internet access

Private internet access is one of the safest and most popular VPN’s out there, it is easy to setup and offers a large number of advanced settings (e.g. the ability to request port forwarding), which will be
used in this guide. Although PIA is not free, it is also not very expensive, at $3.33/month for a yearly contract it is very affordable. For farmers not interested in internet privacy (e.g. private browsing) and who want to rent out only a few GBs of data, the cost of paying for a VPN will not be justified. However, farmers that value internet privacy or are unable to connect to the Storj Share network due to a variety of issues discussed in the introduction, and who plan to rent out more than 500 GB, can expect to pay for their VPN through their Storj Share earnings (the current payout to farmers is around $6/TB of used space). The other large advantage for Storj Share farmers is that PIA accepts payments in Bitcoin, which makes paying with the Storj earnings even easier, since this will only involve selling the tokens on an exchange for Bitcoin, which can then directly be used to pay the VPN invoice. The workflow covered in this guide can of course also be applied to other VPNs. Storj does not endorse any particular VPN service, every user is free to decide for themselves which VPN company they want to select.

2.1. The positives and negatives of using Private Internet Access in combination with Storj Share

2.1.1 Upsides

  1. Up to five machines can be connected with a single private internet access subscription at once, which means that five TCP connections can be configured on five machines, which allows the renting out of a total of 40 TB through the TCP protocol (8 TB/node * 5 connections).

  2. An unlimited number of UPnP connections can be established, which is the second most stable connection mechanism after TCP. This allows for example to add many UPnP configured nodes that run alongside the main TCP node.

  3. The TCP port assigned by PIA through which the node will connect to the network remains static as long as the connection is made to the same VPN gateway.

  4. There are 8x VPN gateways available that allow port forwarding.

2.1.2 Downsides

  1. The PIA public IP address changes continuously, which required the setup of a DDNS hostname to prevent the node from going offline.

  2. PIA is not free and depending on your Storj Share returns, it might or might not be economically viable.

  3. PIA slows down the internet connection by about 30-60% in most cases (highly variable through the day).

3. Storj Share GUI download, installation and initial configuration

In this step, we will download and install Storj Share. If you have already done so, please skip this step.

Windows architecture check

To check the architecture of your computer, open the control panel and type in “system”: (Control Panel\System and Security\System). This will open up a window that show the architecture of your system (Figure 4.1). The system architecture in this guide is 64-bit (x64), indicating that the 64-bit version of Storj Share GUI should be downloaded (Figure 2.1).

Figure 3.1. System architecture check.

Figure 3.1. System architecture check.

Linux, Ubuntu and Mac architecture check

In Linux. Ubuntu or Mac open a terminal and type in the following command:

  • uname -a

This command should return a text similar to the following:

  • Linux behrooz 2.6.32-5-amd64 #1 SMP Tue Apr 4 12:24:40 UTC 2017 \*x86_64** GNU/Linux*

This indicates that the user has an amd64 (64-bit) architecture system. If it prints out amd86 instead, the system has a 32-bit architecture.

3.1. Storj Share download

We can now download Storj Share from the Storj website, however, if you are downloading through google-chrome on a windows machine it will always download the 32-bit version, even if you are running on a 64-bit machine. For this reason it is best to download the latest version of Storj Share directly from the Github repository instead at, as shown in Figure 3.2.

Figure 3.2. Github Storj Share GUI download page.

Figure 3.2. Github Storj Share GUI download page.

Now head over to the most recent release (highest number) and select the correct executable from the download page. In the case of the system used in this example, the 64-bit windows version should be downloaded: “storjshare-gui.win64.exe”. Please note that the installation version
will change through time, so always download the latest release version when it is announced. After the download is completed, open the download folder and double click on the executable. When the installation window appears, select the "Add windows Firewall Rule" and then click on “Install”, the installation should now start (Figure 3.3).

Figure 3.3. Storj Share GUI installation.

Figure 3.3. Storj Share GUI installation.

After clicking on “Close” the Storj Share app should open and display
the following prompt window on the screen (Figure 3.4).

Figure 3.4. Terms of service.

Figure 3.4. Terms of service.

Please carefully read the Terms of Service and then click on “I Accept”.

Figure 3.5. Storj Share GUI Setup screen.

Figure 3.5. Storj Share GUI Setup screen.

3.2. NTP synchronization

3.2.1. NTP Synchronization for Windows

Storj Share has to be time-synchronized with the rest of the nodes in the Storj network in order to correctly take part in the network. Unfortunately not all hardware devices, and especially Windows machines keep their clocks synchronized correctly, which can be a serious problem for Storj Share. In this next step we will install a NTP synchronization tool for both Windows and Linux based systems.

If the synchronization is off by more than 500 milliseconds, Storj Share will start to fail as it does not keep the same time as all the other nodes on the network. As most messages have a timestamp, it is essential to have a good synchronization for optimal performance. We will use a simple tool called NetTime which can be downloaded here.

  • We will download and install the latest stable version (Figure 3.6).
Figure 3.6. NetTime download page.

Figure 3.6. NetTime download page.

  • Once downloaded, open the download directory and double click on the executable to initiate the installation.

  • Once the installation window appears, click on “Next” on all the following installation windows (Figure 3.7).

Figure 3.7. NetTime installation.

Figure 3.7. NetTime installation.

  • Finally, click on “Finish”.

To open the program, open the system tray and double click on the
NetTime icon (Figure 3.8). This will open the main NetTime program.

Figure 3.8. NetTime tray icon.

Figure 3.8. NetTime tray icon.

  • Now click on “Setting” which will bring up the settings menu.

  • Next head over to www.pool.ntp.org and select the region you live in, for example Europe (http://www.pool.ntp.org/zone/europe).

  • Scroll down to the country you live in and click on it. This should open up a page with various time servers (e.g. Server 3.pt.pool.ntp.org), we only need to copy the last part of the string after “Server“(e.g. 3.pt.pool.ntp.org), as shown in Figure 3.9.

Figure 3.9. Time servers for a specific country (Portugal In this example).

Figure 3.9. Time servers for a specific country (Portugal In this example).

  • Now paste the chosen server name into the first “Time servers” field in the NetTime Options (Figure 3.10).

  • Set the “update interval” to 15 minutes, leave all the other fields as default values, and click on “OK” (Figure 3.10).

Tip: The default setting "If time adjustment is greater than 2 min ..." is not always good enough (if 'Offset + Lag' deviates more than 500 ms), one can change that value to a few seconds-milliseconds if time sync is not successful with the steps above.

Figure 3.10. NetTime settings with new parameters.

Figure 3.10. NetTime settings with new parameters.

  • Finally, click on “Update Now” to synchronize NetTime with your own specified time server which should lower the “Offset” and “lag” parameters (Figure 3.11).
Figure 3.11. NetTime after successful configuration, **the closer to zero the offset and lag parameters are, the better.**

Figure 3.11. NetTime after successful configuration, the closer to zero the offset and lag parameters are, the better.

3.2.2. NTP synchronization for Linux based systems

Open up a terminal and type in the following commands:

  • sudo apt-get install ntp

  • sudo service ntp stop

  • sudo ntpdate -s time.nist.gov

  • sudo service ntp start

  • timedatectl status

  • timedatectl list-timezones

  • sudo timedatectl set-timezone <your timezone>

    (e.g. sudo timedatectl set-timezone CET)

Alternatively

Edit the ntp config file: vi /etc/ntp.conf

You’ll find a lot of lines in that file, but the important ones are the server lines. You can get a list of server addresses at www.pool.ntp.org, find the preferred ones for your area, and then add them to the file. For example if you are in the US:

  • server 0.north-america.pool.ntp.org

  • server 1.north-america.pool.ntp.org

  • server 2.north-america.pool.ntp.org

  • server 3.north-america.pool.ntp.org

Then you’ll need to restart or start the NTPD service:

  • /etc/init.d/ntpd restart

(You could also use nano instead of vi for editing)

3.3. Basic GUI configuration

Note: you can add 1x node per 1x CPU core, so 4 CPU cores = max of 4 nodes.

Note: You can configure a new node using the PIA TCP port only on a new machine.

Tip: As you can only add 1x node via TCP per machine, try allocating the node with the most amount of free space to this TCP port.

The following steps are common for everyone wanting to use the GUI, which includes adding a STORJ ERC20 address where to receive the payout, configure the location and size of the storage space one wants to allocate to Storj.

Please return to the Storjshare GUI Setup Screen (Figure 3.5). Once you click on the green “Start Setup” button, Step one of the configuration should appear (Figure 3.12).

3.3.1. Wallet address

In this step, you have to enter a valid Counterparty-compatible payout address where your Storj tokens will be sent to at every monthly payout.

Figure 3.12. Step one, enter a valid STORJ address and click “Next”.

Figure 3.12. Step one, enter a valid STORJ address and click “Next”.

The following step will let you create a valid STORJ token address if you do not already have one. If you already have a compatible STORJ payout address, or an address made with another ERC20 compatible wallet such as Parity or Mist, you go straight below.

First we will add a STORJ ERC20 payout address. STORJ is the name of the token which is used to pay the farmers for renting out their storage space. STORJ has a monetary value and divisibility which makes it suitable as a means of payment. To create a new payout address click on
the “MyEtherWallet” link in figure 3.12 above.
On the MyEtherWallet, enter a password of your liking into the "Enter a password" field and then click on "Create New Wallet", figure 3.13.

Figure 3.13. Creating a payout address with MyEtherWallet.*

Figure 3.13. Creating a payout address with MyEtherWallet.*

Now Download the Keystore File and save it to a safe location (e.g. a USB flash drive) and be sure to make multiple backups of your passphrase and Keystore file in different locations to assure that you will not accidentally lose it.. Also do not forget to write down the password for the Keystore file you entered in the previous step. Next click on “I understand. Continue.".

Figure 3.14. *Download the Keystore file.*

Figure 3.14. Download the Keystore file.

Now save the private key to a safe location as you did with the password and print the paper wallet. Saving the private key and printing the paper wallet are not mandatory but highly advisable for maximum security. Be sure to keep these keys offline as much as possible. Once done click on " Next: Save your Address", figure

Figure 3.15. *Save the private key and print the Paper wallet for maximum security.*

Figure 3.15. Save the private key and print the Paper wallet for maximum security.

Now copy and paste the address into the ‘Payout Address’ box in the Storj Share GUI and click “Next” (Figure 3.12).

Please Note:

Do NOT use an exchange wallet address, as Storj Share will not be able to properly display your balance in the GUI. Also, farmer reputation will eventually take into account the amount of STORJ funds stored on the payout address linked to your node to determine which node to award a contract to, which makes it important to send the STORJ tokens to a valid address recognized by Storj and of which you control the private key yourself. If an exchange address is added, the farmer will never build his/her reputation on the wallet balance front.

3.3.2. Storage Location

  • The next step is very straightforward, just point Storj Share to the directory in which you want to store the data that will be downloaded by Storj Share by clicking on “Choose files” and then browsing to the storage container of your choice. It is advisable to first create a folder with the name of the node in the root of the Storage container. When the correct path is selected click on “Select Location” (Figure 3.16).
Figure 3.16. Select the location to store the files that are downloaded by Storj Share.

Figure 3.16. Select the location to store the files that are downloaded by Storj Share.

3.3.3. Storage Size

Next you have to select how much space you want to rent out to the network. In the drop-down menu, select the storage size units (e.g. GB or TB), then input the storage amount you want to allocate and click “Next” (Figure 3.17).

Figure 3.17. Enter the amount of storage space you want to rent out to the network with the respective units in the drop-down menu, when done click on “Next”.

Figure 3.17. Enter the amount of storage space you want to rent out to the network with the respective units in the drop-down menu, when done click on “Next”.

4. DDNS hostname configuration

When registered with a VPN gateway, your public IP address will change to the address of the gateway. This is done for security and privacy reasons by Private Internet Access (PIA) or whatever VPN service you choose, so you don’t give away your location. Although we can configure PIA to stay online for long periods of time, the IP address can and will change regularly. The consequence of this would be that when the IP address changes, Storj Share would lose connection to the etwork.
Adding a DDNS hostname solves the issue of public IP change. We will add a free DDNS hostname using NoIP (http://www.noip.com/) which needs to be renewed for free every 30 days on a free account. On the NoIP website scroll down to where it say ‘Create Your Free Hostname now’, then do the following (Figure 4.1):

  1. In the hostname input field select a hostname of your linking (e.g.myhomestorjfarm), it can contain letters and numbers.

  2. Next select ‘.ddns.net’ in the box to the right.

  3. Click on ‘Sign Up

Figure 4.1. Adding our own DDNS hostname.

Figure 4.1. Adding our own DDNS hostname.

  1. On the sign-up page enter your email, username and password. Make sure to write these details down, we will need them later.
Figure 4.2. NoIP registration page.

Figure 4.2. NoIP registration page.

  1. When done, click on ‘Create My Free Account’. NoIP will now send us a confirmation email with an activation link to our email address. Once we click on the activation link it should take us to the NoIP website and confirm that our account is now active.

  2. Now scroll down to where it says ‘How to remote access your device’ and click on ‘get started with dynamic DNS’ (Figure 4.3).

Figure 4.3. The activation page: click on the large blue box to go to the DDNS hostname setup page.

Figure 4.3. The activation page: click on the large blue box to go to the DDNS hostname setup page.

  1. Clicking on the link should take us to our NoIP dashboard.

  2. Now scroll down to ‘Dynamic Update Client for Windows’ (DUC) and click on ‘Download’ (Figure 4.4). This should take us to the download page where we can download the DUC tool. On the download page click on ‘Download Now’.

Figure 4.4. Dynamic Update Client download

Figure 4.4. Dynamic Update Client download

  1. After the file downloaded successfully head over to the download folder and double click on the ‘DUCSetup’ executable.

  2. On the resulting installation window, click on ‘Agree’ -> ‘Install’ -> ‘Finish’.

Figure 4.5. DUC installation.

Figure 4.5. DUC installation.

  1. The Dynamic Update Client should now open. Enter the details from step (4) above and click on ‘Sign in’ (Figure 4.6).
Figure 4.6. Dynamic Update Client.

Figure 4.6. Dynamic Update Client.

  1. Once logged in successfully, the "Edit groups/Hosts" menu should be displayed (Figure 4.7). If not already selected, choose the hostname box and click on "save".
Figure 4.7. From the Edit groups/Hosts menu, select the hostname and click on save.

Figure 4.7. From the Edit groups/Hosts menu, select the hostname and click on save.

  1. The DUC tool will now come to life (Figure 4.8). Next head over to "File" -> "Preferences" and select "Start this application automatically when the user logs on". In case your computer reboots, DUC will automatically start in the background. This is very handy because if Storj Share starts automatically, it will not run into a closed port as DUC is also already running.
Figure 4.8. DUC once configured correctly.

Figure 4.8. DUC once configured correctly.

Note: Some routers can also act as a DUC, in that case you can use the router directly instead of having to install the No-IP DUC. Search the router menus for "hostname" or "DDNS".

Congratulations! You now have a hostname and a dynamic update tool that automatically tracks and assigns the IP address to your DDNS hostname. So if your public IP changes, Storj Share will not lose access to the TCP port. In the next section, we will look at downloading and setting up the private internet access VPN program.

5. Private internet access download and configuration

In this step we will download and configure PIA so that it can be used with Storj Share. First we head over to the registration page, this page gives us three payment plan options. If you just want to test out PIA and Storj Share, it is advisable to take the ‘One month only’ plan. On the other hand, if you are serious about running Storj Share and plan to rent out a lot of storage space, the yearly plan at 3.33$/month is much cheaper (Figure 5.1)

Redeem a free licence (limited offer)

There are currently a limited number of free licences that can be acquired via Storj Labs, please join our community at https://storj.io/community.html and contact one of the moderators. Please specify on how many machines you are going to run PIA.

Figure 5.1. Private internet access plans and pricing.

Figure 5.1. Private internet access plans and pricing.

Next we select the plan that is best for us and click on “Sign Up now”. This should open the payment method window (Figure 5.2).

Figure 5.2. Payment methods.

Figure 5.2. Payment methods.

Now click on our preferred payment method and proceed to the registration process. Once paid, Private Internet Access will send a few confirmation emails containing the details of our account and the information we will need to login to the app (Figure 5.3). The email containing the login information is called “Private Internet Access Account Activated”.

Figure 5.3. Access Account Activation email containing the PIA app username and password.

Figure 5.3. Access Account Activation email containing the PIA app username and password.

Now download the PIA app here, after the app has downloaded successfully open the download folder and double click on the PIA installer. This will open up a terminal that automatically installs the app and necessary drivers. If a driver window pops up, click on "install". When the installation is completed, the terminal window should close automatically and the main PIA app window should now be displayed.

  • Now add the username and password that was sent to you in the activation email.

  • Next select "Start application at login" and hit "save" (Figure 5.4).

Figure 5.4. PIA application with the entered username and password provided to us via email.

Figure 5.4. PIA application with the entered username and password provided to us via email.

We now have to connect to a gateway that allows for configuring port forwarding. The following gateways support port forwarding:

  • CA Toronto

  • CA Montreal

  • Netherlands

  • Switzerland

  • Sweden

  • France

  • Germany

  • Romania

  • Israel

Note: Based on your geographical location it is best to select the gateway closest to your location to lower the ping times.

In order to add a gateway we head over to the PIA app, which is normally hidden in the system tray (right side of the taskbar) -> right click on it -> click on “settings” (Figure 5.5).

Note: we can also launch the app by doing a windows app search for ‘PIA’, which allows us to pin the app to the taskbar, making it easier to access in the future.

Figure 5.5. How to enter the PIA settings through the system tray icon.

Figure 5.5. How to enter the PIA settings through the system tray icon.

  • Once the app opens again we click on ‘Advanced’

  • In the advanced window we change the connection type from ‘udp’
    to ‘TCP’

  • Next we check the ‘Request port forwarding’ box and change the region to the closest gateway that supports port forwarding, in my case the Netherlands. We can now press ‘save’ (Figure 5.6).

Figure 5.6. PIA advanced settings configuration.

Figure 5.6. PIA advanced settings configuration.

  • Now right click on the system tray icon again (Figure 5.5) and click on “Connect". PIA should now initiate the connection to the network. If all goes well the PIA icon should turn green.

  • Now hover over the green icon with the mouse, the IP address and port number should appear, note however that it can be delayed a bit so sometimes it does not appear right away as PIA first has to request a port from the gateway which can take some time (Figure 5.7).

Figure 5.7. When hovering over the PIA tray icon our new IP and port is shown. We will use the port number of PIA in storj Share.

Figure 5.7. When hovering over the PIA tray icon our new IP and port is shown. We will use the port number of PIA in storj Share.

  • Write down the port number as it will be used in the last part of setting up the Storj Share GUI.

6. Storj Share GUI configuration with DDNS and PIA port

We will now configure the Storj Share GUI and add our NoIP hostname and the TCP port given to us by PIA.

  • Enter the port number given by PIA into the “Port Number” field (Figure 6.1).
  • Select the box that says "Reachable".
  • Click on “Next”.
Figure 6.1. Connection Settings step: enter the forwarded port, select "Reachable" and then click on “Next”.

Figure 6.1. Connection Settings step: enter the forwarded port, select "Reachable" and then click on “Next”.

Now in step five enter your hostname into the field and click "Next".

Figure 6.2. Enter your hostname into the field and click "Next".

Figure 6.2. Enter your hostname into the field and click "Next".

Now click on “Finish”, the Storj Share dashboard will open automatically (Figures 6.3 and 6.4).

Figure 6.3. Success message after successfully configuring your Storj Share drive/node.

Figure 6.3. Success message after successfully configuring your Storj Share drive/node.

That's it! The node should now start and connect to the Storj network through PIA via TCP. :clap+:

Note: Please backup the configuration file for each node. You could also copy the entire directory called "configs" instead, since all the configuration files are contained within that directory. Backup the files to a safe location so in case your system crashes, you still will be able to recover the shards stored on each Storj drive.

The node will no start automatically and you should see the following:

  1. The node status goes to “ON”.
  2. The number of peers increases to 100-200.
  3. The number of restarts remains at zero.
  4. The port displays the correct port number with the TCP flag.
  5. The ALLOCs count starts increasing.
  6. Delta value (time sync drift) stays within 500 ms in either direction (positive or negative) from complete sync (zero).
  7. In "Bridges" it should display "connected".

Note: Storj Share will attempt to test if the TCP port is open, however, some systems do not allow Storj Share to contact itself from within the same network.

  • TCP port text color is black: Unable to test if the port is open.
  • TCP port text color is green: Storj Share was able to test the port, port is open.

In the case the port text is black and thus Storj Share was unable to test if the port is open, there are a few things one can do to check if the port is open, namely use a external port checking website like YougetSignal or monitor if the number of ALLOCs goes up.

Note: If you see any of the following issues, a node configuration or port forwarding issue might be present:

  • The number of peers stays at zero or does not increase.
  • The node is constantly restarting or the node refuses to start.
  • The ALLOCs counter stays at zero even after long periods of time.

These issues normally occur due to incorrect configuration or if the rpcPort is not open. If you have any of these issues please join our community at Storj community
where we will help you to solve the problem.

6.1 Optional - How to manually edit the configuration parameters

Although the automatic wizard is handy, if one later has the necessity to edit some configuration parameters, this will have to be done manually.

  • First stop the node by clicking on the gear next to the specific drive and click on “Stop”.

  • Next click on the gear again and select “Edit” (Figure 6.4).

Figure 6.4. Click on the Gear next to the drive and select 'Edit' to enter the config file.

Figure 6.4. Click on the Gear next to the drive and select 'Edit' to enter the config file.

A text editor should now open the configuration file which saves all the settings and parameters for one particular node.

Note: the file name represents the node-ID of that specific node.

For windows users it is advisable to download and install notepad ++, which formats the JSON text in a neat way, you have to configure windows to always open a text/JSON file with Notepad++. Only then when you click on “Edit” will it open the config file with Notepad++.

Default configuration file containing the settings for one specific node;

{
  // Set the STORJ/ERC20 address for receiving contract payments
  "paymentAddress": "0x4646fBd7323521929DC06b3Aff9DEb338a966ade",
  // Subscribes to the given contract topics
  // See https://storj.github.io/core/tutorial-contract-topics.html
  "opcodeSubscriptions": [
    "0f01020202",
    "0f02020202",
    "0f03020202"
  ],
  // An array of bridges to connect and accept contracts,
  // send exchange reports and discover network seeds.
  "bridges": [
    {
      "url": "https://api.storj.io",
      "extendedKey": "xpub6AHweYHAxk1EhJSBctQD1nLWPog6Sy2eTpKQLExR1hfzTyyZQWvU4EYNXv1NJN7GpLYXnDLt4PzN874g6zSjAQdFCHZN7U7nbYKYVDUzD42"
    }
  ],
  // Known preferred seeds in form of a storj URI
  // Example: "storj://[ip.or.hostname]:[port]/[nodeid]"
  "seedList": [],
  // Interface to bind RPC server, use 0.0.0.0 for all interfaces or if you
  // have a public address, use that, else leave 127.0.0.1 and Storj Share
  // will try to determine your address
  "rpcAddress": "127.0.0.1",
  // Port to bind for RPC server, make sure this is forwarded if behind a
  // NAT or firewall - otherwise Storj Share will try to punch out
  "rpcPort": 4000,
  // Enables NAT traversal strategies, first UPnP, then reverse HTTP tunnel
  // if that fails. Disable if you are public or using dynamic DNS
  "doNotTraverseNat": false,
  // Maximum number of tunnels to provide to the network
  // Tunnels help nodes with restrictive network configurations participate
  "maxTunnels": 0,
  // Maximum number of concurrent connections to allow
  "maxConnections": 150,
  // If providing tunnels, the starting and ending port range to open for
  // them
  "tunnelGatewayRange": {
    "min": 0,
    "max": 0
  },
  // Number of times to retry joining the network and the wait time between
  "joinRetry": {
    "times": 3,
    "interval": 5000
  },
  // Temporarily stop sending OFFER messages if more than this number of shard
  // transfers are active
  "offerBackoffLimit": 4,
  // ECDSA private key for your network identity, your Node ID is derived from
  // this and it is used to sign and verify messages
  "networkPrivateKey": "b9cd6834fc097ef00c3a3ddf46928cf10f60f7de8c4365d737041b03b932f532",
  // Determines how much detail is shown in the log:
  // 4 - DEBUG | 3 - INFO | 2 - WARN | 1 - ERROR | 0 - SILENT
  "loggerVerbosity": 3,
  // Path to write the log file to disk, leave empty to default to:
  // $HOME/.config/storjshare/logs/[nodeid].log
  "loggerOutputFile": "C:\\Users\\user\\.config\\storjshare\\logs",
  // Directory path to store contracts and shards
  "storagePath": "C:\\Users\\storj",
  // Amount of space to lease to the network, as human readable string
  // Valid units are B, KB, MB, GB, TB
  "storageAllocation": "7TB"
}

You can see that the “rpcPort” is correct, however, the following parameters are incorrect:

  1. rpcAddress -> should be your DDNS hostname.

  2. DoNotTraverseNat -> should be set to “true”.

  3. min -> start tunnel port number, should be 0.

  4. max -> end tunnel port number, should be 0.

  5. maxtunnels -> should be 0.

Now replace the fields mentioned above with your own parameters (Figure 6.6).

Note: The Storage space allocation in the config file is by default set to bytes when you add a new node within Storj Share. You can change it to whatever size you want, e.g.:

  • "storageAllocation": "1TB",

Warning: (1) Don’t forget the quotes around the size, (2) Don’t forget the comma after the last quote, (3) for size use MB, GB or TB.

Node configuration file after editing all the fields to the correct values;

{
  // Set the STORJ/ERC20 address for receiving contract payments
  "paymentAddress": "0x4646fBd7323521929DC06b3Aff9DEb338a966ade",
  // Subscribes to the given contract topics
  // See https://storj.github.io/core/tutorial-contract-topics.html
  "opcodeSubscriptions": [
    "0f01020202",
    "0f02020202",
    "0f03020202"
  ],
  // An array of bridges to connect and accept contracts,
  // send exchange reports and discover network seeds.
  "bridges": [
    {
      "url": "https://api.storj.io",
      "extendedKey": "xpub6AHweYHAxk1EhJSBctQD1nLWPog6Sy2eTpKQLExR1hfzTyyZQWvU4EYNXv1NJN7GpLYXnDLt4PzN874g6zSjAQdFCHZN7U7nbYKYVDUzD42"
    }
  ],
  // Known preferred seeds in form of a storj URI
  // Example: "storj://[ip.or.hostname]:[port]/[nodeid]"
  "seedList": [],
  // Interface to bind RPC server, use 0.0.0.0 for all interfaces or if you
  // have a public address, use that, else leave 127.0.0.1 and Storj Share
  // will try to determine your address
  "rpcAddress": "myhomestorjfarm.ddns.net",
  // Port to bind for RPC server, make sure this is forwarded if behind a
  // NAT or firewall - otherwise Storj Share will try to punch out
  "rpcPort": 59538,
  // Enables NAT traversal strategies, first UPnP, then reverse HTTP tunnel
  // if that fails. Disable if you are public or using dynamic DNS
  "doNotTraverseNat": true,
  // Maximum number of tunnels to provide to the network
  // Tunnels help nodes with restrictive network configurations participate
  "maxTunnels": 0,
  // Maximum number of concurrent connections to allow
  "maxConnections": 150,
  // If providing tunnels, the starting and ending port range to open for
  // them
  "tunnelGatewayRange": {
    "min": 0,
    "max": 0
  },
  // Number of times to retry joining the network and the wait time between
  "joinRetry": {
    "times": 3,
    "interval": 5000
  },
  // Temporarily stop sending OFFER messages if more than this number of shard
  // transfers are active
  "offerBackoffLimit": 4,
  // ECDSA private key for your network identity, your Node ID is derived from
  // this and it is used to sign and verify messages
  "networkPrivateKey": "b9cd6834fc097ef00c3a3ddf46928cf10f60f7de8c4365d737041b03b932f532",
  // Determines how much detail is shown in the log:
  // 4 - DEBUG | 3 - INFO | 2 - WARN | 1 - ERROR | 0 - SILENT
  "loggerVerbosity": 3,
  // Path to write the log file to disk, leave empty to default to:
  // $HOME/.config/storjshare/logs/[nodeid].log
  "loggerOutputFile": "C:\\Users\\USER\\.config\\storjshare\\logs",
  // Directory path to store contracts and shards
  "storagePath": "C:\\Users\\Storj\\",
  // Amount of space to lease to the network, as human readable string
  // Valid units are B, KB, MB, GB, TB
  "storageAllocation": "7TB"
}

Note: Please backup the configuration file for each node. You could also copy the entire directory called "configs" instead, since all the configuration files are contained within that directory. Backup the files to a safe location so in case your system crashes, you still will be able to recover the shards stored on each Storj drive.

7. How to run multiple nodes via TCP with PIA

Kudos go out to Felix Brucker for helping with this chapter.

Although PIA only allows us to connect to open one remote port, its is possible to use nginx reverse proxy which listens on the PIA port and proxies to the specific node and local port based on the hostname. This process involves a few steps but is quite simple. Please note that if one goes this route and already has a working node with TCP port forwarding, the node has to be tweaked as explain below.

These are the things that are required:

  • One hostname per node, thus if one wants to add four nodes, four different hostnames have to be created.
  • nginx, which can be downloaded here, download the nginx/Windows-1.13.4 version. Documentation can be found here.
  • PIA has to be running with port forwarding setup.
  • The latest version of Storj share (GUI or CLI).

7.1. nginx reverse proxy download and setup

  • After downloading nginx/Windows-1.13.4, extract the folder and place it in a safe location on your machine.
  • Now head over to \nginx-1.13.4\conf and open nginx.conf with a text editor like notepad++ on windows or nano on Linux.

Next remove everything in the file and paste the following:

#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;
	
	client_max_body_size 1g;
	client_body_timeout 30m;
	proxy_read_timeout 5m;
	proxy_send_timeout 5m;
	proxy_buffering on;
	proxy_buffer_size 8k;
	proxy_buffers 2048 8k;
	proxy_ignore_client_abort on;


    server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   html;
            index  index.html index.htm;
        }
	}

########################## Node 1 ##############################		
	server {
        listen 28323; #PIA port

        server_name storj2pia.ddns.net;

        location / {
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_pass http://127.0.0.1:10001;
        }
	}
######################### Node 2 ###############################
	server {
        listen 28323; #PIA port

        server_name storj2pia2.ddns.net;

        location / {
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_pass http://127.0.0.1:10002;
        }
	}
##############################################################	
      
}

Note: For Linux systems replace listen <port>; with listen [::]:<port>;

Now lets analize the config file and see what we have to change;

  1. The first parameter that we can change is client_max_body_size 1g;, what this parameter essentially does is limit the size of the shard that can be transferred, although most shards are less that 1GB, some are larger, thus this parameter can be tweaked.
  2. In the example above we see that there are two nodes in the config file, which means that Storj Share GUI contains two nodes, if one wants to add more nodes, more of these server blocks have to be added.
  3. listen <port>; or listen [::]:<port>;, in this example listen 28323;, 28323 is the PIA TCP port, which will be different for every user, however the same across all nodes on the local machine. To find the port hover over the PIA tray icon or this for linux or this.
  4. In server_name enter a unique hostname for each node, e.g. server_name node1.ddns.net; for node 1, server_name node2.ddns.net; for node 2.
  5. The next important parameter is proxy_pass http://127.0.0.1:<ListenPort>;, each node should have a different ListenPort, in this example proxy_pass http://127.0.0.1:10001; for node 1, proxy_pass http://127.0.0.1:10002; for node 2.

When done editing save the file.

The important things to keep organized are the hostnames and ListenPort pairs for each node, confusing these will lead to big problems.

7.2 Adjust the config file for each node

Now open the config file for each node by clicking on the gear next to each node -> edit, or go directly to the config file folder inC:\Users\USER\.config\storjshare\configs.

Next add the ListenPort parameter and respective port to each config file;

Node 1:

"rpcAddress": "node1.ddns.net",
 "rpcPort": <PIA port>,
 "listenPort": 10001,
 "doNotTraverseNat": true,

Node 2:

"rpcAddress": "node2.ddns.net",
  "rpcPort": <PIA port>,
  "listenPort": 10002,
  "doNotTraverseNat": true,

Here we see that each node should contain a ListenPort parameter that is linked to the ListenPort in the nginx.conf configuration file. It should also be noted that the config files of all nodes have the same PIA TCP port in rpcPort and each node has a different hostname in rpcAddress.

7.3 Start the nginx server

  1. We now navigate back to the nginx root directory (\nginx-1.13.4), where we will see the nginx executable.
  2. Hold down shift and right click -> "Open command window here".
  3. execute nginx -t, this should return the following if the syntax of the config file is correct:
C:\nginx-1.13.4>nginx -t
nginx: the configuration file C:\nginx-1.13.4/conf/nginx.conf syntax is ok
nginx: configuration file C:\nginx-1.13.4/conf/nginx.conf test is successful

C:\nginx-1.13.4>
  1. Now execute start nginx, no errors should be returned, to check for any errors please goto \nginx-1.13.4\logs and open the error file, seek for help on our community if any critical error is present in that file.
  2. The server is now running, one can execute tasklist /fi "imagename eq nginx.exe" as explained in the documentation here to see if the process is running.
  3. One can also check if the process is running correctly by executing netstat -aon.

7.4 Start Storj Share

This is the moment of truth, after adding a unique listen port to each config file which is pointed at each server block in the nginx config file, its is time to Start Storj.

After starting all nodes there should be no restarts from any nodes, that indicates that the server is working correctly, if nodes start to restart there is a problem and most likely the nginx server is either not running or not working correctly (e.g. config file issue).

We can also check if the nodes are running correctly by pasting hostname : PIA port into a web-browser on a network with a different public IP, this should return a get status for the node, which indicates that it is working.The connection status of the node will also be displayed in the access file in the logs directory of nginx.

8. Testing if everything is working correctly

Now that everything is set up correctly, we have to test the
following:

  • Can our node`(s) connect to the network and talk to it, and can the network see our node.

  • Is the PIA port open for our hostname(s).

Automatic log checker


We can check our log automatically by doing the following:

  1. Stop all nodes and exit storj Share
  2. Open the log folder containing the Storj logs and delete all logs.
  3. Start Storj Share and wait for all nodes to start
  4. Upload each log file one by one here.
  5. Once you click on “Process” it will check the logs for connectivity and other parameters.

Manual log checking


The easiest way to manually check if everything is working correctly is to use an online port checker to check if our PIA port is open.

  • First we go to yougetsignal in our browser.

  • We then enter our DDNS hostname (“myhomestorjfarm.ddns.net” in this example) in the “Remote Address” field.

  • Next we enter the PIA port number (“59538” in this example) in the “Port Number” field.

  • We then click on “Check”.

A green flag should now appear indicating that the PIA port is open for our hostname, indicating that Storj Share is successfully connected to the network (Figure 8.1).

Figure 8.1. When all is working correctly the PIA port should be open for our DDNS

Figure 8.1. When all is working correctly the PIA port should be open for our DDNS

8.1. If the port is closed

If the flag indicator is red, it means there is a connection problem. This can occur sometimes at startup when the IP address is suddenly updated but the Dynamic Update Client (DUC) does not recognize the IP change yet as it only updates the IP address every 5 minutes (this can be lowered with a paid NoIP account). This indicates that Storj Share is connected to the old IP address through the hostname. The way to solve goes as follows:

  1. Click on the gear next to the specific node in Storj Share and then click the “Stop” button to stop the node.

  2. Click on “refresh now” in the DUC app.

  3. Right after refreshing DUC click on the gear again and then “start”, this should start Storj Share with the correct IP address assigned to our hostname.

  4. Now repeat the Yougetsignal check, the port should now be open, indicated by a green flag. If you are on windows and the port is still closed have a look at chapter 5.1. Storj Share GUI 5.x.x on how to allow the PIA port through the windows firewall.

  5. If the port is still closed, let it run for 30 minutes and try the port scan again.

  6. If it still doesn´t show the port is open, restart PIA and Storj Share and try again until it works, sometimes it takes a bit of trial and error to get it working the first time.

Note: A antivirus program can prevent Storj from connecting through the PIA port.

For more troubleshooting information please consult the regular
Storjshare guide Storj Share GUI 5.x.x.

8.2. Adding more UPnP nodes

One can add more UPnP nodes that don't require port forwarding, click on “+ Add drive” icon in the top right corner of the GUI, then enter the payout address and storage location. Once at the port step set it to random or leave it at default and do not select the "Reachable" box. Now leave the config file at default also right from the get-go and start the node, it should now connect via UPnP (DoNotTraverseNat = false). Once the node starts it should illustrate the port number and the protocol flag in the "Port" field and the text should be green.

9. Conclusion

Following the steps laid out in this Tutorial, we have successfully configured PIA, NoIP and Storj Share, resulting in two fully functioning nodes, both connected via TCP through the same port. Our Storj Share nodes now have two encryption layers, the first one offered natively by Storj Share and the second one by PIA which encrypts all our internet data. We are also able to do normal internet tasks as the VPN encrypts all data coming from our computer and not just that of Storj Share, circumventing internet censorship and defeating government spying programs, basically making the internet function as it was intended to be.

If you have any more questions or comments, feel free to join us on our Rocketchat community or ask a question via our support channels.

Happy farming!