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 200 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
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.
Then run,
cd lightning
Now you’re in the directory. In this directory we are going to compile the lightning binaries.
To do this, you need to run a couple of commands;
./configure
make
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;
cd /usr/local/bin
Then start lightninigd for Beyondcoin;
sudo ./lightningd --network=beyondcoin
Then stop lightningd (we need to edit the configuration file next)
CTRL^C
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;
network=beyondcoin
daemon
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;
alias=<PUBLIC_NODE_NAME>
rgb=<RGB_COLOR_FOR_YOUR_NODE>
bitcoin-rpcuser=<YOUR_BEYONDCOIND_RPCUSERNAME>
bitcoin-rpcpassword=<YOUR_BEYONDCOIND_RPCPASSWORD>
bitcoin-rpcport=10332
bitcoin-rpcconnect=127.0.0.1
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!
cd /usr/local/bin
sudo ./lightningd
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 020a4b773dbf43900f89b9f5b06da8324f0826b0ea897ff0421a87b8cc6a30c76c@52.11.0.47
sudo ./lightning-cli connect 031f1f95ad1fd1a49dca801a9d19bacc8d9fa3f43a00cfa15dccdbd2930aea91f2@54.227.0.236
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!