Skycoin is an opensource block-chain implementation which is being used by a number of companies, including Skycoin (SKY) itself. It has a several advantages over Bitcoin, Ethereum and similar implementations:
- There are no transaction costs as such.
- Transactions happen in seconds, not hours.
- High number of transactions per second (tps)
- Resilience (remember Crypto-Kitties)
This blog is about running a server node. You can also easily run a node on your PC/laptop as the wallet download also comes with a full node included.
This blog will get you up and running with Ubuntu 17, but will work equally well for Ubuntu 16 LTS and similar. The official instructions (for Debian) are here.
1. HW and OS Prerequisites.
It will run on Any recent Linux, windows or OS X machine.
1GB ram, 1CPU and 10GB disk are sufficient, but for production I would recommend minimum of 2 CPU, 2GB ram, 40GB disk.
2. OS preparation
2.1 First make sure your distro is up to date:
$ sudo apt-get update
$ sudo apt-get upgrade -y
- when using linode servers, accept the option to keep current grub config file.
- you can also consider doing “sudo apt-get dist-upgrade”
2.2 Harden your server
You are responsible to secure your server. Below are recommended additions to your list of hardening steps.
2.2.1 create user accounts for the administrators. Avoid logging in as root.
$ sudo adduser example_user
$ sudo adduser example_user sudo
2.2.2 Setup certificate based login
Create public/private keys for your login user.
paste your public rsa key into ~/.ssh/authorized_keys
Make sure .ssh dir has 700 permissions and is owned by example_user and that authorized_keys is 600.
See here for more information
2.2.2 Disable root login over SSH
(Warning, create your user accounts first)
2.2.3 Disable passwords
Make sure you have certificate based login working first.
2.2.4 Setup firewall
make sure firewall is installed and running:
$ sudo ufw status
It will be inactive by default.
$ sudo ufw allow ssh/tcp
$ sudo ufw limit ssh/tcp
$ sudo ufw allow 6000/tcp
$ sudo ufw logging on
start the firewall
$ sudo ufw enable
Note, this will now block external rpc calls. If you want PRC access, you can open port 8334 with suitable security.
2.2.5 install fail2ban
This bans logsin after too many failed attempts. It will stop the server being spammed with malicious login attempts. If you decide to keep password based login, this is doubly important to prevent brute force password attacks.
$ sudo apt-get install fail2ban
$ sudo service fail2ban status
$ sudo fail2ban-client status
Consider setting up sendmail to email the administrator any violations caught.
2.3 Install utils
$ sudo apt-get install -y git curl
3. Skycoin Installation
There are many ways to do this, including using gvm. This blog uses the manual install.
$ cd ~
$ export GOV=1.9
$ curl -sS https://storage.googleapis.com/golang/go$GOV.linux-amd64.tar.gz > go$GOV.linux-amd64.tar.gz
$ tar xvf go$GOV.linux-amd64.tar.gz
$ rm go$GOV.linux-amd64.tar.gz
$ sudo mv go /usr/local/go
$ sudo ln -s /usr/local/go/bin/go /usr/local/bin/go
$ sudo ln -s /usr/local/go/bin/godoc /usr/local/bin/godoc
$ sudo ln -s /usr/local/go/bin/gofmt /usr/local/bin/gofmt
3.1 Create skyd user
This user will be used as the “owner” of the process.
$ sudo adduser skyd
3.2 Set paths
$ sudo su – skyd
$ vi .profile
add this to the end of .profile:
reload the profile
$ . ./.profile
Note: if you are using a local xterm, not ssh login, then .profile is not called. In this case edit .bashrc rather than .profile.
3.3 Install skycoin
$ sudo su – skyd
$ go get github.com/skycoin/skycoin/…
3.3.1 Installing from a fork
Note: if you installing skycoin from a fork or a clone coin, and you dont want to have to rename the skycoin paths, use the following isntall method to install the fork:
$ sudo su – skyd
$ mkdir go
$ cd go
$ mkdir src
$ mkdir bin
$ mkdir pkg
$ cd src
$ mkdir github.com
$ cd github.com
$ mkdir skycoin
$ cd skycoin
$ git clone git://github.com/YourFork/skycoin
$ go install skycoin/cmd/skycoin/skycoin.go
This will put a new executable “skycoin” in your go/bin dir.
The above is basically what “go get” was doing for us, but it allows us to set the proper import paths.
4. Setup service
This will start the skycoin node on boot, and also if it dies.
Here we use systemd, but you can also use init.d/rc.d, systemctl or other service manager. systemd is the default manager on Ubuntu 16 and replaces upstart.
4.1 Create the service description file:
$ sudo vi /etc/systemd/system/skycoin.service
4.2 enable the service on startup/reboot:
$ sudo systemctl enable skycoin
$ sudo systemctl start skycoin
$ sudo systemctl stop skycoin
$ sudo sytemctl status skycoin
This will output the status (running or not, and the last lines of the log output.
$ sudo journalctl -u skycoin
$ sudo journalctl -u skycoin -f