Guide: Storage Provider Quick Start: Linux

Thank you to Ian from the ScPrime community for his assistance with this document. Please note that Ubuntu 20.04 is the platform used for the examples in this guide. This guide also assumes you know your way around Linux, can install Ubuntu, write some shell script etc, port-forward on your router and sign up for a dynamic or free DNS service.

Initial Steps

Ian used an old ProLiant mini server with 4TB that was gathering dust. This server is only a 2 core processor with 8GB of memory and normally boots off an internal USB and can take 4x 3.5” disks and an additional internal SATA device — in this case he added an SSD to run Ubuntu. Once Ubuntu was installed, the disks were organized as shown above. Note the useful mount labels given which can be referenced later when adding storage with the spc command.

In regards to the mounts, /mnt/scprime is the internal USB. Ian decided to use a separate disk to store all of the SCPrime blockchain data, seed, wallet address and SCP specific scripts. The other disks are 4 x 3.5” storage disks which are going to be the drives rented out to the network.

Ian then downloaded the Linux zip of the ScPrime Command Line and unpacked it in an ScPrime directory and used the old trick of a [current] soft link so everything refers to ~/scprime/current. What this means is that he can download the next version along side and just swap the link to upgrade.

Now it’s time to add a script to start the daemon (spd)

#/usr/bin/env bash

SCPRIME=$HOME/scprime/current

SPD_DATA=/mnt/scprime/data

SPD_PROFILE=/mnt/scprime/profiles

cd /mnt/scprime

nohup $SCPRIME/spd — profile-directory $SPD_PROFILE — scprime-directory $SPD_DATA &

Put this into a file to start up the ScPrime daemon in the background and log any messages to nohup.out.

Now type spc. This will give a simple status of the daemon. It will take a while to sync.

Once fully synced you are ready for the next steps.

Wallet Initialization and Setup

Now you have to initialize a wallet. Type spc wallet init. This will create a new wallet and output the seed to the screen.

This needs to be written down, backed up and kept safe, if lost any SCP deposited in this wallet and or earned by this storage node will be lost.

This seed is needed every time the spd daemon is started to unlock the wallet, so it needs to be saved somewhere; Ian put his in the /mnt/scprime directory with everything else in a .seed file. Calling it .seed keeps it hidden, but accessible.

With the seed safely stored in a file for future use you can have a script to unlock the wallet something like this;

#/usr/bin/env bash

SCPRIME=$HOME/scprime/current

SPD_DATA=/mnt/scprime/data

SPD_PROFILE=/mnt/scprime/profiles

SCPRIME_WALLET_PASSWORD=`cat /mnt/scprime/.seed`

export SCPRIME_WALLET_PASSWORD

$SCPRIME/spc wallet unlock

In a script you can’t pass the seed to the unlock command on ‘input’ so you need to set this environment variable, the cat command loads the environment variable from the .seed file.

With the wallet setup, it’s time to put some SCP in it for collateral (learn more about collateral and other Storage Provider settings here). To get your wallet address, type spc wallet address. Copy and paste that address into your GUI wallet or exchange wallet to send coins to your new provider wallet.

You can type spc wallet to check your balance.

Storage Provider Settings

Now you need to configure your storage parameters. The current recommended values can be found here. To learn more about what these settings mean, have a look here.

To configure the host you need to set the following values. As you can see, Ian keeps it in a script;

#/usr/bin/env bash

SCPRIME=$HOME/scprime/current

SPD_DATA=/mnt/scprime/data

SPD_PROFILE=/mnt/scprime/profiles

spc=$SCPRIME/spc

$spc host config maxcollateral 50SCP

$spc host config collateralbudget 2KS

$spc host config minstorageprice 15SCP

$spc host config collateral 18SCP

$spc host config mindownloadbandwidthprice 2SCP

$spc host config minuploadbandwidthprice 2SCP

Adding Storage Folders

Next we add some storage folders — this is simple but needs to be done for each folder being offered to host data. The command is spc host folder add [path] [size]. Using one of Ian’s discs above as an example (data01 which has 3.6TB of usable space) we would use;

spc host folder add /mnt/data01 3600GB

This will add the folder and then we will repeat this for data 02–04 with appropriate size values.

Getting Your Provider Online

You are almost ready to announce your host and start accepting contracts. Before you do that you need to set up your network. Please read, understand and do your own research on your router and network set up if you are not sure.

If you have a static IP address you can just use your external IP address or go to a DNS provider (e.g. DynDNS.org, DuckDNS.org) and sign up for a free service and create an address that points back to your home IP (e.g. scprime.dyndns.org) or whatever is available that you like.

If you have a dynamic IP then, assuming your router supports dynamic DNS providers, you will need sign up with a DNS provider and then your router will update your DNS entry if you enter your account details into the router (see your router documentation). There is a short write up in this article explaining how to setup a DuckDNS account. It’s for Windows, but the basic idea is similar. A more comprehensive explanation of how to use dynamic DNS is available on lots of google search results.

Finally on your internal network you need to set your host machine to have a ‘static’ IP on your network (often referred to as ‘manually assigned ip’ in your router documentation) — then enable port forward for 4282:4283 to this static IP address.

This setup of DNS, manual IP address and port forward allows the storage network to connect properly to your storage node. It may sound complicated if you have not done it before, but the documentation/help pages on your router should be helpful in getting this done.

Once you think its done properly you can test it with;

curl -v put.your.dns.here:4282

This will attempt to open a connection to your storage node. If you have registered your external IP with the DNS provider and set up your router correctly then you should see a response like the one shown above.

The connection will be closed but that's ok as spd wont recognize it and will shut it down, but this means that you have successfully connected from the internet to your storage node.

If I use an example where I don't have a port open (in this example Ian used 4250) then we will get something like what is shown above. You will see connection refused, which means your router is not allowing the connection, so if this happened with 4282 then clearly something is wrong. It’s likely your external IP/DNS address is not registered properly with the external provider, and this is not resolving properly to enable the connection.

Assuming all of that goes well then you are ready to announce and start accepting contracts using the command;

spc host announce put.your.dns.here:4282

Ian’s example is spc host announce scprime.is-very-good.org:4282. Once this is done you can check the status of your host using spc host.

You should have a similar output as shown above. There is a lot more status data than this which can be seen using spc host -v.

Remember each time your machine reboots you will need to start spd and unlock the wallet. The other steps are only needed if you wish to reconfigure your service.

If you are familiar with Linux, you can choose a strategy to automatically perform these actions. You can use @reboot in the Crontab to run a startup script that nicely performs this action.

Please visit the ScPrime Discord if you have any questions or issues setting up your provider instance using Linux.

Guides, technical articles and news about ScPrime. ScPrime is a distributed cloud storage project.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store