Lightning Network: A better way to pay with Bitcoin

Lexie

The Lightning Network has been highly anticipated by Bitcoin enthusiasts for years. As a separate network it promises to make Bitcoin payments faster and cheaper while not compromising the security of the Bitcoin Blockchain.

Why use the Lightning Network?

The Bitcoin Blockchain faces an impossible dilemma. If it allows for more transactions, it becomes harder for participants to run their own Bitcoin node, as bandwidth and computing requirements would rise. Without the ability to easily validate the integrity of the network, Bitcoin users will have to rely on others to tell them whether they own Bitcoin, or how many Bitcoin exist in total. In short, without being able to validate the network, Bitcoin is not decentralized. But with the limit on the number of transactions so low, how can we make cheap payments?

The Lightning Network aims to solve this problem by letting users transact on a secondary layer, funded with Bitcoin secured on the Bitcoin Blockchain base layer. To achieve that, users have to deposit their capital into “channels” established with their peers. They can then make an infinite number of transactions inside one of these channels. They can send and receive payments as small as a single satoshi (1/100 millionth of a Bitcoin) with their direct peers, the peers of their peers, and ideally anyone else within the network.

How to use the Lightning Network

Choose a wallet

So you’ve purchased one Bitcoin from a broker or miner. To use this Bitcoin for payments and participate in the Lightning Network, you’ll need a Lightning client. You can choose to run a full Bitcoin and Lightning node on your home server, or you can choose to install a lightweight wallet on your phone.

On a laptop computer, you might be best off with a client like Electrum. Developed by Thomas Voegtlin in 2011, it has established itself as one of the most important open-source Bitcoin projects. While Electrum is easy to use for beginners, it allows for a wide range of customizations and edge cases. Since Version 4.0.5, Electrum wallets come with Lightning enabled by default, a great opportunity for us to try it out, and for others to open their first Lightning channel.

Set up your Bitcoin wallet

If you already have a Bitcoin wallet you can continue using that right away. All you need to do is upgrade your Electrum client. You should be able to see a new Channels tab, or make it visible under View > Show Channels. At the bottom right corner you can see the Lightning icon, indicating whether you are synced to the network.

If you are creating a new wallet, make sure you are creating a Standard Wallet, and choose the Segwit option. Be sure to back up your seed phrase securely, for example on a piece of paper or your password manager.

Create Lightning channels

To use Lightning, we will need to create a channel with somebody. To do that, we need to already own Bitcoin. How to buy Bitcoin will differ from location to location. In some countries you can download an app and link it to your bank account. In others you can go to a broker or Bitcoin ATM.

The concept of a channel is unfortunately not the most intuitive one and Electrum takes no time explaining it. A channel is your connection to the Lightning network, but it also defines how many satoshis you are able to receive and send.

Imagine you start with 1 million satoshis, or 0.01 Bitcoin, worth about 200 USD at the time of writing. Depositing these funds into a channel means that you create a channel with a capacity of 1 million satoshis, all of which you are able to spend. Unless others also open channels with you, you cannot yet receive funds. Only once you have spent some of these satoshis, you will be able to receive the difference between the capacity of the channel and your own balance.

In our example, if you make a purchase of 500,000 satoshis, you are then able to receive up to 500,000 satoshi. Electrum will show us how much we are able to spend and receive through Lightning in the Channels tab.

After depositing some Bitcoin into our wallet using the Receive tab, we can navigate to Channels and choose Open Channel. We can let Electrum decide which node we should create a channel with, or enter the node ID belonging to somebody we expect to frequently transact with, or who we consider well connected to the rest of the network.

Here, we also need to decide how much of our funds we want to commit to the channel. We can choose to create a single channel with all our funds or split them up into multiple channels. Generally we would recommend creating fewer channels that are larger. A channel should be a multiple of the average size of the payments you expect to make. There is a requirement to bind capital in channels—a significant drawback of the Lightning Network.

Before our channel is opened, we will have to make a single on-chain Bitcoin transaction, for which we will have to pay a transaction fee. Depending on how urgently you need the channel, you may opt for a smaller or larger fee. It can be worth it to wait, as fees fluctuate by up to two magnitudes over a week.

Make Bitcoin transactions with Lightning

As soon as your funding transaction has received three confirmations on the Blockchain, you will be able to make payments. To try it out, you can head over to Bitrefill and add some credits to your mobile phone or buy an Amazon gift card. Copy and paste the lightning invoice into the “Pay to” field under the Send tab. Click “Pay” and confirm the payment.

To receive payment, you will need to create an invoice first. Head over to the Send tab and enter an amount. A short description might help you track the payment in the future, but be careful: This description is visible to whoever you forward the invoice to. You can share the invoice as a text-only message or QR code right from the Receive tab.

Unlike what we’re used to with Bitcoin, a Lightning transaction is never in limbo. The payment may take some time to be sent, but the money is always either with you or the other party—making it far more reassuring as a method of payment. If you give others an invoice, there is also no option for them to pay a different amount. Payments can fail, but they cannot be stuck somewhere.

Swap funds on Lightning

One useful feature that Electrum offers natively is to swap funds in and out of a Lightning channel. This can be useful if you have been receiving many Lightning payments, for example through your online store, and you now want to move a portion of these funds to cold storage or an exchange. Without swapping funds out, you would have to close the channel, losing its inbound capacity.

Swapping funds can also be used to create inbound capacity, for example by opening a large channel with another node, then swapping out its contents. The channel is still there, the money is still yours, but you can now receive more through the channel.

To swap funds, click “Swap” under Channels, and define whether you want to send or receive over Lightning. Enter the desired amount you want to swap, set your priority, and confirm with “OK.” You should see your Lightning balance changing and an unconfirmed transaction under History.

You can use these newly received on-chain Bitcoin to open another channel. This can be a convenient trick to get both sending and receiving capacity shortly after starting your node, although of course the other side can choose to close these channels anytime.

For this service you have to pay a fee, in our case 0.5%. We hope that this fee will allow Electrum to generate stable revenue in the future.

Bitcoin security: Better with Lightning

When using Lightning with Electrum, just like with on-chain Bitcoin, your funds are always held by you. Your money will never be held by Electrum, whoever you open a channel with, or another third party.

The Lightning security model differs slightly to that of Bitcoin in that to protect your funds in your channels, you will need to regularly open Electrum. By default this usually means once every week. You can also choose to run Electrum in the background of your computer and launch it at startup.

Alternatively, you are also able to connect to a remote watchtower, meaning a server that will look on your behalf on whether your channel is appropriately closing, if the other party chooses to do so.

In addition to backing up your Bitcoin using your seed phrase, you can also backup your channels. While this backup won’t allow you to recreate the channel on a new device, it will allow you to appropriately close it without needing cooperation from the other side.

Lightning feels ready for prime time

Compared with the first time we wrote about it in early 2019, Lightning now feels smooth and strong, payments rarely fail, and there is a wide variety of wallets available for use. In many ways, the Electrum release tested for this article feels like a major milestone to bring the network to the masses and into the spotlight.

For Lightning to succeed, however, it will need to be possible to buy Bitcoin directly on the Lightning network, or at least for exchanges to allow for Lightning deposit and withdrawals.

Lexie is the blog's resident tech expert and gets excited about empowerment through technology, space travel, and pancakes with blueberries.

View Full Experience

ExpressVPN is proudly supporting

Need help? Chat with us!