Publisher avatar
LearnCrypto
12 min read

How to use the Lightning Network

How to use the Lightning Network

What you'll learn

  • The problem Lightning solves
  • Setting up a custodial Lightning Wallet
  • Setting up a non-custodial Lightning Wallet
  • Setting up a full node on the Lightning network

Right now, Bitcoin is an excellent store of value but slow and expensive for everyday transactions, which is where the Lightning Network comes in. The so-called layer two solution means Bitcoin users can have their cake and eat it. Fast, cheap bitcoin transactions without compromising on security. Learn how to use the Lightning Network.



For the Bitcoin network to rival existing payment systems like Visa, it must be able to process transactions faster (much faster) and at a fraction of the cost of existing fees. But this scaling cannot be achieved at the expense of decentralisation or security. 

This conundrum has become known as the Bitcoin trilemma.

An attempt to solve it by simply increasing the capacity of blocks led to the bitter chain wars and the creation of Bitcoin Cash in 2017, followed by Bitcoin SV in 2018. 

Neither has resulted in an effective way to transact quickly and cheaply on-chain, yet retain Satoshi’s design, underlining the challenge of scaling Bitcoin as a payment network through its existing consensus method. 


The Lightning Network solution

Can the Bitcoin network have it both ways, i.e. maintain its original design and still serve as a high-speed network for micropayments? Through the Lightning Network, it can, and we’ll show you exactly how to use the Lightning Network for everyday transactions like paying for a cup of coffee. 

The Lightning Network is an example of a Layer 2 bitcoin service. An off-chain approach was first formally proposed by Joseph Poon and Thaddeus Dryja in 2015. 



In practice, it takes the burden of small transactions off the Bitcoin blockchain and instead employs micropayment channels, controlled through something called multi-signature (multi-sig) wallets. This is a fancy term for a way of two or more parties all having to agree to changes to balances of mutually held payment channels.

Key features of the Lightning Network

How fast is the Bitcoin network? Currently, Bitcoin can only process between 2 -7 transactions per second. For context, Visa, the legacy payment network that powers your debit and credit cards you use for shopping, process up to 150 million transactions a day. In comparison, its network capacity is 24,000 transactions per second. How then can Bitcoin compete? The Lightning Network provides a challenger path. 

In theory, the Lightning network could easily process transactions running in thousands or hundreds of thousands instantly, giving it a great use case in micropayment transactions, let's say as small as four satoshis (sats).

Key concepts for using the Lightning Network:

Nodes - is software that connects to the Lightning Network to send and receive bitcoin from other nodes. The network is made up entirely of these nodes connecting to each other


Channels - users of the Lightning Network create payment channels so that they can transact with each other off-chain, which can later be settled (closed) on the mainchain (on-chain)

Invoices -  are requests for payment on the Lightning Network, generated as QR codes. Invoices include the information necessary to complete a payment on the network, such as payment amount, which blockchain the invoice applies to, expiry date, payee pubkey, routing hints, and other information. 

So how do you set up and use the Lightning network? There are three ways to this, starting from the simplest custodial option, and ranging to setting up your own Lightning Node.

1. Through a custodial lightning wallet, e.g. Bottlepay


2. Non-custodial Lightning wallets, e.g. Wallet of Satoshi, Breez, BLW, Eclair, Zap Tippin.me, Bitrefill, BitPay etc.


3. Setting up a full node


1 - How to set up a custodial Lightning Wallet

We are going to use Bottlepay as our example for a custodial Lightning Wallet, because their user experience is great for beginners. There are plenty of other options.

Step 1 - Download the Bottlepay App from Playstore of App Store

Step 2 - Choose your country

Step 3 - Add a mobile number which becomes your log-in info

Step 4 - Agree to the terms and conditions; declare if you are a US Taxpayer

Step 5 - Verify your mobile number with the code Bottlepay send

Step 6 - Create a six digit pin; Confirm the pin

Step 7 - Optional but recommended; Enable Biometrics to enhance security

Step 8 - Create a profile; username, profile picture, email address

Step 9 - Confirm your email

Step 10 - Verify your identity providing Name, Age, Address, and Proof of Identity via Driving License or Passport; Scan the front and provide a Selfie (smile 😃 )

This step took several minutes. Be patient.

Congratulations. You now have a Lightning wallet. You can:

Add Funds - Either fiat via bank transfer or by transferring BTC - On Chain or Lightning. You should decide how you want to receive funds. Either in fiat or BTC. You can always change your mind and convert after.

Make a payment at the speed of Lightning

Receive Funds - Generate a BTC address or Lightning Invoice

Send Funds - On Chain or by scanning a Lightning Invoice; to other Bottlepay users; to a Mobile Number; to a Social Profile: Discord, Github, Reddit, Twitch or Twitter.

Trade - One time purchase or recurring i.e Cost Averaging.



2 - Setting up a non-custodial Lightning wallet

Setting up a non-custodial wallet is a more leisurely approach to connect to the Lightning Network if you don’t want the full-node experience. Simply download the Bitcoin Lightning Wallet app on your Android phone or the Blue Wallet, which works perfectly for iOS and Android, and you can start creating and settling invoices. 

With this, you can open a Lightning channel and begin making transactions with other users. It’s also “non-custodial,” meaning you look after your keys—keeping your Bitcoin in your hands. And as a beginner not willing to risk your coins on Lightning without proper understanding, you can download an Eclair mobile testnet wallet for lightning payments. 

1. Download Eclair Android wallet from the Playstore


2.  Create a new wallet or import an existing wallet 


3. If you’re creating a new wallet, you need to save your 12 words secret phrase somewhere


4. Backup your phrase by entering specific words as requested by the wallet


5. Setup your passphrase to help you decrypt your recovery phrase


6. Set SEED ENCRYPTION pin, usually a 6 digit password


After successfully setting up your wallet, 

Click Receive, tap LIGHTNING and click the three dots at the upper right.

Swipe left to Channels to add payment channels. The green circle with the + button helps you manually add or select channels after enabling that feature in settings.

Click settings

Enable receive over Lightning button. And you can start receiving payment over Lightning!

You can also change your Bitcoin unit to Satoshi, Millibitcoin or Bits, depending on your preference. 

We like to choose Milli-Bitcoin (mBTC) as we will make a coffee purchase with price denominated in mBTC later in this article.

3 - How to set up a full node on the Lightning network

Follow the steps below to set up and your full lightning network node.

1. Download the client through the Lightning project Github profile

If you use Windows, download Lightning-win32 for Mac OS; try Lightning-darwin.

1. Download lightning client


2. Run the client


3. It asks you if you want to create a new wallet or import an existing one. In our case, we are creating a new wallet. 


4.  It will ask you to copy and save your recovery phrase.


5.  You will need to double to check by inputting the random phrase asked.


6. Confirm password


7. And you’re set to start receiving coins in your Lightning app.


2. Grab some Testnet coins


If you’re worried about using real funds to test out something, you’re not really familiar with, no need to worry. Simply get some Testnet bitcoins from this faucet, and you’re primed and ready to go. 

3. The next step would be to transfer your testnet coins to your Lightning app or a mobile or desktop wallet that supports lightning payments. BitPay (formerly Copay), Eclair Mobile testnet wallet, which supports testnet lightning transactions, are good wallets for that. 


Practical scenarios of creating and settling invoices using Lightning networks

Now that you have your Lightning wallet funded, you can start creating or settling invoices on Lightning Network.

To make a payment, you will need to open a channel. For that, you need to know your partner’s channel public key and their IP address. Since you’re working in a testnet environment, we’ve made available some channel addresses of popular products supporting payments on Lightning Network.

Bitrefill

Y’alls

Eclair

How does it feel to be able to pay for a cup of coffee for a little less than a dollar, spending less than a cent transaction fee and still getting your transaction confirmed at lightning speed?



Starblocks demonstrates this as it allows you to buy virtual coffee instantly with Bitcoin.

Let’s add the Expresso Coin Panna, which costs 0.0015 mBTC, to our cart and checkout.

It immediately generates an invoice. You can either copy the invoice info manually and paste it in your lightning app you set up earlier, or you just select the option OPEN WITH YOUR WALLET.

And make the payment from our Lightning Wallet (on desktop) or Eclair testnet wallet (on mobile)

How big can the Lightning Network get?

Lightning Network has been growing nicely even though most mainstream businesses are still yet to start accepting payment over lightning. 1ML is a great resource to fetch real-time data of the Lightning Network, which now span 0ver 20,000 nodes and more than 45,000 Lightning channels created. See a map by Blockchain Caffe showing the locations of the Lightning Network nodes. 

We explained how Lightning Network could become the killer app for Bitcoin by enabling transactions to occur through payment channels which can all be connected, facilitating millions of micropayments rather than on-chain, thereby solving scalability without sacrificing decentralisation. 

Bitfinex is one of the big exchanges already supporting payment through lightning. Many more are considering as well as crypto wallet providers. But before this can happen, there are still a few bottlenecks.

Some limitations to Lightning Network’s adoption

Setting up a lightning node is not particularly easy if you are not a reasonably technical person. Liquidity is also another challenge lightning network faces. Lightning payment channel users can’t spend more than they have locked in a channel constraining the solution’s flexibility. 

133
How much bigger wrapped Bitcoin on Defi is than liquidity within the Lightning Network

Some have criticised it and pinning the slow growth in liquidity to this problem. Comparing the lightning network’s liquidity growth with DeFi, the difference is clear.  As of May 2021, the ratio of Bitcoin liquidity on DeFi to Lightning Network is $8.43B to $63.2M. That would mean wrapped Bitcoin on DeFi is at least 133 times more liquid than the Lightning network. 

With newer solutions like mobile wallets with support for lightning payment channels that tend to abstract the complex processes in setting up or interacting with a lightning node or channel, we can expect faster lightning network growth.