Exploring Lightning Nodes

Hello Africa,

Have you ever wondered how developers create and test new stuff on Bitcoin without risking real money? Well, that’s where the Bitcoin Testnet and LND Testnet come in!

Imagine the Bitcoin Testnet as a playground that closely resembles the real Bitcoin world, but it uses special “test coins” that have no actual value. This lets developers and curious minds try out different Bitcoin applications and features without worrying about losing any real money. It’s like a safe testing ground for them to learn, experiment, and make sure everything works perfectly before going live.

The LND Testnet is a similar network, but it’s specifically designed for testing the Lightning Network. The Lightning Network is like a super-fast highway for Bitcoin transactions, but developers need a safe space to try it out first. That’s where the LND Testnet steps in! Here, developers can experiment with Lightning applications and simulate real transactions without using real bitcoins. It’s like a virtual lab where they can fine-tune their creations and make sure everything runs smoothly before launching them on the real Lightning Network.

Both the Bitcoin Testnet and LND Testnet are crucial for blockchain innovation. They give developers and researchers the freedom to explore and push the boundaries of what’s possible in a risk-free environment. These testnets play a big role in making sure the future of Bitcoin and blockchain technology is secure, efficient, and easy to use for everyone

Are you eager to explore the exciting world of Lightning nodes and test their capabilities? Well, you’re in for a treat! In this article, we will show you how to set up a testnet Lightning node backed up by a pruned testnet Bitcoin node. This will allow you to experiment with Lightning without risking any real money. So, let’s not waste any time and get started on this thrilling journey! Follow along, and you’ll be up and running with your testnet nodes in no time. Let’s dive in!

Requirement

To set up a testnet Lightning node following this guide, you will need:

  • A computer/server running ubuntu with at least 4GB of RAM and 40GB of storage space

Setting Up Bitcoin Core (testnet)

Running a lightning node requires a bitcoin full / pruned node as the backend. The first process of setting up a node is usually setting up a bitcoin node first.

Step 1: Install Dependencies

Start by updating and upgrading your system packages.

sudo apt update && sudo apt upgrade

Step 2: Install Bitcoin Core

  • Download the latest Bitcoin Core software from the official website. Head over to Bitcoin Core, copy the download link for the Linux (tgz) version.
  • Open a new window on your ubuntu cmd and type wget, space, paste the link you copied above and click enter. This will download bitcoin core to your machine.

wget https://bitcoincore.org/bin/bitcoin-core-25.0/bitcoin-25.0-x86_64-linux-gnu.tar.gz

  • Unpack the downloaded tarball

tar -xzvf bitcoin-core-25.0-linux.tar.gz

  • Install Bitcoin Core

sudo install -m 0755 -o root -g root -t /usr/local/bin bitcoin-22.0/bin/*

Step 3: Configure Bitcoin Core

  • Create a new directory for Bitcoin data

mkdir ~/.bitcoin

  • Create a configuration file (bitcoin.conf) inside the ~/.bitcoin directory

nano ~/.bitcoin/bitcoin.conf

  • Add the following configuration options to the file

testnet=1

server=1

daemon=1

txindex=1

prune=550

Save and close the file (Ctrl + X, Y, Enter)

Step 4: Start the Bitcoin Node

bitcoind -testnet

Setting Up LND (testnet)

Downloading and installing LND from pre-built binaries is a straightforward process. Follow these steps to set up LND using binaries:

Step 1: Download the LND Binary

Go to the LND releases page on GitHub: 

https://github.com/lightningnetwork/lnd/releases

Scroll down to the “Assets” section of the latest release.

Depending on your operating system and architecture, download the appropriate binary file. In our case, we’re using a 64-bit Linux system, download the file with the .tar.gz extension that includes linux-amd64 in the filename.

Step 2: Extract the LND Binary

Once the download is complete, navigate to the directory where the binary file is located. Extract the contents of the downloaded .tar.gz file. You can use the following command for Linux as an example:

tar -xzvf lnd-linux-amd64-vX.X.X.tar.gz

Replace "X.X.X" with the version number you downloaded

Step 3: Install LND

Move into the extracted directory that was created after extracting the .tar.gz file:

sudo install -m 0755 -o root -g root -t /usr/local/bin lnd-linux-amd64-vX.X.X-beta/*

Again, replace "X.X.X" with the version number.

Step 4: Verify Installation

To check if LND is installed correctly, open a terminal or command prompt and run the following command:

lnd --version

Step 5: Configure LND

  • Create a .lnd folder on your home directory:

mkdir .lnd

  • cd into the .lnd folder and create a lnd.conf file:

cd .lnd/

nano lnd.conf

Paste this sample configuration, remember, you can edit and customize it to your preference.

[Application Options]

alias=<YOUR NODE ALIAS>

color=#171717

externalip=<YOUR IP ADDRESS>

tlsextraip=0.0.0.0

tlsextradomain=0.0.0.0

listen=0.0.0.0:9735

rpclisten=0.0.0.0:10009

restlisten=0.0.0.0:8080

maxpendingchannels=10

coop-close-target-confs=24

protocol.wumbo-channels=true

 

[Bitcoin]

bitcoin.active=true

bitcoin.mainnet=true

bitcoin.node=bitcoind

bitcoin.defaultchanconfs=3

bitcoin.basefee=0

bitcoin.feerate=0

bitcoin.timelockdelta=144

[Bitcoind]

bitcoind.zmqpubrawblock=tcp://127.0.0.1:28332

bitcoind.zmqpubrawtx=tcp://127.0.0.1:28333

[Litecoin]

litecoin.node=ltcd

 

[tor]

tor.active=true

tor.v3=true

tor.streamisolation=false

tor.skip-proxy-for-clearnet-targets=true

 

[wtclient]

wtclient.active=true

 

[protocol]

protocol.no-anchors=true

 

[routing]

routing.strictgraphpruning=true

Step 6: Start the LND Node

Run the following command to start your LND Testnet node:

lnd n=testnet

You will be prompted to set a wallet password. Enter a secure password and confirm it.

Next, you will receive a 24-word mnemonic seed. This seed is essential for wallet recovery, so write it down and keep it safe. Confirm that you have properly recorded the seed when prompted.

Your wallet will be created, and you can now interact with your LND Testnet node using the lncli commands.

Step 7: Unlock the Wallet

If you stop and restart your LND node, the wallet will be locked by default. To interact with your wallet again, you’ll need to unlock it. However, you can add a configuration setting to your lnd.conf file that allows your lnd wallet to be unlocked automatically everytime you stop and start it again. Follow this steps:

  • Create a password.txt file anywhere in your machine. The content of the password.txt file will just be your password.
  • Open your lnd.conf file and add this two lines to the [Application] section of the file:

wallet-unlock-password-file=/path/to/password.txt

wallet-unlock-allow-create=true

That’s it! Everytime you restart your lnd node, the wallet will be unlocked automatically.

Congratulations! You’ve successfully set up a Testnet LND node backed up by a pruned Testnet Bitcoin node on Ubuntu. This environment allows you to experiment with Lightning Network payments, open channels, and explore the capabilities of the Bitcoin network without risking real funds. As you delve deeper into the world of Bitcoin and Lightning network technology, you’ll find endless possibilities and innovative solutions that can be built on top of this infrastructure. Happy testing and happy learning!

SIGN UP FOR OUR WEEKLY NEWSLETTER

"*" indicates required fields

Email*

GET UPDATES ON OUR LATEST BLOG POSTS

Subscribe with your favorite RSS reader (eg, feedly) to get updates on our latest blog posts. Simply click the ‘RSS‘ button above and paste the url link in the reader to subscribe.

Leave a Comment

Your email address will not be published. Required fields are marked *