XSN Lightning Node Guide

hydranet I German
12 min readApr 20, 2020

Hello and welcome to another Stakenet tutorial! In this guide, I will explain how to set up a Stakenet XSN Lightning Node with a local XSN wallet on a Linux VPS (Ubuntu). This is similar to my TPoS instructions up to and including step IV. 3. For the sake of completeness, all steps are listed here again in full.

I. Disclaimer
II. Rent a VPS server
III. Set up your VPS server
IV. Install XSN-Core at your VPS
V. Install and start LND
VI. More information

I. Disclaimer

1. This guide only works if the XSN wallet for the local wallet and the VPS wallet has been updated to V1.0.26 or higher. You can get the latest version of the wallet from the link below:
https://github.com/X9Developers/XSN/releases

2. This guide works for almost every Linux distribution on your VPS; for almost any Windows, Linux or iOS on your local PC.

3. You need an SSH Telnet client like PuTTY (you will learn how to set up this putty later in this guide).

4. You need a static IPv4 for each Lightning Node that your VPS hosts (so it must have a constant operating time). If you don’t have a VPS, you can get a VPS at e.g. rent Vultr.

5. The original articles are linked at the bottom, errors are not excluded. If you have any questions, just drop by Discord, Telegram or Twitter.

6. In order to facilitate the understanding of the guide, I have various data here, including private keys, not removed. All IP addresses, private keys, public keys and TXIDs that I used in this manual were created and used only for this manual. They have never been hot and have already been destroyed.

II. Rent a VPS server

Choosing your VPS Provider:

You can purchase your server, otherwise known as a VPS through any VPS provider however; I recommend either of the following:

Vultr:
Vultr is reliable and has a helpful support team should you run into server issues. Your initial deposit will need to be done with a card payment/ PayPal however; after this time, you are able to pay for your servers in bitcoin if this is your desired payment method or you can use the same as your initial payment.

Sign up using the above link and you will receive some free credit to help you run your servers however; you must deposit $10 first.

Evolution Host:

Evolution host is extremely reliable with a friendly customer support team. They will allow you to pay for your servers in XSN should you choose to use this option. They offer either SDD or HDD VPS options, and I have included their comparison below:

Upcloud:
Upcloud is extremely reliable and I have never had an issue of a server going offline for maintenance with them which is an important factor when running a Masternode as any server downtime will impact your earnings and will require you to reset your Masternode. Payment options are Paypal or card.

Sign up using the above link and you will receive $25 free credit to help you run your servers however; you must deposit $10 first.

Once you have signed up and deposit your credit in your VPS hosting account, you will now need to deploy your server.

For the below, I will be showing you how to deploy your server on Vultr for many of the instructions as there is no major difference between Vultr & Upcloud when it comes to deploying a server.

Step 1: Deploy a Server by clicking on the Blue Plus Symbol (Vultr).

Step 1.1: Deploy a Server by using the left-hand menu, Servers -> Deploy a Server (Upcloud). Please note with Upcloud, your first step will be to input a server name i.e. TPoS1 and a short server description TPoS1. With Vultr, this is the last step you do.

Step 2: Choose your server location.

Step 3: Choose your operating system. I recommend Ubuntu 18.04.

Step 4: Choose your server. I recommend using the $5 per month — 1 CPU, 1GB Ram and 25GB SSD.

Step 5: Name your server and press deploy. For this step, you have to scroll all the way down at Vultr, if you don’t do it, you can do it later. I haven’t changed it here, so “root@vultr” will appear afterwards.

Step 6: Wait for the installation to complete, on the next screen, click on your server and then click on Manage and take note of the IP Address, username and password:

First steps: Install PuTTY

This section will tell you how to install a program to run your VPS server, adding a new super user to your VPS, upgrading & updating your VPS, setting up your firewall and so forth.

It might sound daunting, but it will mainly be copy & paste of lines into your VPS.

Step 1) Download and install Putty from the following link: https://www.putty.org/

Step 2) Click on the “download here” link:

Step 3) On the next page, download the correct build for your PC, install it after this.

III. Set up your VPS server

Now it can really start. Note: Copy the italic commands and paste them into PuTTY with a right click.

Step 1: Log into your VPS with PuTTY: root@“yourVPS-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. In the same way, you can simply copy the commands and then paste them with a right-click.

Step 2: Set up a super-do user (here: test1)

Commands:

adduser “your_user_name“

usermod -aG sudo “your_user_name“

Confirm information with “Enter” and answer the question with “Y”.

Step 3: Update and upgrade your VPS

Commands:

apt-get update

apt-get upgrade

Answer questions with y + “Enter”.

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

Answer questions again with y + “Enter”.

Step 5: Create a swapfile

Commands:

fallocate -l 5G /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 command /swapfile non swap sw 0 0. To save your modifications, press ctrl+x, followed by y and Enter.

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

Command:

reboot

You have to restart your PuTTY as well.

Step 9: Login your VPS with your superuser-name

IV. Install XSN-core at your VPS

Step 1: Create an empty directory and download the wallet

cd ~

mkdir xsncore

cd xsncore/

wget https://github_download_link

(Right now you should use this: https://github.com/X9Developers/XSN/releases/download/v1.0.26/xsn-1.0.26-x86_64-linux-gnu.tar.gz)

Step 2: Unzip the downloaded files

tar xfvz xsn-1.0.26-x86_64-linux-gnu.tar.gz

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

mkdir ~/.xsncore

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

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

chmod 777 ~/.xsncore/xsn*

rm xsn-1.0.26-x86_64-linux-gnu.tar.gz

rm -r xsn-1.0.26/

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

Step 4: Start the wallet

Commands:

~/.xsncore/xsnd

After a few seconds (if the “rattling” lines are very similar), stop the process with: Ctrl + C

Step 5: Edit your .conf file

Command:

nano ~/.xsncore/xsn.conf

Now insert the following data:

rpcuser=yourname
rpcpassword=
yourpassword
rpcallowip=127.0.0.1
listen=1
server=1
daemon=1
maxconnections=264
zmqpubrawblock=tcp://127.0.0.1:28332
zmqpubrawtx=tcp://127.0.0.1:28333
txindex=1

Note: Adjust your name and password here.
After entering, press Ctrl + X, “Y” and Enter. After that:

~/.xsncore/xsnd

Now your wallet starts, it may take a while until the synchronization is complete. With the command~/.xsncore/xsn-cli getblockchaininfo you can check the progress of the synchronization.

As soon as the numbers of the blocks = headers match, your VPS is completely synchronized.

6. Schritt: Install libzmq3 and lightning-client

Commands:

sudo apt-get install libzmq3-dev

wget https://github.com/X9Developers/DexAPI/releases/download/v2020.01.26/lncli

chmod +x lncli

Enter your password in between and answer the question with “Y”.

V. Installiere und starte LND

1. Schritt: Install LND

Commands:

wget https://github.com/X9Developers/DexAPI/releases/download/latest/lnds_0.8.2.5.zip

unzip lnds_0.8.2.5.zip

chmod +x lnd_xsn

rm lnds_0.8.2.5.zip

mkdir .cli

mv lnd_btc .cli

mv lnd_ltc .cli

./lnd_xsn

cd .lnd

Step 2: Add information about your node in lnd.conf
Note: You can also give your node a name and a color, then it will be easier for you to recognize it. Whereby alias is the name that everyone in the network then sees and at color you can use an HTML color code with a certain HEX value, see here:

alias=your-node-name
color=
#324ea8

Command:

nano lnd.conf

Now insert the following data (if necessary, open Putty on full screen view to check that everything is entered correctly):

alias=your-node-name
color=your-HEX-value

noseedbackup=0
rpclisten=localhost:10003
listen=0.0.0.0:8403
restlisten=127.0.0.1:8083
nobootstrap=1
xsncoin.active=1
xsncoin.mainnet=1
xsncoin.defaultchanconfs=6
xsncoin.node=xsnd
xsnd.rpcuser=yourname
xsnd.rpcpass=yourpassword

xsnd.zmqpubrawblock=tcp://127.0.0.1:28332
xsnd.zmqpubrawtx=tcp://127.0.0.1:28333
debuglevel=debug
maxpendingchannels=50
chan-enable-timeout=1m
max-cltv-expiry=10080
maxlogfiles=10

The broad print must be adjusted again (note: here I used Test101 and chem2020 from step V 5.). After entering, press Ctrl + X, “Y” and Enter.

Step 3:

Commands:

cd

mv lnd_xsn .lnd

mv lncli .lnd

cd .lnd

Step 4: Open a second command line connection by logging into Putty as before with Username@IP. We call this #Putty2 from now on. Then go back to #Putty1:

Putty 1:

cd .lnd

./lnd_xsn — rpclisten=localhost:10003

Putty 2:

cd .lnd

./lncli -rpcserver=localhost:10003 create

Now enter a new password twice, answer the question with “n” and then enter the same password again twice. Make a note of the password and the seed, this is very important.

Step 5: Unlock your LND

Putty 1:

Strg C

./lnd_xsn --rpclisten=localhost:10003 --no-macaroons

Putty 2:

./lncli -rpcserver=localhost:10003 unlock

Now enter the password you just generated. Now “lnd successfully unlocked” should be there.

Putty 1:

Strg C

cd /etc/systemd/system/

sudo nano lnd_xsn.service

Confirm the password, adjust the broad printed, and then add the following:

[Unit]
Description=lnd_xsn service
[Service]
Type=simple
Restart=on-failure
RestartSec=1
User=
yourname
ExecStart=/usr/bin/env /home/
yourname/.lnd/lnd_xsn --no-macaroons
WorkingDirectory=/home/
yourname/.lnd
[Install]
WantedBy=multi-user.target

Save it with Ctrl + X, then Y and Enter. Then enter, broadly printed again appropriately changed:

cd /home/yourname/.lnd

sudo nano ~/.bashrc

Now go all the way down and then add (the three lines are one command):

function lnxsn() {
~/.lnd/lncli -rpcserver=localhost:10003 --no-macaroons $1 $2 $3 $4
}

Press Strg + x, Y and Enter. After this:

systemctl start lnd_xsn

Now enter your password for your username.

systemctl status lnd_xsn

Strg +c

Note: You can now start / stop / status lnd_xsn with the system commands:
systemctl start lnd_xsn
systemctl stop lnd_xsn
systemctl status lnd_xsn

Step 6: Now you may have to unlock your lncli at Putty 1 with the command: lnxsn unlock, then enter your wallet password here. You should also only enter all of the following commands in Putty 1.

You can then connect to Stakenet’s HubPeers. The current commands for this are (copy and paste all three lines unchanged):

Hub 1:

lnxsn connect 0396ca2f7cec03d3d179464acd57b4e6eabebb5f201705fa56e83363e3ccc622bb@134.209.164.91:11384

Hub 2:

lnxsn connect 03bc3a97ffad197796fc2ea99fc63131b2fd6158992f174860c696af9f215b5cf1@134.209.164.91:21384

Tip: With the following command you can check whether the connection to the HubPeers worked:

lnxsn listpeers

It should be sync_type = “Active_Sync”.

Step 7: Now load your wallet with XSN:

With the command: lnxsn newaddress p2wkh you get a new own XSN address in bench32 format. Then you can transfer XSN to your new address.

This is my own address only for this guide, please don’t send an XSN there, use your own address!

You can do this in the wallet tab of your Stakenet Multicurrency Light Wallet or from your XSN Core Wallet.

Step 8: Now open the channels to the hubs (in this example 1 XSN per hub) and load the channels with an XSN each.

Commands for Hub 1 (is an entire command, so copy and enter the three lines as one):

lnxsn openchannel --node_key=0396ca2f7cec03d3d179464acd57b4e6eabebb5f201705fa56e83363e3ccc622bb --local_amt=100000000

Hub 2:

lnxsn openchannel --node_key=03bc3a97ffad197796fc2ea99fc63131b2fd6158992f174860c696af9f215b5cf1 --local_amt=100000000

Note: The amount local_amt is calculated in Satoshi, where local_amt = 100000000 = 1XSN. You can control channels whose Txids do not yet have 6 confirmations with: lnxsn pendingchannels, for confirmed channels use: lnxsn listchannels.

Congratulations, you’ve now created your first XSN Lightning Node! This is really a great achievement, you actively help building the Lightning Network infrastructure. If you have any questions or problems, the best thing to do is to visit the Discord.

VI. More information:

1. If you want to close your channels:
lnxsn closechannel <fundingTXid> <output>

This information can easily be found with the command lnxsn listchannels under “channel_point”: “fundingTxId: output”. Here in my example this is:

After this enter the following command:

Make sure there is always a space in between (like here)

2. After the transaction is confirmed, you can send your XSN back to your local wallet or to the Multicurrency Light Wallet with the following command:

lnxsn sendcoins yourXSN_adress local_amt

Note: The amount local_amt is again calculated in Satoshi, where local_amt = 100000000 = 1XSN.

If you really want to transfer everything from the LN wallet:
lnxsn sendcoins — sweepall yourXSN_adress 0

With the command lnxsn walletbalance you can check your wallet balance.

More commands: lnxsn help

You can find an overview about XSN Lightning Nodes here: https://ln.stakenet.info/

At this point, many thanks to Winnie and especially to DeFreiherr, who created the basis for this guide! If you want to support Stakenet and us: All XSN collected will be used as liquidity in LN channels for the DEX:

XSN-Adresse:

7Szf8QtzTzsdemKjR4No1gC8cV31nUbDde

// Disclaimer: All rights are owned by Stakenet and the author: Jonathan Park //

--

--

hydranet I German

/ Deutscher Stakenet-Medium Account. Alle Rechte liegen bei Stakenet und den Autoren. Deutsche Versionen: Jonathan Park. https://medium.com/@stakenet.platform /