Simulate your first Lightning transaction on the Bitcoin regtest network Part 2 (MacOS)
📜Objective
The goal of this article is to help you
confirm that we have the correct bitcoin.conf settings
spin up a Bitcoin network
Ensure we are on the regtest network
Prepare the first lightning node aka
lnd1for some actionSpin up node
Create wallet
Get some information about the node
Generate an Address
Fund the
lnd1wallet with some bitcoinload up our existing local Bitcoin wallet
send some bitcoin to generated
lnd1wallet address (to be sent tolnd2later on)
Check wallet balance
Prepare the second lightning node aka
lnd2for some action
📜 Introduction
Welcome to Part 2 of our series, fellow Bitcoin/Lightning developers. I'm sure you're itching for some action...

This is the second part of a two-part series and in case you haven't already read the first part go over here Part 1 so you can fully maximize this second part.
📜 Some boring but very important stuff to get us started

The Lightning Network is a second-layer protocol built on top of the Bitcoin blockchain and it enables faster and cheaper transactions by creating off-chain payment channels between users. These channels allow multiple transactions to occur without needing to be recorded on the main Bitcoin blockchain. Instead, only the opening and closing transactions of the channel are settled on the blockchain.
The Regtest (regression test) Bitcoin network mode creates a local private blockchain where you can adjust the parameters to what you want. For this demonstration, we would run our lightning network on top of an active Bitcoin network running a local private blockchain (regtest)
Quick note: throughout this article, long
outputcodeblock data are truncated
The easy part:
⚙️ Confirming our Bitcoin environment and spinning up a Bitcoin daemon

To confirm that our settings are correct to spin up the required Bitcoin network mode, open up the autogenerated bitcoin.conf located at /Users/user/Library/Application Support/Bitcoin/bitcoin.conf with a text editor
Command:
Output:
Now let's follow through the following steps
📜 Spin up a Bitcoin network (regtest network)
Command:
Output:
📜 Ensure we are on the regtest network
Command:
output:
📜 Prepare the first lightning node aka lnd1 for some action
lnd1 for some actionWe'll be preparing our first lightning node now so go ahead and open up two new shell tabs or terminal windows and follow the following steps to spin up both of our previously configured lightning nodes respectively.
First Tab:
Let's go ahead and start up our first node
command:
output:
Second Tab:
Now let's create a wallet, run the command below and follow through the wallet creation prompts
command:
output:
Let's go ahead and fetch some basic information about our node. Run the command below
command:
output:
Time to create an address that would receive the bitcoin sent to the lightning node wallet
command:
output:
Let's load up our Bitcoin wallet from the previous tutorial, send some juicy 100 Bitcoin from it to our lightning address above and then generate some blocks to give it some confirmations

"my oh my!!, what a man could do with some real 100 btc just sitting in a wallet 🤤. Alight alright that's enough buddy, don't be weird let's get back to the article."
Run the commands below in sequence
command 1:
output:
command 2:
output:
command 3:
output:
Let's go ahead and check our lnd1 wallet balance
command:
output:
📜 Prepare the second lightning node aka lnd2 for some action
lnd2 for some actionTo get the second lnd node configured and running, repeat all the steps we followed above but this time around, funding the lnd2 wallet with some bitcoin is optional as this node would be on the receiving end of our transaction.
📜 Conclusion
We'll conclude here. Thank you for staying with us until the end of the second part. In the final part, we'll walk through connecting peers, opening payment channels, and other processes necessary for a valid lightning transaction.
📜 Useful links
Last updated