If you own a Raspberry Pi you probably know how to do this. If not, the easiest way is probably to download the Raspberry Pi Imager and use it to prepare a sdcard. Your storage device should have at least 64 GB. This guide will not work with a 32 GB sdcard.
Make sure to select the 20.04 64bit long term support version.
Login into Ubuntu with your favorite SSH client. The default username and password is
ubuntu. You are promted to change your password on first login. Once you’ve changed your password you have to login again with the new password.
We now switch to the root user for the following commands using
sudo su -
If you use a Raspberry Pi 3 you are limited to 1 GB of RAM. The memory consumption for some tasks might be higher. We therefore add a 1.5 GB swapfile and add a line to fstab so the swapfile is automatically mounted on next boot. If you use a Raspberry Pi 4 with 2 GB or 4 GB or RAM you can probably skip this step.
fallocate -l 1.5G /swapfile && chmod 600 /swapfile && mkswap /swapfile && swapon /swapfile echo "/swapfile swap swap defaults 0 0" >> /etc/fstab
A Sia storage node will usually run for a long time and you probably rarely interact with it. It therefore is a good idea to configure and enable unattended upgrades for the OS:
Uncomment (removing the two slashes in front of the lines) and edit the following settings:
To save your changes use
O followed by
Enter. To quit, use
To keep everything easy we want to use a Docker container to run our Sia node.
apt install docker.io
The first thing you have to know is that it is a bad idea to store the data (node data, blockchain and hosted files) on an SDcard. There will be a lot of writes and the card will probably die quite fast. Instead you should place the data on more durable storage devices like e.g. a HDD or SSD and probably even a RAID to protect the data against disk failure. For my Raspberry Pi node I store the node data including the blockchain on a small SSD and the hosted files on larger HDDs.
For setting up the data storage with docker you have a couple option:
Using a docker volume is probably the way to go if you only plan this as a test setup. Mounting filesystem paths is the way to go if you want to add storage from multiple drives / file system paths. I strongly suggest to go with a filesystem path from the start, however if you want to go with a docker colume create a volume for the Sia container like this:
docker volume create sia-data
Skip the volume creation if you want to use filesystem paths.
Normally we would now be able to start our Sia node, however the initial sync of the node would take a very long time. We can bootstrap this process by downloading data that would otherwise be downloaded and verified from other nodes. Even this takes quite some time but is still way faster than the normal sync.
wget --tries=inf -O blank-siad-260k.tar.gz "https://skyportal.xyz/file/LAD8TZnESG27UlZGsmsxG36a6Kx7akNxJD3b7iRjT5OzNg"
Note: You can also choose other Skynet portals from this list if the one listed above does not work. For most portals you need to remove
/file/ from the URL. The official portal operated by Nebulous is SiaSky.net.
We can now extract the files, delete the tar.gz and move the extracted files into our docker volume.
mkdir sia-data && tar -xvf blank-siad-260k.tar.gz -C sia-data && rm blank-siad-260k.tar.gz docker run --rm -v $PWD:/source -v sia-data:/sia-data -w /source alpine mv sia-data/* /sia-data
Now is a good time to finally run the Sia Docker container.
If you created a docker volume use the following:
docker run \ --env SIA_WALLET_PASSWORD="YOUR SEED" \ --env SIA_API_PASSWORD=apipass1 \ --detach \ --restart unless-stopped \ --mount type=volume,src=sia-data,target=/sia-data \ --publish 127.0.0.1:9980:9980 \ --publish 9981:9981 \ --publish 9982:9982 \ --publish 9983:9983 \ --name sia \ siacentral/sia -c --siamux-addr ":9983" --host-addr ":9982" --rpc-addr ":9981" --api-addr ":9980"
If you want to use file system paths use the following:
docker run \ --env SIA_WALLET_PASSWORD="YOUR SEED" \ --env SIA_API_PASSWORD=apipass1 \ --detach \ --restart unless-stopped \ -v /local/path/to/sia-data=/sia-data \ -v /local/path/to/sia-storage=/sia-storage \ --publish 127.0.0.1:9980:9980 \ --publish 9981:9981 \ --publish 9982:9982 \ --publish 9983:9983 \ --name sia \ siacentral/sia -c --siamux-addr ":9983" --host-addr ":9982" --rpc-addr ":9981" --api-addr ":9980"
If you want to use multiple disks for storage you can mount them into different paths.
-v /media/disk1=/sia-storage1 \ -v /media/disk1=/sia-storage2 \
Starting the container for the first time and waiting for a complete sync can take a very long time, even after bootstrapping. You can check the progress using:
docker logs sia
In my case the initial startup tool 5.3 hours.
If you are on a host with a firewall or behind a router with NAT make sure to whitelist and forward the required TCP ports.
Watchtower is a service that automatically updates Docker containers to the newest version. By adding it, we will always run the latest version of Sia.
docker run -d --restart unless-stopped --name watchtower -v /var/run/docker.sock:/var/run/docker.sock containrrr/watchtower --cleanup --include-stopped
echo "alias siac=\"docker exec -it sia ./siac\"" >> ~/.bashrc && source ~/.bashrc
Either create a wallet with a new generated seed:
siac wallet init
Or initialize the wallet with an existing seed:
siac wallet init-seed
Generate an address and transfer some funds that will be used as collateral when hosting. Note: Once you initialized your wallet the blockchain will be scanned for transactions which takes quite some time.
siac wallet address
If you don’t have a static IP address for your server make sure to get a dynamic dns host always pointing to your IP and configure it using:
siac host config netaddress siahost.example.com:9982
Configure your pricing:
siac host config mincontractprice 1SC siac host config minstorageprice 1000SC siac host config collateral 2000SC siac host config maxcollateral 1000SC siac host config mindownloadbandwidthprice 3500SC siac host config minuploadbandwidthprice 0SC
Set you total collateralbudget and make sure the value is slightly lower than the balance on your wallet (e.g. balance - 1SC). Otherwise you risk that all of your balance will be locked in contracts and there is not enough balance left to submit storage proof and finalize the contracts.
siac host config collateralbudget 100000SC
Assign some diskspace:
siac host folder add /sia-storage 10GB
Note: you might want to mount additional Disks as directories into the container.
Finally announce your host.
siac host announce
If you liked this guide feel free to show it by sending some SC to
183fe1c8325bf8b5e9931cf8993beffbab5616b653bc0da361b0a7d96591af9d85137f071fb3. Currently I simply do not have enought balance to provide enough collateral since I started hosting by simply getting a couple of Siacoin from a faucet instead of buying them on an exchange.
If you have questions head over to the SIA Discord server and ask them in the hosting channel. If you have some suggestions on improving the guide you can also send me an e-mail.