How to Set up A Home Server and Use It as a Bitcoin Node?

If you have ever wanted to have storage for your files with access to them from any location through an internet connection, it is very easy to achieve through the use of a home server. A home server can be used to host programs you run or a web page. It can also be used to store files like music and photos and have anyone with access to download them at their own convenience.
Table of Content
1 . Steps in Setting up A Home Server
3. Setting Up Your Own Bitcoin Node
Setting up a home server is pretty easy and requires amongst other things a dedicated computer and a form of remote access so you can alter settings even from a distance. Bear in mind that the computer you intend using doesn’t have to be a really great system. A simple system will do but know that the more you intend to run on it, the faster it needs to be.
Steps in Setting up A Home Server
#1 Get a Dedicated Computer
The idea of getting a dedicated PC is to prevent other programs from running and complicating issues. So the first thing to get is a PC that you don’t use so you can set it up and keep it running at all times. It doesn’t have to be the best computer, neither does it have to be great since it is going to be a home server. But if you plan on running multiple and huge tasks on it, you may need to up your specs so your computer doesn’t lag.
#2 Get the Server OS
In choosing a server OS, you need to go for one that is well known for its great performance and one such is Ubuntu Linux. If you are a newbie, you may find the server version of Linux confusing and so it’s better to make use of the desktop version. The desktop version is also good enough to run a server just that it saves you from the stress of server configuration using terminal commands.
The version of Linux you will use depends on the PC you have. If you are using a 64 bit PC for example, you will need a Linux 64 version. The following are 64-bit chipsets you can use:
- AMD Athlon64
- AMD Athlon64 X2
- AMD Turion64
- AMD Turion64 X2
- AMD Sempron64
- Intel Core 2
- Intel Core 2 Duo
- Intel Core 2 Quad
Using a Linux 64 version with a 32 bit PC won’t work and so for your 32-bit computer, you will need a 32-bit version of Linux. The following are common 32 bit CPUs:
- AMD Athlon
- AMD AthlonXP
- AMD Sempron
- AMD Duron
- Intel Pentium 1/2/3/4/M/D
- Intel Celeron
After getting the right version of Linux for your PC and downloading it, burn the .iso file unto a blank CD.
#3 Install Server OS
To install the OS on your PC, put in the CD containing the downloaded file into your PC and your PC will take you to the Ubuntu CD screen. Select your preferred language and select the first option on the menu that pops up (it is usually Test or LiveCD). It will load and you will be launched to Ubuntu desktop. This is the step to use the desktop version of Linux.
If you choose to have both Windows and Linux running on the same PC, you will have to partition your screen and resize windows so you can have some space for Linux. To do this, go to system -> Administration -> Partition Editor. After resizing and applying the change, double click on the install icon on the desktop and follow the guide pop-ups. Select “use largest continuous free space” as the location of choice for installation.
Interesting Read : Bitcoin in 2017, but 2018 is the year of Ethereum
After installation is complete, reboot your PC. You should see a black screen with a menu listing all OS on your system when your system comes on. Select Ubuntu and hit enter.
#4 Setup VNC
After installing the server OS, it is now time to provide remote access to your server. Remote access will permit connection to your server from another PC through internet access and you can see the server’s screen. Remote access also allows you to have control of the mouse and keyboard of the server using the remote PC.
Go to: System -> Preferences -> Remote Desktop
Once there, check:
‘Allow other users to view your desktop’
‘Require the user to enter this password’
‘Allow other users to control your desktop’
Then type in a password in the required field and this password must be entered on a remote PC before you can have access to the server.
#5 Have FTP Installed
FTP stands for File Transfer Protocol and is used to upload and also download files to and from your server. It is like having a folder on the internet with access to upload and download the content.
In this guide, we will make use of Pro FTP Daemon which is a Linux program that can run the FTP server on your home server. To make the whole process easy and eliminate the need for you to edit text files ad use terminal codes, we will use gproftpd (a graphical frontend GUI).
The first thing to do is to open a terminal
Applications -> Accessories -> Terminal
Once you have it opened, type in the following:
Sudo apt-get install proftpd
Hit enter and you will be asked to input password. Use the password you set up during installation and click on enter. The password won’t be hidden behind asterisk so do not worry if you see it showing in plain text. This will take your further through other requests including asking you to press Y or N for installation. Press Y.
After you are through with this, type the following at the @ line:
Sudo apt-get install gproftpd
And press enter. You won’t be asked for a password this time but if it does, input password again.
#6 Configuring FTP Users
To do this, go to System -> Administration -> GPROFTPD and input password if you are asked to do so. A GPROFTDP window will pop up and you need to set it up if not your server won’t be activated.
Go to the Users tab and from there, fill in the required information. The information you give will be used to create an account for you and the whole process is fairly easy and straightforward.
#7 Configure and Activate FTP Server
Here is the part where you get to put up your FTP server and have it available on the internet. You will need to go back to the servers tab and make some adjustments.
Server’s IP address or hostname: we would advise that you leave this set at 0.0.0.0. This implies that its location will be automatically detected and configured.
Alternative server identity: this is optional and used to give your server a name by changing the box to on.
Use identity/reverse lookups: leaving this either on or off has no effect on your server.
Time standard: stick to local time
Port: the standard FTP port is 21 and unless you know what you are doing, leave it here.
Configure NAT routing: you do not necessarily have to turn this on but if you wish, set it to your router’s IP.
The administrator’s email address: since you are the server’s admin, you need to put in your email here.
Maximum login tries: this is for the maximum number of wrong password attempts allowed.
Upload speed: it is better to set this parameter higher than the maximum speed of your network connection to the server. Doing this will ensure that your server remains fast.
Download speed: also set your download speed to be higher than the network speed so as to prevent the slow transfer of data.
Passive port range: leave this option set at default
Maximum connections: leave this also at default. It is the number of connections you will allow to your server.
Auto removes aborted uploads: turning this on means that a canceled upload halfway prevents you from getting a half file on your server.
After this configuration, click Apply to save the changes made. Then click on activate to activate your server and you are online but only on your LAN for now.
#8 Install HTTP Support
Setting up and installing HTTP support is pretty easy. All you have to do is type this in the terminal:
Sudo apt-get install apache2
And then press enter. Type a password and hit Y if asked and your HTTP server is running at this point.
#9 Forward the Ports
It is most likely that your home server PC is connected to a LAN with a router connecting it to the internet and so your PC’s IP address only works within your local network. This is to say that only computers connected to your router can communicate with your server. To enable communication between your server and the internet for easy access, your router needs to permit your server and then the internet to have a communication. Your router and the internet exchange signals normally and these signals would be passed on to your PC. If the PC is to be used for browsing this isn’t a problem, but as a server, it needs direct communication to be efficient.
To get this direct communication up, the ports need to be adjusted. Ports are channels of communication for different programs and some common ports examples include:
80 – HTTP
29070 – Jedi Academy
21 – FTP
5900 – VNC
And a whole lot more. You need to have a port on your internet IP address so you can be connected to the port on your server’s local IP address directly.
To get this done, you need to first know the router’s admin username and password and then open the router’s settings page. Common addresses for a router’s page are http://192.168.1.1, http://192.168.0.1, http://192.168.2.1 and some others. If you can’t connect using any of these addresses, check out your router’s instruction manual or search for it on google.
Once you are in your router’s settings page, look out for port forwarding. Get the local IP of the server PC by clicking on the networking icon on the screen and selecting Connection Information. Now add the following to the setting in the format; “name” – TCP/UDP – start port – end port – 192.168.x.x (replace with your server’s address):
“VNC” – TCP – 5800 – 192.168.x.x
“FTP” – TCP/UDP – 21 – 21 – 192.168.x.x
“HTTP” – TCP – 80 – 80 – 192.168.x.x
After you add these settings and apply them, your server will be online.
#10 Make Use of a Domain
Making use of your server’s IP address is not easy as it is long and somewhat boring. Your friends may not want to sign in to your server for any reason just because of this and so you have to make it interesting. You need to use a domain.
A domain is an alternative way of using your IP address to reach your server. Every website has an IP address but we don’t use those, we use the web address instead and this is because the domain has masked the IP address. The domain links to your server’s IP address and sends requests to it so you can connect to it without using the IP address.
Interesting Read : What Are Bitcoins Worth Today?
You can make use of .com domains but they will cost you some money to register. You can also host on a free domain but the address will now look like <site>.servegame.com or something else but following this format. The name format is the major issue with using free domains and apart from this, free domains are also very efficient.
To make use of a domain you will need to know your IP. You can find this on google as there are a lot of sites that can help you with that.
#11 Test It
At this point, you have configured everything and you should be online if everything is done properly. Testing out your server is the only way to be sure everything works.
To test HTTP, open your browser and go to http://<your no-IP domain.com. if all is well, “it works” is the message you will get. If that doesn’t work use a different method. Go to http://<internet IP>. Do not start with www. Or end with .com. if this also doesn’t work, go to http://<local IP> and just like before, no www. Or .com. if none of these work then it means your server isn’t working.
Next, you will test FTP. To do this, open windows explorer and type in ftp://<your no-ip domain>.com. this will lead you to put in your username and password and your folders should be visible to you. Try uploading a file and if it doesn’t work, go to the GPROFTPD’s user page. If it still doesn’t work, enter the above address but keep out the ftp://
You’ll have to test VNC next and you’ll need a VNC viewer for this. Good examples of viewers you can use are TightVNC and UltraVNC. In the place of your VNC address, put in your do-ip domain and end with .com. do not add http:// or www. Or ftp://. After you do this, you will be asked to input your password and after providing the required information, your server PC’s screen should appear on your PC’s screen.
You can also set up your home server using command line interphase, or CLI, and an SSH client by following this guide.
Having set your home server, you can use it to serve a lot of purposes including storage of personal files, hosting a personal website, make your own VPN, to use securedrop, create your own chat server, have your own email server, lightning node, set up a bitcoin node, and also run a Tor node.
What Is A Bitcoin Node?
Nodes are part of a crypto currency’s network and are essential to keep it running. It is a computer in connection with other computers that follow set programs and share data with each other. You can imagine bitcoin nodes to be guardians of the cryptocurrency as they monitor the bitcoin blockchain to detect and distinguish legit Bitcoin transactions from illegitimate ones. They primarily exist to prevent double-spending of bitcoins. That is to say, once bitcoins have been spent elsewhere, nodes prevents it from being spent again.
Setting Up Your Own Bitcoin Node
This guide on setting up your bitcoin node takes you on a step by step procedure and includes a full node, Tor support, lightening, IOS wallet, and Zap Desktop, BTCpay Server and ejabberd. This guide is based on the assumption that you have set up your home server using this guide.
Step 1: Add a Server Volume
The first thing to do here is to get your server ready for bitcoin mining. Check your lunanode panel and on the left side, you will find volumes. Select and click “manage” and “attach to VM”. Make sure there are no mistakes in attaching to the virtual machine. If you made a purchase of additional storage, make use of that one.
Leave the default disk driver at “virtio”
From your logged in terminal, run the command sudo fdiak –l so as to confirm the volume name. It is likely that the volume name will be /dev/vdc.
You can attach the volume to your server permanently by becoming a superuser. You can do this by running the command sudo –i
This then changes the username to root@torontola and the following commands can now be run without the use of sudo:
Mkfs.ext4 /dev/vdc (it formats the empty drive)
mkdir /media/bitcoin (this command creates a mount point)
Mount /dev/vdc /media/bitcoin (this command mounts the device at the mount point)
Echo ‘/dev/vdc /media/bitcoin ext4 defaults 0 2’ >> /etc/fstab (this command makes the mount point to be permanent)
Chown –R Ubuntu /media/bitcoin (this allows you the ability to write data on the drive as the default Ubuntu user)
Exit (this command takes you back to your regular user.
And with this, your server is now ready to become a bitcoin node.
Step 2: Install and Configure Bitcoind
Before you get on this step you need to log in to your server or remain logged in if you are already logged in.
The first thing to do is the installation of Bitcoind and to do this you need to first add the Bitcoin repository:
Sudo add-apt-repository
Ppa:bitcoin/bitcoin
Confirm selection and update package manager with the following command: sudo apt update
Then install Bitcoind using the command sudo apt install bitcoind
The next thing to do is to configure Bitcoind and you will need to create a simple configuration file. Begin by syncing bitcoin into the added volume from the beginning. This will also need an additional line to the config file. In addition, you may also want to prune (limit the blockchain size by keeping only recent blocks saved on the disc). Doing this allows you to save more disc space and cost. Use the following command to create a bitcoin directory: mkdir .bitcoin
Then create a config file using the following command: nano~/.bitcoin/bitcoin.conf
Having done this, copy and paste the following command into it:
Datadir=/media/bitcoin
Daemon=1
Prune=70000
Use ctrl+0 to save the file and use ctrl+x to close the window
Start Bitcoind
Use the command bitcoind to start Bitcoind. This should be followed by the response “bitcoin server starting.” If you want to see the activity of your bitcoin node, run the following command: tail –f/media/bitcoin/debug. Log
You can open and keep a new SSH window if you like. It has the advantage of allowing you to have an easy overview of everything. If you want to exit the window however, press and hold at the same time keys ctrl + c.
Check Up Your Computer Status
Use the following command to check the health of your node: bitcoin-cli –getinfo
In the image below you will see that a good number of blocks (388,343 of ~566,000) have been synced and connected to 16 peers.
Running the command top will always give you information on the number of resources that are being consumed. It might also be useful to check if a process is still running in the background. In the image below you will see that Bitcoind is running and consuming memory but little CPU.
Syncing bitcoin takes time and so you can pause here and check back later with the following command: bitcoin-cli –getinfo. You can alternatively observe the logs with the following command: tail –f/media/bitcoin/debug. Log
Open Ports
Open ports are optional but are helpful to the network by creating more space for other users to connect. You can allow incoming connections to your bitcoin node using the following command: sudo ufw allow 8333/tcp
Buy More CPU Time
Buying more CPU time is also optional but will reduce the stress on your CPU when syncing your node for the first time as it is usually CPU intensive. From your lunanode admin panel, select ‘Virtual Machines’, click on your server and then on ‘CPU’.
Under “pay for CPU utilization above baseline performance?’ change the option from ‘No’ to ‘Yes’. It shouldn’t cost more than $4 to completely sync your bitcoin node.
Step 3: Download and Install Go
To download Go code, make use of the following command: wget https://dl.google.com/go/go1.11.5.Linux-amd64.tar.gz
To check that the data is correct, type the following command: sha256sum gol.11.5. Linux-amd64.tar.gz |awk –F “ “ ‘{ print $1 }’
Typing and executing the above command shows the SHA256 hash of the downloaded data. You should expect something like this: ff54aafedff961eb94792487e827515da683d61a5f9482f668008832631e5d25
Install Go
Once downloaded you will see that the file comes compressed just like a zip file. Unpack Go into the home directory with the following command: tar –C ~/-xzf go1.11.5.Linux-amd64.tar.gz
You can copy it to a more appropriate location using the following command: sudo mv ~/go /usr/local
The next step is to specify the location of the Go code to the server. It is different in different machines but in this case, it is:
Export GOROOT=/usr/local/go
Export GOPATH=$HOME/go
Export
PATH=$GOPATH/bin:$GOROOT/bin:$PATH
To make the changes permanent, add the lines to .bashrc file. Use the command nano~/.bashrc to open the file and then scroll to the bottom and paste it there. Save and close by pressing the ctrl+0 and ctrl+X buttons
Type go version to be sure that Go is installed properly and what you should expect is go version go1.11.5linux/amd64
Step 4: Download and Install lnd
Before the download and installation of lnd, there are a few things to be done. Firstly, you should run this command: sudo apt-get install –y build essential. You can proceed after this if Git is installed but if not, install it using sudo apt install git.
Download the code go get –d github.com/lightningnetwork/lnd to install Ind.
Use the following command to get into the directory of lnd:
Cd
~/go/src/github.com/lightningnetwork/lnd
It is advisable to make use of the latest release of lnd rather than updating to the latest code. Check here for the latest release.
The version we are making use of here for this guide is version v0.5.2-beta. Using the following command, we can check out this version:
Git fetch –tags
Git checkout v0.5.2-beta
Now you can install lnd using the following command:
Make && make install
You can go from here to the home folder with cd ~/
Confirm that lnd Is Properly Installed
To check if lnd is installed, type lnd –version and lnci –version.
What you should get is version 0.5.2-beta
Commit=v0.5.2-beta
Configure lnd
First, make a config file for lnd and make a directory using the command mkdir ~/. lnd
Edit it using the following command: nano ~/. Lnd/lnd.conf
Fill in the blue fields using your own information and you can choose a name and color for your node.
Your IP address can be found on the dashboard of lunanode if you are using it for your server.
The next step will require a username and password. Do not include special characters to make it easier for you.
# [Application Options]
Alias=< name of your node >
Color+< your favorite color in hex >
# [Bitcoin]
Bitcoin.active=1
Bitcoin.mainnet=1
Bitcoin.node=bitcoind
Bitcoind.rpchost=127.0.0.1
Bitcoind.rpcuser=< your username >
Bitcoind.rpcpass=< your password >
Bitcoind.zmqpubrawblock=tcp://127.0.0.1:28332
Bitcoind.zmqpubrawtx=tcp://127.0.0.1:28333
# [LND]
Externalip=< your ip >
Bitcoind Configuration
Some adjustments need to be made to Bitcoind so the config file will be opened with the following command: nano ~/.bitcoin/bitcoin.conf
Add the following to the file:
Rpcuser=< your username >
Rpcpassword=< your password >
Zmqpubrawblock=tcp://127.0.0.1:28332
Zmqpubrawtx=tcp://127.0.0.1:28333
Having done that, save the file with ctrl+O and close with ctrl+X. restart bitcoind using sudo service bitcoind restart.
Step 5: Launch lnd And Create a Wallet
Before you launch or do anything in this step, check and be sure that Bitcoind is synced completely and ready. Use the following command to check this: bitcoin-cli –getinfo. Compare the value of blocks seen with that of a block explorer.
What you should see is a block height displayed that is the same as that from your command. If the number of blocks shown by the block explorer is still larger, then syncing is not yet complete.
To see the logs and find out when the last block was created and the progress of the ongoing sync, use command tail –f /media/bitcoin/debug.log.
Now launch lnd
To launch lnd, type lnd into the terminal or you type ~/go/bin/lnd.
The result you get should look like the image above. If you get an error message instead, make sure bitcoin is running in the background or go back to the step from where the error message is coming from. Check that all config files are correct.
If you get a satisfactory result like the one above, close lnd with ctrl+c. have lnd running in the background permanently with lnd &>/dev/null. To further ensure that the task is still on, type disown.
Create a Wallet
With lnd running in the background, launch the command: lncli create
Follow by entering a wallet password and then press ENTER.
You’ll be asked if you have an existing cipher seed mnemonic. Since this lightning node is new, select n.
You can choose to encrypt your cipher seeds and this is a particularly good move if they are stored in an easily accessible location but do not forget the encryption key.
In the image below, the cipher seed is blacked out
Unlock Wallet
If you created a new wallet, it shouldn’t be locked but if there was an error while you were restarting lnd, you will need to unlock your wallet yourself. You can do this with the following command: lncli unlock
If you are starting lnd for the first time, you will need to sync it.
Step 6: Open a Channel
Before you open a channel, there are some prerequisites that have to be attended to. For starters, you need to ensure that lnd is up, running and fully synced. Use the following command to get the process started: lncli getinfo. Doing this should give the following response; synced to chain: true. If it is not synced, then you have to fix it and ensure that bitcoind is running and also synced. A way in which you can check this is by running bitcoin-cli –getinfo and then compare the height of your node with that of a block explorer. Check the logs to confirm that bitcoind and lnd are running with the following commands respectively: tail –f/media/Ubuntu/bitcoin/debug.log and tail –f ~/.lnd/lnd.log.
Pay In Money into Your Node
Use the following command to create a new address: lncli newaddress p2wkh. What you get should be something like bc1…
With that result, you can now send bitcoin to the address. This is easy and all you have to do is copy and paste the address into your bitcoin wallet. If for a reason your bitcoin wallet cannot send money to the address because of the format (bc1…) you may then generate another address called a legacy address by beginning with “3” using the following command: lncli newaddress np2wkh
You can check your balance after funding using the command: lncli walletbalance. Using this command to check your balance will display both your confirmed and unconfirmed balance in Satoshi (1 Bitcoin = 100 million Satoshi).
Connect To a Node
This step will take you through all you need to know to connect to a node. You can also choose a node from amongst those listed here. If you are using a lightening node, its URL looks like this: 0331f80652fb840239df8dc99205792bba2e559a05469915804c08420230e23c7c@74.108.13.152:9735
The url contains the node’s public key arranged before the @ sign and then the IP or domain name (whichever is used) and then the port. You can connect to the node with the following command: lncli connect
[0331f80652fb840239df8dc99205792bba2e559a05469915804c08420230e23c7c@74.108.13.152:9735]
If the connection is successful, the result should be an empty open and close bracket without any error message.
Open a Channel
After you have made the deposit and it has been confirmed on the Bitcoin Blockchain, it is time to open a channel. You can open the channel while the node is connected using the above step, but it is better for you to connect to a variety of nodes. You can also open channels using more than one node.
In this guide, we will open a channel using the following command:
Lncli open channel
0331f80652fb840239df8dc99205792bba2e559a05469915804c08420230e23c7c 200000
The long string in the code that begins with 0331 is the public key of the other node, and 200000 represents the intended amount to be put into this channel using Satoshi denomination.
After a successful channel opening, you will get a transaction for funding. Your channel will become open and active once the transaction is open and active on Blockchain but will remain under pending channels before then.
On average it takes three confirmations before your channel becomes active.
Make Payment
In order to make payment successfully, you will need to have money in channels with other nodes (outgoing liquidity). This is done by depositing bitcoin into your node and then open channels with the network. Normally, the channels are in direct link with the other parties you are transacting with, or with well-connected nodes in the network. Use this command to check for your node: lncli getinfo.
Ensure that your node is always synced to the chain and that at least one of your channels is active at all times.
The following is an example of what a lightening invoice should look like
lnbc10u1pwfxg42pp553wyha3ag66tn40zls69eeaeq0cyluj6ja54sygp7vh50gcy0rnsdqlxycrqvpqwdshgueqvfjhggr0dcsry7qcqzysyrmxj0554vrg4ej2we83m8n7rxj94s8c5a8rwjud07ptc6dw7j2hr42sxt7lnazglku3pfe9jkl8f0gupkuz7jly5xnq35qr202jwwqqy8qs9a
Use the following command to decode it: lncli decodepayreq [lightning invoice]
The result from the command will show the payment amount, the destination of payment, and then the date of the expiration of the invoice.
The following command will allow you to make payment: lncli payinvoice [lightning invoice]
After the amount and destination of payment have been confirmed, the node will begin the process of making payment. Once it is done and successful, you will receive payment information like hops and fees.
Receive Payment
You will need incoming liquidity for you to be able to receive payments. As your node continues to stay online, others will open channels with you or you could encourage them to do so. You get to free up incoming liquidity each time you make a payment through your channel. An example of this is when you make a deposit of $20 into your node and you open a channel, making a payment of $2 will mean that you can now have an equivalent of $2 in incoming capacity.
Before you receive payment, you need to generate an invoice. It follows the following format:
Lncli addinvoice-memo “a memo” –amt –expiry < expiry time in seconds >
In the following example, the command is for an invoice for 90,000 Satoshi equivalent of 1 bitcoin valid for an hour:
Lncli addinvoice –memo “for VPN services” –amt 90000 –expiry 3600
The result you will get after the command will have a r_hash, an ass_index, and a pay_req. the pay_req is the invoice that we can pass on.
Check Payments Status
Using the command below you can see the invoices issued and their status:
Lncli listinvoices
In the image below, you can see that the issues invoice has not been paid (settled is set to false)
Step 7: Useful Commands With lnd
The most useful command you will need in lnd is lncli help. This command lists out all the available commands so you can begin a process from there. For additional information on each command, add “help” and you will get a list of all the commands related to your query. An example is in the creation of an invoice with the command lncli addinvoice help. The command will show you a list of all the available options you may need when creating an invoice. Other useful commands include:
- Lncli getnetworkinfo is a command that shows you the scope of the lightning network from your perspective
- Lncli channelbalance is a command that shows you your available balance in channels
- Lncli connect is a command that comes in handy when a payment channel goes offline or is inactive. It connects to the peer or you can revive the connection manually
- Lncli getinfo is a command that shows you the basic information you need about your node.
- Lncli walletbalance is a command that shows you’re your available balance on the chain
- Lncli feereport is a command that shows the amount earned from routing payments
- Lncli listchannels is a command that shows you all your channels that are currently open and their status too.
Step 8: Connect Zap Desktop (Alternative)
Zap is an interface for a lightning node that can run on your computer. It is easy to connect to lightning if you are running it on your computer, but if your node is in the cloud, you will need to go the extra mile.
To connect to Zap, you will need full sync of both your Bitcoind and lnd node. To check for the sync status, use the following command: lncli getinfo. The result you should get if it is synced is “synced to chain: true.”
In a scenario where there are not synced, make sure to sync Bitcoind and have it running by checking the log using tail –f /media/bitcoin/debug.log or bitcoin-cli –getinfo. You then compare the block height from the log with another node or you check a block explorer.
Download Zap
You can download Zap for your desktop here and be sure to download the right version for your OS. This is the right version for windows is:
Zapdesktop-win32-v0.4.1-beta.exe which corresponds to our sample version of v0.4.1 beta for this guide.
Amend lnd.conf by opening the config file using the following command: nano ~/.lnd.conf and then you amend the following lines:
Rpclisten=0.0.0.0:10009
Tlsextraip=< your IP address >
Then use ctrl+0 and ctrl+X to close the file.
To effect the changes you have made you will need to restart lnd. Stop lnd with lncli stop and wait for a moment before starting again. If you have open logs, you can know when lnd has shut down completely.
Delete tls Key and Cert
If the changes you made to the configuration file affects the tls key and cert, you will need to delete them and restart. To delete the certificate and key, use the following commands:
Rm ~/.lnd/tls.cert and rm ~/. Lnd/tls.key
To restart, run the following command: lnd &>/dev/null and disown
Open Firewall
To use Zap you have to make connections to your lightning node. The firewall can be opened using sudo ufw enable 10009/tcp
Copy over the TLS Cert and Macaroon
To authenticate both the server and the app, you will need to copy some files as shown below. Zap will confirm that the TLS key is correct so that it can always be connected to the correct server. To be sure of the right TLS key, you will need to let Zap know the certificate.
For Windows
With the following command open a PowerShell: scp ubuntu@< your nodes ip >:!/. lnd/tls.cert
And copy the tls cert to desktop with this command C:\Users\YourUserName\Desktop\
Use the following command to copy the macaroon: scp ubuntu@< your nodes ip
>:~/.lnd/data/chain/bitcoin/mainnet/admin.macaroon
C:\Users\YourUserName\Desktop\
You can make use of file explorer and copy it into any folder if you choose.
For Mac or Linux
Use the following command to copy the tls certificate after opening a new terminal: scp ubuntu@< your nodes ip >:!/ . lnd/tls.cert ~/Desktop
Copy the macroon using the following command: scp ubuntu@< your nodes ip >:~/.lnd/data/chain/bitcoin/mainnet/admin.macroon ~/Desktop.
If you want, you can copy it into any folder using files or finder.
Configure Zap
You can open Zap by looking for it in applications, or by clicking on the file you downloaded earlier. Choose the ‘connect your own node’ option on the startup screen.
Enter your IP address next and the path to the certificate.
Windows
It may look like this:
192.168.1.21:10009
C:\Users\YourUserName\Desktop\tls.cert
C:Users\YourUserName\Desktop\admin.macaroon
For Mac or Linux
It may look like this:
192.168.1.21.10009
~/Desktop/tls.cert
~/Desktop/admin.macaroon
Login
After you click on next and confirm your selection, you will be logged into your node. From there you can see your balance and recent transactions.
Connect Zap IOS (Alternative)
Zap is an interface that is still in alpha and can be used for your lightning node. If you want to be a tester you can go here. It can be used for remote connections, to open channels, check funds, and make or receive payments.
After you have followed the link and joined as a tester, download the app and install it using testflight by apple for downloading and testing software. You will then find it on your home screen like a regular app.
Lndconnect Download
For the app and server to be authenticated, you will need to pass the date from your server to your phone. While we were connecting Zap on desktop two files had to be copied but that process won’t be possible using a phone. The step here will involve a tool called lndconnect and it will generate the needed QR code. To download lndconnect, use the following command: go get –d github.com/LN-Zap/lndconnect
Install and Run Lndconnect
Before installing lndconnect, you will have to move it to the directory using the following command: cd ~/go/src/github.com/LN-Zap/lndconnect.
Use the following command to install the program: make && make install
To make the QR code appear, type lndconnect in the terminal. If you need to zoom out and enlarge the window at this point, use this command ctrl++
Connect Zap
Open the zap app on your phone and click on the option to scan and then scan the QR code. From there you can see your balance, manage channels, and make and receive payments.
Step 9: Bitcoind Configuration over Tor (Optional)
What everyone wants at the end of the day is to have bitcoin transactions that are not monitored. It is everyone’s desire to maintain a high level of privacy away from the eyes of the government or internet service provider.
Apart from being monitored by the government and other legal bodies, having great privacy also keeps you from the prying eyes of criminals with the intent of stealing. So if your bitcoin nodes can’t be found, it can’t be tampered with.
Install and Configure Tor
To install Tor run the following command: sudo apt install tor
To configure Tor, you have to first pass all bitcoin transactions through the Tor network and allow incoming payments only through a hidden service. You will need to create a password and its hash to do this and your password manager will help you create a password by generating a 30+ character password. It will be a random one with a combination of upper and lower case letters and numbers too. Paste this password in the notepad but do not save it.
Create the password’s hash with the Tor command: tor –hash-password “yourpassword”
Also, paste the result in the notepad but do not save.
Now open Tor config file with the following command: sudo nano /etc/tor/torrc and then edit it. Towards the bottom of the first section of the file, find the phrase #controlPort9051 and remove the # sign so that what is left is ControlPort9051.
Also remove the # signs from the following lines:
hashedcontyrolpassword < your password >
Cookieauthentication 1
Replace the hashedcontrolpanel with the hash gotten from ten above step and then delete the hash from the notepad. Save the new config file with the command ctrl+0 and close it with ctrl+X. now restart Tor using sudo service tor restart.
Configure Bitcoind
Use the following command to enter bitcoin config file: nano ~/.bitcoin/bitcoin.conf
Use the following config to adjust the file:
- Proxy=127.0.0.1:9050 this command guides the bitcoin node to Tor socks proxy so that every data passes through tor
- Listen=1 this command listens for incoming connections
- Onlynet=onion connects through tor only
- Listenonion=1 this command will listen for incoming connections via an onion address
- Discover=0 this command will prevent the broadcast of your IP address
- Torcontrol=127.0.0.1:9051 this command allows the bitcoin node to have control over tor.
- Torpassword=< yourtorpassword > this command is how the bitcoin node authenticates itself to the tor node.
Paste the password from the notepad earlier and then close the notepad. Use the command ctrl+0 and ctrl+X to close the editor.
Restart bitcoind with sudo service bitcoind restart
The bitcoin port 8333 at this point no longer needs to be open so close it with sudo ufw deny 8333/tcp
Conclusion
Transactions with the use of bitcoin grow daily and it is even more convenient now as you can have a home server and use it as a bitcoin node. As secure and anonymous as you may think trading with cryptocurrency is, it is not 100% true. Bitcoin transactions are irreversible and so can be hacked without a trace. Crypto-jacking also serves as malware as hackers can use your phone or computer as a mining load and cause your device to lag. This loophole in the security and privacy that you were supposed to get is what makes it necessary to do bitcoin transactions over a VPN. The use of a VPN will encrypt your data and hide your IP address making you stay anonymous and difficult to track. A good VPN choice for your bitcoin transaction is LimeVPN. To ensure that you are secure and your privacy is assured, they offer you 256-bit encryption with a pool of IP addresses to choose from. Speed of connection is not an issue and you can have all your processes and transactions running at top speed.