Today I will walk you through the steps of setting up lightningd (the lightning daemon) for Beyondcoin!
Step 1 | What you will need
- A computer running Ubuntu
- At least 500 MB of free space
- Basic knowledge of the command line
- Some Beyondcoins (like 25 BYND)
- A will to learn
- Maybe some coffee
Step 2 | Downloading all the dependencies
In this step, we will download all the required dependencies needed to run Beyondcoin Core and Beyondcoin Lightning.
To install all the dependencies to build lightningd for Linux, run:
sudo apt-get update
sudo apt-get install -y autoconf automake build-essential git libtool libgmp-dev libsqlite3-dev python3 python3-mako net-tools zlib1g-dev libsodium-dev gettext python3-pip libpq-dev libpq-dev
That will install all the necessary dependencies so you can compile lightningd for Beyondcoin.
Step 3 | Getting and Compiling Lightning
Next, we will get the Beyondcoin lightning network daemons’ code and compile it!
To grab the code, run:
git clone https://github.com/beyondcoin-project/lightning.git
That clones the code into a new directory called lightning.
sudo pip3 install -r requirements.txt
Now you’re in the directory and have install the requirements needed to build lightningd. In this directory we are going to compile the lightning binaries.
To do this, you need to run a couple of commands;
sudo make install
Note: run each command one at a time!
Now if all is okay, the binaries should be located under /usr/local/bin
Step 4 | Starting Lightningd (the lightning daemon)
This is a pretty quick process.
First, navigate to the directory where the binaries you compiled were installed in;
Then start lightninigd for Beyondcoin;
sudo ./lightningd --network=beyondcoin
Then stop lightningd (we need to edit the configuration file next)
To make sure the processes is killed:
sudo killall lightningd
Step 5 | Configuring your Lightning Node
In this step, we will configure your lightning node!
First, we will need to change the file permissions to edit the file;
sudo chmod -R 777 ~/.lightning
Then lets create a file called config in ~/.lightning/
sudo nano ~/.lightning/config
Now, we’re in the new file called config, we need to specify that the daemon uses the beyondcoin network and so the daemon runs in the background, so put this in the new file;
We’re almost finished! Now we need to edit the Beyondcoin specific configuration file which is located under~/.lightning/beyondcoin
sudo nano ~/.lightning/beyondcoin/config
Now we will need to add a few more things to this configuration file;
Make sure to add your credentials for your Beyondcoin node.
Also make sure port 9735 is opened so you can connect to other nodes later!
sudo ufw allow 9735
Step 6 | Running your Node
Now it’s time to run your node!
Now we just need to start your node and let it sync!
Now your node should have started and you should also see your lightning nodes’ address, this means everything is working!
To check the status of your node, run;
sudo ./lightning-cli getinfo
This will display Lightning Network information as well as how many blocks are in the blockchain and if your node is still syncing.
Step 7 | Connect to some peers!
In this step, I will show you how to connect to some peers!
In the same directory as lightningd (make sure lightningd is already running), run;
sudo ./lightning-cli connect firstname.lastname@example.org ./lightning-cli connect email@example.com
That will connect you to two Beyondcoin Lightning Network peers.
Now when you run getinfo, you should see that you are connected to two peers!
Step 8 | Opening a Lightning Channel
In this step, I will show you how to open a channel!
To open up a channel with 25 BYND to 031f1f95ad1fd1a49dca801a9d19bacc8d9fa3f43a00cfa15dccdbd2930aea91f2, run;
sudo ./lightning-cli fundchannel 031f1f95ad1fd1a49dca801a9d19bacc8d9fa3f43a00cfa15dccdbd2930aea91f2 2500000000 1000000
The 1000000 at the end will be the 0.01 BYND transaction fee to open the channel.
You should see something like this:
Congratulations, you now have a working LN node and have successfully launched a lighting channel on the Beyondcoin Lightning Network!
Now, you should be able to see your channel on the Beyondcoin Lightning Network map: https://lnmainnet.beyondcoin.io (it can take up to 30 minutes since you started your node for it to show up)