It is our assumption that Linux users in general will feel naturally at ease with using the terminal/Command-Line Interface (CLI) and we assume you already have previous knowledge of Linux OS, setup, functions and commands. It is also recommended to run the Storage Provider on a day to day basis using the CLI for reasons discussed above. This guide will show you how to use the CLI to setup your provider instance.
Here are a few things you will be required to do to get started:
-Ensure you have at least 500GB free space on your hard drives/external drives, etc.
-Know your hosting PC’s IP address and try and make sure it’s a IP Address Reservation. While a dynamic IP address can work, any time you have to reboot the machine, it could change the address, causing issues with your host. You can work around this with a dynamic DNS address. To learn how to get a dynamic DNS address, please join the ScPrime Discord.
-You need to make sure you have port forwarding open on port 4282 and 4283. How and where you do this depends on your ISP. For myself, I just had to log into my ISP provided router and open those ports for the IP address of my hosting PC. There are thousands of router models, so you may need to chat with your ISP or manufacturer if you cannot find the forwarding menu.
-Make sure your hosting PC is one you can leave on 24/7. While you can be offline for small periods of time for updates, being a storage provider requires some commitment because you are storing data that people need access to.
-Have enough collateral to cover the costs to start providing storage. Your collateral is only used as your storage usage increases. You will not need to cover all your capacity to start out. Covering 1-2TB worth of collateral to start should get you going, but you’ll want to monitor your provider as usage increases. For more info, check out this guide.
A note on collateral – Collateral is part of the exchange between a storage provider and a storage renter. Because of the decentralized nature of the network there has to be a mechanic in place to keep a ScPrime Storage Provider from just switching off their computer or faking the data. This mechanism is collateral. Collateral is put up to guarantee original data is stored and not tampered with.
Starting the Daemon
Important note: If you’re planning to use the CLI to run a storage provider instance and not just as a wallet, you need to be aware of where you are keeping your metadata. If there is a sure way to corrupt your Storage Provider’s metadata and lose all contracts and collateral, it’s by keeping your metadata on a drive that may run out of HD space. The default location is $HOME/.scprime. This should be fine, if you have over 100GB free on your system drive. However, if your system drive is lacking on free space or you have reserved too little space for system-updates and/or growth for metadata (consensus, contractdb, etc) this could prevent the Storage Provider from writing to or accessing the metadata folder. If this happens, your host may be unrecoverable.
To avoid this, ensure your system drive has ample free space. How much space can be different for each instance, but 100GB is a safe bet. An easier route however, would be to put your metadata on a non system drive or disk partition. To do this, swap out the default location above, with where you would like your metadata to be stored instead (see example below).
Note: If you’re not planning on using the renter, it is advisable to not load the renter-module as it will use a lot of system memory. You can do this by using the following flag ‘-M gctwh’ (see example below as well).
$ ./spd -d /home/<username>/.scprime -M gctwh
Now let’s fire up the daemon. You will either need to know the directory where you want to store your ScPrime metadata. The directory will have folders like ‘consensus’, ‘host’, etc. Once found, use it as above with ./spd. For this instance, it was :
.spd -d $HOME/ScPrime/MetaData -M gctwh
In this command, ./spd is the program. -d points the program to the directory where the metadata is stored including consensus, wallets and file contracts. -M refers to which modules will be loaded at startup. This is where the CLI shines by letting you cut some fat in not loading modules you won’t be using
g = gateway (access to the p2p network, must be active)
c = consensus (blockchain, must be active)
t = transactionpool (must be active)
w = wallet (must be active)
h = host (must be active if you are providing storage)
Other modules include renter, explorer, miner but these are seldom needed based on the current network setup.
The ScPrime Daemon is now running.
Open a new command prompt and type ./spc to see the status. You will want to make sure your host is synced at a block height above 109,000. You will also notice that your wallet is still locked.
To unlock the wallet type ./spc wallet unlock and then enter your wallet password (which is most likely your passphrase seed unless you changed it to a password). You can copy/paste your 28 or 29 word seed in from a text file or you can manually type it. In either case it will not show up on the screen for privacy reasons. Once you have entered it fully, hit enter and you should return to the command prompt if entered correctly.
If you use the ./spc command again, you will see the wallet is now unlocked.
Note: It is very important that if you plan to run multiple provider instances, that each has a separate wallet. Sharing a single wallet among multiple instances will cause issues.
Adding Shared Folders
Now we will create our shared folder/folders.
You will have to create your shared folders first using your OS explorer. For this guide (educational purpose), I created a folder called ‘SCP’ on my system drive and plan to store 500 GB there.
$ mkdir $HOME/SCP
As shown above, the command is ./spc host folder add (your drive and folder) (amount of storage offered). It’s very important to leave at least 40 to 50 GB of the drive’s total capacity free to prevent any file corruption.
The minimum recommended amount of storage you should offer is 500GB. Storing at least this much, as this guide suggests, allows you to earn incentives to host, along with your rent.
Storage Provider Settings
Note: The pricing and other provider settings mentioned below are fluid and are subject to change. While we strive to keep these guides updated, it is YOUR responsibility to make sure you are using the most up to date settings that can be found HERE!
The project has created guidelines for storage providers to follow based on what is optimal for contracts between ScPrime and its clients. Setting up your host within these guidelines, as mentioned, allows you to earn incentives to enhance profitability as a Storage Provider. Incentives supercharge your earning capability based on desirable characteristics such as price, location, how reliable your storage computer is and performance.
Now let’s take a closer look at the settings;
Max Duration– This is fairly straight forward. It’s the maximum amount of time in weeks you want to allow a smart contract with a renter to last. You can set this to what you like. 9 or 13 are good numbers to set it at. Speaking further about contracts, on the ScPrime network, these contracts are smart contracts. They are validated on the blockchain, and are the reason two unknown parties can transact with each other, like ScPrime hosts and renters do.
./spc host config maxduration [value]
Collateral Per TB/Month– As previously mentioned, this is the amount of collateral you will put up per month, per terabyte in collateral. It’s recommended to set your collateral 1x what you are charging for storage. For example, based on current recommendations of storage if your pricing is set at 15SCP, collateral should also be set at 15SCP.
./spc host config collateral [value]
Storage Per TB/Month– This is what you are charging per terabyte per month for storage. See the current recommendations for more info on what you should charge.
./spc host config minstorageprice [value]
Download Per TB– This is another ‘fee’ you can charge depending on your ISP. Download as a host is actually your ‘upload’ in terms of your ISP. If a renter downloads some of his data from your host, you will be ‘uploading’ it to him. Many internet plans commonly have upload limits, so if that is the case with your ISP, you may want to play around with this value.
./spc host config mindownloadbandwidthprice [value]
Upload Per TB– Similar to above, but this is really you ‘downloading’ in terms of your ISP. Most internet plans have high or unlimited download options, so this might be one you can charge very little for.
./spc host config minuploadbandwidthprice [value]
A note on upload/download charges – Charging 0 SCP for upload, your download, makes your host more attractive for Relayer traffic and is recommended, while customer downloads, your upload, should be set to cover your specific ISP scenario and costs.
Collateral Budget– The total amount of SCP from your wallet that can be locked up in smart contracts at one time is your collateral budget. It is recommend to set this at 2KS (2000 SCP).
./spc host config collateralbudget [value]
Max Collateral– This setting is the maximum amount of SCP that can be locked into a single contract at one time. 50 SCP is the recommended amount currently.
./spc host config maxcollateral [value]
Putting it all together
Now we are ready to get your provider instance up and running using what we learned above about the different settings.
All the commands entered are within the recommended community settings to qualify for incentive payments. After each command is entered, you will get the confirmation the host setting is updated. You can ignore the ‘error’ message. It pops up because we aren’t loading the renter module on the daemon.
Now we will announce that our ‘host’ is ready to start taking on data from the network using this command:
./spc host announce
You are now a Storage Provider! Sometimes this command will not effectively announce you Storage Provider, in that case use this command:
./spc host announce <ip-address/ddns>:<port (default port is 4282)>
Important note: If this is your second, third, etc , etc, Storage Provider, please read the paragraph below first before announcing this host!
You can check you status within the terminal by typing the following command:
./spc host -v
Setting up multiple Storage Providers
When you setup multiple Storage Providers you will need to be aware to launch ./spd and announce your Storage Provider with different ports. Currently 4 ports are in use, of which 2 need to be port forwarded (4282, 4283). We generally advise people to skip at least 10 ports for your next host but some community members simply add a number in front of default ports, in any case they need to be unused. For example:
|Default ports||Example 1||Example 2|
When you have chosen a certain setup strategy you will need to launch the daemon with these ports to avoid conflict with your current Storage Provider running on default ports. Let’s take example 1 and show what it looks like:
./spd --host-addr :14282 --host-api-addr :14283 -d /home/<username>/.scprime -M gctwh
If you use this port scheme for example, you will also need to announce your Storage Provider on port 14282.
./spc host announce <ip-address/ddns>:14282
AutoStart Daemon on Reboot (Optional)
Linux based Storage Providers can find their PC’s rebooting for a number of reasons. If a reboot happens when you’re away from the PC your provider instance is running on, you may find your uptime suffering until you can restart the SPD. Using the following process, you can create a task where the daemon will restart upon reboot with no user intervention.
This process has been tested on Ubuntu 20.04 desktop and server variants but should work on other Linux distros.
To keep the path to spc and spd consistent between software versions, create a soft link for the current version. For example, for version 1.5.3, if the path to where spd and spc are located is:
Then create a softlink in the ScPrime folder called ‘current’ pointing at ‘ScPrime-v1.5.3-linux-amd64’ using the following command in the ScPrime folder:
ln -s ScPrime-v1.5.3-linux-amd64/ current
Then the location of spc and spd is always /home/<user>/ScPrime/current. When a new version of the software comes out, simply change the soft link to point the ‘current’ folder at the new location, for example:
ln -vnfs ScPrime-v1.6.0-linux-amd64/ current
This then saves updating startup scripts etc. to point to the new location of spd and spc. Note the rest of this guide assumes the above step has been carried out, if not then adjust the paths to spd in the below.
Create the shell script
The following assumes that your metadata is located in /home/<user>/.scprime and spd and spc are located in /home/<user>/ScPrime/current. If you have chosen other locations then adjust the paths as required.
Create a shell script using the following command (replace Nano with Vi, Vim or any other text editor you have in your Linux install)
sudo nano /usr/local/sbin/spd-startup.sh
You’ll be prompted to enter your user password as you are using Sudo. Enter the following in Nano:
SCPRIME_WALLET_PASSWORD=`cat $HOME/ScPrime/.seed`(use backticks, not apostrophe here)
nohup $SCPRIME/spd -d $SPD_DATA -M gctwh &
Close Nano with Ctrl-x and save the file. When you close the spd-startup.sh file you will have to make it executable with the following command
chmod +x /usr/local/sbin/spd-startup.sh
Now we need to create a file with your wallet password in it. We’ll create a hidden file call ‘.seed’ in the ScPrime folder.
Enter just your wallet password in this file, close and save it.
To create the systemd.service file, enter the following:
sudo nano /etc/systemd/system/spd-startup.service
Enter the following details in the next screen;
User=<your user name>
ExecStart=/bin/bash -c /usr/local/sbin/spd-startup.sh
Exit nano saving the file. Next run the following commands;
sudo systemctl daemon-reload
sudo systemctl enable spd-startup.service
sudo systemctl start spd-startup.service
You can check the status with:
sudo systemctl status spd-startup.service
If all is working, you would expect to see something like this;
Now reboot your provider, after logging back in, check the service started correctly with the above command and check with ‘./spc’ that the blockchain is in sync and your wallet is unlocked. You are all set up.