Stakenet (XSN) TPoS on your own VPS #Guide

jstarhead
7 min readSep 13, 2018

--

Context:

I. Disclaimer

II. Rent a VPS-Server

III. Set up your VPS-Server

IV. Install xsn-core at your VPS

V. Set up your own TPoS-Contract at your VPS

I. Disclaimer

#1 This guide only works with xsn-wallet V1.0.10 +.

#2 This guide works for nearly every Linux distribution at your VPS.

#3 This guide works for nearly every Windows, Linux or iOS at your local PC.

#4 You need a SSH telnet client like PuTTY.

#5 You need one static IPv4 for every TPoS-Contract your VPS will host.

#6 If you dont have a VPS, you can rent a VPS at Vultr.

#7 Every IP, private key, public key and txid I used in this guide were only created and used for this guide. They never have been hot and are already destroyed.

II. Rent a VPS-Server

Cheapest rentable VPS for TPoS-Node

For setting up a TPoS-Merchant VPS with only one IPv4, the hardware requirements are very low. The cheapest server I know is a Vultr VPS located in Miami for 2.5$ a month.

III. Set up your VPS-Server

Step 1) Log into your VPS with PuTTY

Login your VPS with PuTTY: root@“your.vps.merchant.ip“.

If this is the first time, you login your VPS, you have to accept and add the servers SSH-Key. Just press yes.

If this is the first time you use a linux bash don‘t be confused. You never see your password when writing in a linux OS.

Tipp: If you use Vultr you can copy your password at their homepage and past it into linux with a right-klick.

Step 2) Set up a super-do user

Commands:

adduser “your_user_name“

usermod -aG sudo “your_user_name“

Step 3) Update and upgrade your VPS

Commands:

apt-get update

apt-get upgrade

apt dist-upgrade

Step 4) Install a virtual enviroment

Commands:

apt install ufw python virtualenv git unzip pv

ufw allow ssh/tcp

ufw limit ssh/tcp

ufw allow 62583/tcp

ufw logging on

ufw enable

Step 5) Create a swapfile

Commands:

fallocate -l 4G /swapfile

chmod 600 /swapfile

mkswap /swapfile

swapon /swapfile

Step 6) Mount your swapfile

Commands:

nano /etc/fstab

/swapfile non swap sw 0 0

If this is the first time you use a linux bash don‘t be confused. The nano-command opens an editor. Navigate with the arrow keys to the bottom and write the /swapfile-command. To save your modifications, press ctrl+x, followed by y.

Step 7) Disable root login to protect your VPS

Commands:

nano /etc/ssh/sshd_config

PermitRootLogin no

MaxAuthTries 5

Navigate with the arrow keys to PermitRootLogin and change the yes into a no. Then add the MaxAuthTries line. To save your modifications, press ctrl+x, followed by y. From now on, you have to use the sudo user from Step 2) to login your VPS.

Step 8) Restart your VPS

Commands:

reboot

You have to restart your PuTTY as well.

Step 9) Login your VPS and switch back to root

Commands:

su

With su (switch user) you directly switch into root. Just enter your root-password now.

Set up your VPS-Server; Command summary:

adduser “your_user_name“

usermod -aG sudo “your_user_name“

apt-get update

apt-get upgrade

apt dist-upgrade

apt install ufw python virtualenv git unzip pv

ufw allow ssh/tcp

ufw limit ssh/tcp

ufw allow 62583/tcp

ufw logging on

ufw enable

fallocate -l 4G /swapfile

chmod 600 /swapfile

mkswap /swapfile

swapon /swapfile

nano /etc/fstab

/swapfile non swap sw 0 0

nano /etc/ssh/sshd_config

PermitRootLogin no

MaxAuthTries 5

reboot

su

IV. Install xsn-core at your VPS

Step 1) Create an empty directory and download the wallet

Commands:

cd ~

mkdir xsncore

cd xsncore/

wget “https://github_download_link“

At the moment you have to use this link: https://github.com/X9Developers/XSN/releases/download/v1.0.15/xsn-1.0.15-linux64.tar.gz

If you want to install another version, you have to look for the link on github on your own.

Step 2) Unzip the downloaded files

Commands:

tar xfvz xsn-1.0.15-linux64.tar.gz

Step 3) Move your xsn-files to a secure place, change their permissions and clean up

Commands:

mkdir ~/.xsncore

cp xsn-1.0.15/bin/xsnd ~/.xsncore/

cp xsn-1.0.15/bin/xsn-cli ~/.xsncore/

chmod 777 ~/.xsncore/xsn*

rm xsn-1.0.15-linux64.tar.gz

rm -r xsn-1.0.15/

Keep in mind: If you downloaded another version of the wallet, your files might have another name. Example: wallet 1.0.15 file names were: xsn-1.0.15*

Step 4) Edit your xsn.conf file

Commands:

nano ~/.xsncore/xsn.conf

rpcallowip=127.0.0.1

listen=1

server=1

daemon=1

maxconnections=24

externalip= your.vps.merchant.ip:62583

We will edit the xsn.conf in the next chapter, to upgrade your xsn-server to a merchantnode.

Step 5) Start your xsn-daemon

Commands:

~/.xsncore/xsnd

Install xsn-core at your VPS; Command summary:

cd ~

mkdir xsncore

cd xsncore/

wget “https://github_download_link“

tar xfvz xsn-1.0.15-linux64.tar.gz

mkdir ~/.xsncore

cp xsn-1.0.15/bin/xsnd ~/.xsncore/

cp xsn-1.0.15/bin/xsn-cli ~/.xsncore/

chmod 777 ~/.xsncore/xsn*

rm xsn-1.0.15-linux64.tar.gz

m -r xsn-1.0.15/

nano ~/.xsncore/xsn.conf

rpcallowip=127.0.0.1

listen=1

server=1

daemon=1

maxconnections=24

externalip= your.vps.merchant.ip:62583

Commands: ~/.xsncore/xsnd

V. Set up your own TPoS-Contract at your VPS

Foreword: Every command is executed at your VPS. There will be only one step, you need to execute at your cold wallet. This is the only moment your cold-wallet needs to be online for a few seconds.

Step 1) At your VPS: create a merchant address

old command # don’t use this command!
new command # please use this command!

Commands:

~/.xsncore/xsn-cli getnewaddress “alias” legacy

Since wallet version 1.0.10+ you need to define your new address as a legacy address. A legacy address starts with X…. If you do not execute “alias” legacy, you will create a segwit address, starting with 7…. The “alias” parameter is to set the name of your TPoS address. You can name it whatevery you like.

Save this new address at a local editor, like Notepad. You need it in Step 2) and 3)

Tipp: mark the address in the linux bash and paste it into a local notepad.

Step 2) At your cold wallet: setup a tpos contract

Use the address form Step 1). Set the commission as low as possible, because you are your own merchant!

Step 3) At your VPS: show the privat key of the merchant address

Commands:

~/.xsncore/xsn-cli dumpprivkey “getnewaddress result from Step 1)“

Step 4) At your VPS: show your tpos contract

Commands:

~/.xsncore/xsn-cli tposcontract list

Save the txid at a local editor, like Notepad. You need it in Step 5) and Step 10)

Step 5) At your VPS: edit the merchantnode.conf

Commands:

nano ~/.xsncore/merchantnode.conf

name ip:port privatkey txid

Step 6) At your VPS: edit the xsn.conf

Commands:

nano ~/.xsncore/xsn.conf

merchantnode=1

merchantnodeprivkey=“dumpprivkey “getnewaddress“ result“

Now we can add the privat key from Step 3) in the xsn.conf file

Step 7) At your VPS: restart your server

Commands:

~/.xsncore/xsn-cli stop

~/.xsncore/xsnd

Step 8) At your VPS: start the merchantnode

Commands:

~/.xsncore/xsn-cli merchantnode start-alias “merchantnode_name“

Step 9) At your VPS: show the merchantnode config

Commands:

~/.xsncore/xsn-cli merchantnode list-conf

After 15–30min the PRE_ENABLED status will switch into ENABLED.

Step 10) At your VPS: start the tpos contract

Commands:

~/.xsncore/xsn-cli setgenerate true 1 true “txid from step 4“

After your PRE_ENABLED status switch into ENABLED you can run these command. Without this command, your merchantnode will not start staking.

Set up your own TPoS-Contract at your VPS; Command summary:

~/.xsncore/xsn-cli getnewaddress “alias” legacy

~/.xsncore/xsn-cli dumpprivkey “getnewaddress result“

~/.xsncore/xsn-cli tposcontract list

nano ~/.xsncore/xsn.conf

merchantnode=1

merchantnodeprivkey=“dumpprivkey “getnewaddress result“

~/.xsncore/xsn-cli stop

~/.xsncore/xsnd

~/.xsncore/xsn-cli merchantnode start-alias “tpos_merchantnode_name“

~/.xsncore/xsn-cli merchantnode list-conf

~/.xsncore/xsn-cli setgenerate true 1 true “txid“

--

--