Today I started a Sia Daemon on my VPS. During the entire process I encountered some problems, so I decided to share this document with you.
You can start a Sia Daemon as a root user, but is a good practise to create a dedicated user. So before starting, let's create a user called sia.
adduser sia
su sia
Now, it is time to download the latest version of Sia. Visit the site Sia.tech, find and copy the link to the latest Sia Daemon package for Linux and download the file on the server via wget and unpack the zip.
cd ~
wget https://sia.tech/static/releases/Sia-v1.3.7-linux-amd64.zip
unzip Sia-v1.3.7-linux-amd64.zip
Rename the unzipped folder choosing a fancy name :P
mv Sia-v1.3.7-linux-amd64/ sia-daemon/
Now you have all you need on your server and you can start playing with Sia. First at all, it is necessary to start the sia daemon. You can do this in different ways.
- Just start a process in background, without any supervisor:
cd sia-daemon/
./siad -M gctwh &
- Create and run a service with systemd:
Create the systemd file.
sudo vim /etc/systemd/system/sia-daemon.service
Copy and paste the following snippet into the file and save it.
Description=Sia Daemon
After=network.target
[Service]
Type=simple
ExecStart=/home/sia/sia-daemon/siad -M gctwh
ExecStop=/home/sia/sia-daemon/siac stop
WorkingDirectory=/home/sia/sia-daemon/
Restart=always
RestartSec=10
User=sia
Nice=2
[Install]
WantedBy=multi-user.target
Alias=siad.service
Finally, start the sia-daemon service entering:
systemctl start sia-daemon.service
Sia should be running as a service and you should be able to use the command-line client. To check sia-daemon.service status use:
systemctl status sia-daemon.service
To check that everthing works correctly, enter:
./siac
and you should see something like:
Synced: No
Height: 171760
Progress (estimated): 80.2%
You can now start playing with Sia. To dispaly the documentation type:
./siac -h
Sia can be launched with different modules. To display information about modules, enter:
./siad modules
You should see something similar:
Modules are independent components of Sia. This flag should only be used by developers or people who want to reduce overhead from unused modules. Modules are specified by their first letter. If the -M or --modules flag is not specified the default modules are run.
The default modules are:
gateway, consensus set, host, miner, renter, transaction pool, walletThis is equivalent to:
siad -M cghmrtwBelow is a list of all the modules available.
Gateway (g):
The gateway maintains a peer to peer connection to the network and
enables other modules to perform RPC calls on peers.
The gateway is required by all other modules.
Example:
siad -M g
Consensus Set (c):
The consensus set manages everything related to consensus and keeps the
blockchain in sync with the rest of the network.
The consensus set requires the gateway.
Example:
siad -M gc
Transaction Pool (t):
The transaction pool manages unconfirmed transactions.
The transaction pool requires the consensus set.
Example:
siad -M gct
Wallet (w):
The wallet stores and manages siacoins and siafunds.
The wallet requires the consensus set and transaction pool.
Example:
siad -M gctw
Renter (r):
The renter manages the user's files on the network.
The renter requires the consensus set, transaction pool, and wallet.
Example:
siad -M gctwr
Host (h):
The host provides storage from local disks to the network. The host
negotiates file contracts with remote renters to earn money for storing
other users' files.
The host requires the consensus set, transaction pool, and wallet.
Example:
siad -M gctwh
Miner (m):
The miner provides a basic CPU mining implementation as well as an API
for external miners to use.
The miner requires the consensus set, transaction pool, and wallet.
Example:
siad -M gctwm
Explorer (e):
The explorer provides statistics about the blockchain and can be
queried for information about specific transactions or other objects on
the blockchain.
The explorer requires the consenus set.
Example:
siad -M gce
This is the reason why we started sia with ./siad -M gctwh
.
TBD
thanks brother