Windows Command-Line Interface Guide (CLI)
This guide will show you how to use the CLI to setup your provider instance so you can forgo using the UI altogether.
Here are a few things you will be required to do to get started…
- 2.Ensure you have at least 500GB free space on your hard drives/external drives, etc.
- 3.Know your hosting PC’s local IP address and try and make sure it’s a reserved on your router so it never changes (some routers call this IP Reservation, some call it DHCP Reservation, some may refer to it as a static IP address). 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.
- 4.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. Check out our Port Forward guide for more info.
- 5.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.
- 6.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.
You will want to find the directory where spd.exe and spc.exe are. It’s common that they are located in a directory similar to above. Now is a good time to set a system ‘path’ to this folder. It will make your career as a Storage Provider much easier as you can input spd and spc from any directory.
Pathing works differently within each OS. We will add Mac and Linux instructions soon as well. For Windows, you will want to search for ‘environmental variables’ and open ‘Edit the system environmental variables’.
Now click on Environment Variables
Select the ‘Path’ variable and click on Edit.
Click on New and then Browse. You will want to navigate to the directory discussed above using the Windows Explorer.
Once you see the path to your spd and spc files in the list, click OK. Your path is all set.
Important note: Before starting up the ScPrime daemon, you need to ensure your metadata will be safe. If there is a sure way to corrupt your host's metadata and lose all contracts and collateral, it's by keeping your metadata on a drive that may run out of HD space. In the above example, I am telling the daemon to put the metadata in the default location which is c:\users\(username)\appdata\scprime. This is ok as I have over 100GB free on my system drive. However, if your system drive is lacking on free space, even a Windows Update download might be enough to fill your drive temporarily and prevent the host 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. To do this, swap out the default location above, with where you would like your metadata to be stored instead (see example below).
-d d:\meta -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.exe. For this instance, it was ‘spd.exe -d c:\users\parts\appdata\local\scprime -M gctwh’.
In this command, spd.exe 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.
Now we will create our shared folder/folders.
You will have to create your shared folders first using your OS explorer. For this guide, I created a folder called ‘SCP’ on my D:\ drive and plan to store 1095 GB there. 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 of the metadata.
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.
Note: We have noticed that Storage Providers running on Windows can see extremely long waits while their storage folders are initialized. One possible work around is to compress the folders where you are storing your ScPrime data. This can reduce the wait time dramatically. Check out this guide to learn how to do drive compression.
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. 13 is a good number 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.
Command: 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.
Command: spc host config collateral [value]
Command: 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. Recommended value is 1SCP.
Command: 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. Recommended value is 1SCP.
Command: spc host config minuploadbandwidthprice [value]
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).
Command: 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.
Command: spc host config maxcollateral [value]
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. Type in spc host announce and that’s it, you are now a Storage Provider!
Now that you are online, there are a few items left to cover.
Windows 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 Windows Task Scheduler, you can create a task where the daemon will restart upon reboot.
Open up Task Scheduler and click on ‘Create Task’.
Name the task something related to SPD and select ‘Run whether user is logged on or not’ and also tick the box next to ‘Run with highest privileges’. Then click on the ‘Triggers’ tab.
In the Triggers tab, click on ‘New’ and then select ‘At startup’ from the drop down menu. Also be sure to have the box next to ‘Enable’ checked and then click OK.
Now click on the ‘Actions’ tab and the click on ‘New’.
Select ‘Start a program’ as an action and then create a path to your (future) batch file. Usually it’s C:\users\username\scprime\start.bat. It’s best to set it to the folder that has spd.exe in it. Click OK and then OK again. Your task is created.
It’s also a good idea to check the task’s ‘Settings’ menu to ensure the ‘Stop the task if it runs longer than:’ setting is unchecked. Windows may default to this being checked, which will kill the spd daemon after it reaches the time specified.
Now it’s time to create the batch file.
Using Notepad or something similar, create a batch file as shown above. The paths may vary. You need to know on your PC where your spd.exe file is kept, as well as the various ScPrime folders like consensus, host, transactionpool, etc. When done, save it as ‘start.bat’ in the folder you chose in the Actions tab. You are all set up.