Windows UI to CLI Migration Guide

This guide will help DIY Windows users to migrate away from providing using the Windows UI app to using the CLI. It has been well documented and discussed on Discord that the Windows UI app has many failings when it comes to being used for a stable provider, namely it starts the renter module by default, there’s no way to change the ports if you have a 2nd provider, it has a memory leak, it often will show you offline when you are online to name a few. If starting spd from the CLI it can be used to configure folders and to view the wallet but now it’s better to use the WebWallet for that purpose.
This guide assumes you installed the UI using the default location and that the metadata is in the default location, these are as follows:
C:\Users\<USER>\AppData\Local\Programs\SiaPrime-UI\ - ScPrime UI
C:\Users\<USER>\AppData\Local\ScPrime\ - metadata folder
If you have installed the UI app to a different folder then you will need to find that and adjust these steps accordingly.
In the above we can see our host with a single storage folder configured for just under 600GB at C:\Data, the various Host Settings for Max Duration, Collateral per TB/month, Storage per TB/month, Download Per TB and Upload per TB.
Below we can see the Wallet page and any transactions in the wallet.
So to start to move away from using the UI, first check what version of the daemon you are running by clicking the About icon:
Here we are running 1.6.0 still. So unless you are running the latest version of the daemon already, head to the software page on the ScPrime website and download the Windows Command Line daemon which contains both spd.exe and spc.exe. Now close the UI app by right clicking on the P icon in the System Tray and select Quit. Then unzip the file you downloaded and copy the files within it to the resources/bin folder in the location you have the UI installed to, so for example in the default location it will be;
Overwrite the existing spd.exe and spc.exe files there (these will be the 1.6.0 version in our case).
Now to make life easier in the command prompt we are going to add the above folder into our PATH variable, this will allow us to run spd and spc from any location in a Command Prompt rather than having to change directory to that folder every time. To do this, type in ‘environment’ in to the Windows search bar and select “Edit the system environment variables”.
Then click on Environment Variables in the bottom right of the dialog box:
Then click on Path in the Variable column and click on Edit:
In the Edit environment variable dialog box, click on Browse, navigate to the C:\Users\<USER>\AppData\Local\Programs\SiaPrime-UI\resources\bin folder and click on OK.
You should now see that folder path as a new line along with any other paths which were already present.
Click on OK, OK and then OK. For the path environment variable to be loaded you need to reboot Windows at this point for it to take effect.
Once Windows has rebooted, open a Command Prompt and now rather than opening the UI to start up spd, you can just type:
spd -M gctwh
Notice how the renter module is not loaded, without the “-M gctwh” flag then all 6 modules would have been loaded and as a provider you have no need to run the renter module. Once you see the API is now available message, open another Command Prompt, do NOT close the one where spd was started as that always needs to be running for spd to be running, just minimize it.
In the 2nd command prompt type spc to check on the blockchain sync and out wallet:
The Consensus should show Synced: Yes, if not but the Height is increasing each time you run the spc command then the blockchain is still in the progress of syncing which is fine, just let it complete. Notice above our wallet is showing as locked so we need to unlock it, this is the same as when you load the UI it prompts you to enter the wallet seed phrase or password. In the CLI you simply type spc wallet unlock and then enter either your seed or password the same as you did in the UI.
Note if successful you won’t see any message. Now type spc host to check on the host status:
We can see here our Provider ID which will be the same as it was before when using the UI, our announced IP address and port number, some of the provider settings like Storage Price and Max Duration, exactly the same as was set in the UI and our storage folder. What you should see once your provider is fully working is the Connectability Status as “Host appears to be working” (this can take a few mins after starting up).
And now you are running with the CLI. To understand the other CLI commands available you can either use the context help (add -h to the end of any command to see what the next options are and a brief description, for example type ‘spc -h’ to see what the next commands like wallet, host, etc are) or refer to the Windows CLI guide here. It’s also worth referring to that guide to setup the auto startup script so that spd always runs on Windows bootup and then you won’t need the command prompt open with spd running all the time, it will simply run in the background.
created 6/30/22 v1.0