In this article I will explain how to open a Lightning channel in Electrum Bitcoin wallet, how to make payments with Lightning and how to instantly swap Bitcoin off-chain and on-chain using Submarine Swaps. I will also briefly touch the aspect of AML risks involved.
Table of contents
- What is Bitcoin Lightning?
- Opening a Lightning Channel
- How to make payments with Bitcoin Lightning
- Submarine Swaps
- Troubleshooting
What is Bitcoin Lightning
Lightning is a 2nd layer of Bitcoin protocol (or off-chain) which should allow instant and almost 0 fees payments and prevent on-chain congestion. I write “should” because lightning although already functional is still an idea in the heads of mass users. Bitcoin took and takes time to be adopted worldwide and Lightning is even more complex concept to understand so it will take more time. But I myself like to be ahead of time and test new things and become the part of the future world today. Let’s go ahead and make a Lightning wallet within Electrum.
Opening Lightning Channel Electrum
Requirements
- You need to have a minimum of 0.002 + network fee to open a Lightning channel in Electrum
- You should have native SegWit wallet (addresses starting with “bc1”). You will not be able to open a channel with P2SH Segwit wallet (staring with “3”). Unless you had a special wallet setup like we explained here, you are fine.
How to open a channel
First make sure that you have your wallet.dat file backed up. Then open “Channels” tab in your wallet and press “New Channel“.
A warning message will appear reminding to make a backup of your wallet file. Press “Yes” and on the next dialogue screen choose the amount of funding. Minimum is 0.002 BTC. For learning purposes we recommend to start with minimum first.
After you press “OK” channel will be pending confirmation from network to be opened. You will see its status as OPENING and that you can send and receive 0 BTC. Just wait for 1 confirmation from the Bitcoin network.
As soon as transaction is confirmed, you will see that channel status will be changed to FUNDED.
How to make a Bitcoin Lightning payment
Now when the Lightning channel is open and funded, you can make payments using Lightning. You will still use same Send tab to make a lightning payment.
First, you will need to obtain a Lightning invoice or you can scan QR code of the Lightning invoice. We will be sending some Sats to another Lightning wallet as a test. You just copy and paste the lightning invoice (usually starts with “lnbc1”) into the “Pay to” of the send tab.
Once you press “Pay” and “Confirm” you will see that the payment is in progress.
It will take just few seconds before your payment is finalized and reaches the recipients. Unlike on-chain payments, lightning payments are confirmed instantly.
You can see Lightning payments are marked accordingly in the transaction history of your Electrum.
Submarine Swaps
Now let’s say you want to add funds to your Lightning channel or withdraw funds from your lightning channel. Until recently you would not be able to do it, you would need to open a new channel with new capacity or close the channel to withdraw funds. But with submarine swaps you can do both and do it without trusted third party.
How to withdraw Bitcoin back to on-chain from Lightning
Now let’s say I want to withdraw some Sats back to on-chain. Thanks to Submarine Swaps you can do it with the few clicks of the mouse. Go the the “Channels” and click on the top right icon shown on the screenshot below.
Enter how much Bitcoin you want to send back to your on-chain wallet, choose commission and confirm.
You will see a message about successful swap.
Make sure you keep the Electrum wallet online until the transaction is confirmed.
On the image above swap is pending confirmation. Do not close Electrum until the status changes to the one on the image below or swap will be cancelled and you will not get the miner fee back.
Once swap is confirmed 👆 you will see that Bitcoin is available on-chain.
The same way you can top up your Lightning channel in case you are out of funds there. Just press the button shown below to switch Submarine Swap to the funding mode.
Submarine swap is a super easy feature to fund the Lightning channel and withdraw from Lightning back to on-chain. However there is one big downside described below.
AML downside of the Submarine Swaps
AML refers to anti-money-laundering and unfortunately because of private and anonymous nature of submarine swaps, not only good people use them but also those who needs to wash their money because during submarine swap the original chain of transactions in the blockchain breaks making hard to trace the source.
So what usually happens when you swap funds is that you are being dumped with high-risk Bitcoin in exchange for your Lightning funds. For example, let see the AML risk of BTC we received during our Submarine Swap.
Perfect example! So we were dumped with 100% stolen money which are being investigated by the law enforcement. Warning! Sending this Bitcoin to any centralized exchange will result in your account to be suspended. So, be very careful!
Troubleshooting
Error: Opening channel. ‘RemoteConfig. max_htlc_value_in_flight_msat is too small: 99000000’.
Solution: Try increasing lightning capacity a little bit more, like 0.0024. Although Electrum says the minimum is 0.002, I was able to open a channel with the minimum of 0.0024.
Error: Sending a lightning payment. HTLC value sum (sum of pending htlcs: 0.0 sat plus new htlc: ****** would exceed max allows ******
Solution: Try splitting a payment into several smaller ones. If this does not work, try disabling Trampoline Routing in Tools > Preferences > Lightning.
Error: Sending a lightning payment. No path found.
Solution: Change Electrum node. Press on the green round icon in the bottom right. Untick “Select server automatically” and try choosing other server.
People reacted to this story.
Show comments Hide comments[…] my previous article I have touched an aspect of AML when transacting in Bitcoin. We will talk about this more in the next articles but today I wanted […]