This tutorial explains how to set up a Bitcoin full node with a Lightning node on your server. Running a full node contributes to the strength and security of the Bitcoin network, and a Lightning node enables faster, cheaper transactions. The most important requirement for implementation is a basic understanding of the Linux command line.
To set up a Bitcoin full node and a Lightning node, you need a server with the following characteristics: Sufficient storage (about 500 GB) Good CPU power A stable internet connection
After provisioning the server and logging in with the username root and the password sent by email, update the basic configuration of the server. Change the root password with passwd. Download the current security updates with apt-get update && apt-get upgrade -y.
Download the latest Bitcoin Core release from the official website.
Extract the downloaded archive.
wget https://bitcoincore.org/bin/bitcoin-core-24.0.1/bitcoin-24.0.1-x86_64-linux-gnu.tar.gz
Extract the downloaded archive.
tar xvf bitcoin-24.0.1-x86_64-linux-gnu.tar.gz
Change to the extracted directory.
cd bitcoin-24.0.1
Add the binaries to your path.
nano $HOME/.bashrc
Go to the end of the file and paste the following:
export PATH="$HOME/bitcoin-24.0.1/bin/:$PATH"
Save with Ctrl+O and exit with Ctrl+X.
source $HOME/.bashrc
Create a default bitcoin.conf file.
mkdir $HOME/.bitcoin nano $HOME/.bitcoin/bitcoin.conf
Paste the following:
server=1 daemon=1 zmqpubrawblock=tcp://127.0.0.1:28332 zmqpubrawtx=tcp://127.0.0.1:28333
Save with Ctrl+O and exit with Ctrl+X. Start Bitcoin Core by typing bitcoind in the terminal.
bitcoind
At this point, Bitcoin Core should start synchronizing with the network. It will download and verify the entire blockchain, which can take several hours to a few days. Track the progress of your Bitcoin node synchronization.
tail -f $HOME/.bitcoin/debug.log
When the Bitcoin node is done synchronizing, you can continue with the next steps.
Download the latest release of LND from the official GitHub repository.
wget https://github.com/lightningnetwork/lnd/releases/download/v0.16.0-beta/lnd-linux-amd64-v0.16.0-beta.tar.gz
Extract the downloaded archive.
tar xvf lnd-linux-amd64-v0.16.0-beta.tar.gz
Change to the extracted directory.
cd lnd-linux-amd64-v0.16.0-beta.tar.gz
Move the LND binaries to the ~/bin directory (create the directory if it doesn't exist).
mkdir -p $HOME/bin mv lnd lncli $HOME/bin
Add the LND binaries to your path.
nano $HOME/.bashrc
Go to the end of the file and paste the following:
export PATH="$HOME/bin/:$PATH"
Save with Ctrl+O and exit with Ctrl+X.
Reload the changes with:
source $HOME/.bashrc
Create a default lnd.conf file.
mkdir $HOME/.lnd nano $HOME/.lnd/lnd.conf
Paste the following:
[Application Options] debuglevel=info maxpendingchannels=10 alias=YourNodeAlias color=#68F442 listen=localhost [Bitcoin] bitcoin.active=true bitcoin.mainnet=true bitcoin.node=bitcoind
lnd
After setting up your Bitcoin full node and Lightning network node, open another terminal window and create a wallet using the following command:
lncli create