Bitcoin Forum
December 14, 2024, 06:56:40 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1] 2 3 4 5 6 7 8 9 »  All
  Print  
Author Topic: Electrum Lightning Network walkthrough  (Read 4940 times)
This is a self-moderated topic. If you do not want to be moderated by the person who started this topic, create a new topic. (4 posts by 1+ user deleted.)
Rath_ (OP)
aka BitCryptex
Legendary
*
Offline Offline

Activity: 1876
Merit: 3139



View Profile
July 04, 2020, 06:39:46 PM
Last edit: January 11, 2022, 11:13:18 PM by Rath_
Merited by OmegaStarScream (16), LoyceV (15), Welsh (15), hugeblack (10), malevolent (8), TryNinja (6), Mitchell (5), Cyrus (5), NeuroticFish (5), Wind_FURY (5), DdmrDdmr (5), bitmover (5), pooya87 (4), Quickseller (4), 1miau (4), o_e_l_e_o (4), mocacinno (3), ABCbits (3), Husna QA (3), Symmetrick (3), johhnyUA (2), igor72 (2), Heisenberg_Hunter (2), d5000 (1), JayJuanGee (1), Lucius (1), Pmalek (1), hosseinimr93 (1), dkbit98 (1), morvillz7z (1), DireWolfM14 (1), FatFork (1), digit (1), Shawshank (1), Despairo (1), FontSeli (1), akhjob (1), Financisto (1), realpseudozach (1)
 #1

Table of contents

      1. Introduction
      2. Creating a payment channel
             a) Disabling Trampoline routing
      3. Sending a payment
      4. Receiving a payment
      5. Closing a channel
      6. Frequently Asked Questions


1. Introduction

You don't know what the Lightning Network is? Visit "Basics of The Lightning Network" and "The Lightning Network FAQ" first.

The Lightning Network support has been introduced in the recent Electrum update (4.0.1). Lightning Network support is experimental - neither I nor Electrum are responsible for any loss of funds. This guide has been updated for the 4.1.1 version. The walkthrough for versions prior to 4.1.0 can be found here.

Important things to note:

- a P2WPKH wallet is required; this type of wallet is now the default for standard wallets,
- Lightning funds cannot be restored from seed. You need to perform backups ('File -> Save backup'). You have to make a new backup every time you open a new channel. Backups will forcefully close channels,
- do not copy your wallet file! If you run an old copy of your wallet with active LN channels, some nodes might broadcast a penalty transaction if any of your channels' balance has changed,
- in a case of an uncooperative channel close, you have limited time to verify if the other node didn't cheat by broadcasting an old state of the channel (see #5),
- you cannot open a channel smaller than 0.002 BTC,
- Electrum creates private channels which do not route payments.


2. Creating a payment channel

Payment channels related options are available under 'Channels' tab which is hidden by default. You can enable it by going to 'View -> Show Channels'



In the 'Channels' tab there are two available options. 'Swap' allows to exchange on-chain coins for an LN incoming payment and vice-versa. 'Open Channel' allows you to create a new payment channel. Click on that option.



By default, Electrum does not download the network graph and delegates path estimation to special trampoline nodes to which only you can connect. If you want to open a channel to any Lightning node, see Disabling Trampoline routing.

As for now, there are three hard-coded trampoline nodes: ACINQ, Electrum and Hodlister which you can choose from the drop down list. The minimum funding value is 0.002 BTC.



Next, you have to select the funding transaction fee. If the transaction is not confirmed within 24 hours, the channel won't be created. It is another hard-coded value.



You might encounter these two errors when opening a channel, the former was mentioned above. The latter is other node's fault. Choose a different node if it happens.





Your payment channel will become active once your transaction reaches 3 confirmations.


a) Disabling Trampoline routing

At the top of the Electrum window, select "Tools -> Preferences".



Select "Lightning" tab and make sure that "Use trampoline routing (disable gossip)" is unticked. Close the window.



You should see a new icon in the bottom-right corner. The number indicates the progress of obtaining information about all publicly known nodes and channels. Having an up-to-date map of the network might help with finding the best route for your payments.



Now, you can open a channel to any Lightning Network node. If you are not sure which node you should choose, select 'Suggest'. If you want to decide on your own then use this Lightning Network explorer to find a suitable node.




3. Sending a payment

Invoiceless payments are not standardized yet, so you need to get an invoice from the person your are trying to send your coins to. Lightning Network payments are routed through other nodes if you are not directly connected to the recipient. Such payments might fail from time to time if there is no route available to the destination node or if the payments is too large. The latter problem has been addressed by splitting one large payment into multiple smaller ones, but this feature is not available in this release. Note that each node participating in the routing process might charge a small fee.

Go to the 'Send' tab and paste your invoice. 'Description' field will be automatically filled since this information is usually provided in the invoice. Note that you will not be able to send all of your coins. Each channel must maintain a reserve for its closure fees. You can see how much you can send from each channel by going to the 'Channels' tab, right-clicking on a channel and selecting 'Details...'. You cannot send from multiple channels at once.



Your transaction might be instant or it might take a few seconds. I have sent a transaction worth about $5.59 (0.00065301 BTC) and paid only a 1 satoshi fee. Your transaction will look like this in the 'History' tab:




4. Receiving a payment

Before you create an invoice, you need to learn how much you can receive. Your inbound capacity depends on if there is any remote balance on any of the channels. You can't receive payments without spending any coins. Switch to 'Channels' tab, right-click on a channel and select "Details...". You will see 'Can Receive' there. Note that an incoming payment will be sent via a single route to one of your channels so you shouldn't add up all of your channels' inbound capacity just like Electrum does in the 'Channels' tab.



To create an invoice, go to 'Receive', fill out 'Description' and 'Requested amount', optionally change when the invoice should expire and press 'Lightning'. Your invoice will be shown on the right side. Copy it and send it to the other person. Keep in mind that you can't receive payments over the Lightning Network if Electrum is turned off.




Closing a channel

Closing a channel is really simple. Go to the 'Channels' tab, right-click on the channel you want to close and select 'Close channel'. You should use 'Force-close channel' only if the other party is offline. In such a case, you will get your funds back after up to two weeks (2016 blocks). Most channels can be force-closed with a 144 block (~1 day) delay. In both cases, you won't be able to specify the closing transaction fee. Other implementations have such a feature.




5. Frequently Asked Questions

Can I make money off payment routing?

No, Electrum creates private channels which are not advertised across the network so they cannot be used for payment routing.

Can I open a channel if I use a hardware wallet?

Yes, you will need to connect your hardware wallet to sign the channel opening transaction. You won't need your hardware wallet to send Lightning payments.

Why does my payment fail? "Payment failed. No path found"

There are a couple of possible causes:

1) The receiver might not have enough incoming liquidity,
2) There is no path between the nodes both of you are connected to,
3) There is an available path, but the payment is too large to go through,

Is there any risk in using the Lightning Network?

The biggest risk is that the other person might attempt to steal your coins by broadcasting an old state of the channel when you are offline. This can be feasible for the other party if you sent some coins and received them back through the same channel at some point.

Electrum founds channels with a to_self_delay of 1024 blocks (~1 week), so this means that you can be safely offline for slightly less than a week. As for now, this value can be only changed directly in the code. If you are afraid of losing funds, you should set up a watchtower or use a different implementation and run your node 24/7.
arorts
Sr. Member
****
Offline Offline

Activity: 408
Merit: 250


View Profile
July 05, 2020, 04:23:00 PM
 #2

Great guide!!

What's the best resolution if stuck with "Reestablishing" channel status for hours and no visible option for a cooperative close?
I already hit the "Freeze (for sending)" option.

Should I just go ahead and force close the channel before taking my computer offline?
Rath_ (OP)
aka BitCryptex
Legendary
*
Offline Offline

Activity: 1876
Merit: 3139



View Profile
July 05, 2020, 04:34:25 PM
 #3

What's the best resolution if stuck with "Reestablishing" channel status for hours and no visible option for a cooperative close?

What about the funding transaction? Has it been confirmed yet? As far as I remember, I got the same status when I accidentally closed Electrum before the transaction got confirmed. Electrum might have lost the connection to the node you are trying to open a channel with. In my case, the status changed to 'OPEN' after the transaction has been confirmed.

Should I just go ahead and force close the channel before taking my computer offline?

You should be fine without the force-close for now.
arorts
Sr. Member
****
Offline Offline

Activity: 408
Merit: 250


View Profile
July 05, 2020, 05:31:15 PM
 #4

Thanks. I just discovered I didn't get to sign/broadcast the transaction (but I'm not interested anymore in proceeding with it either).

Is it better to let it expire by itself or force close? Not sure how long it'd take if left alone.
Rath_ (OP)
aka BitCryptex
Legendary
*
Offline Offline

Activity: 1876
Merit: 3139



View Profile
July 05, 2020, 05:53:43 PM
 #5

Is it better to let it expire by itself or force close? Not sure how long it'd take if left alone.

Channels time out if the funding transaction is not confirmed within 24 hours so you can leave it be. I am not sure how a force-close would behave in this situation. Theoretically, it shouldn't have any impact on your wallet since you didn't sign the funding transaction.
ysangkok
Newbie
*
Offline Offline

Activity: 10
Merit: 3


View Profile
July 06, 2020, 04:46:07 PM
 #6

He claims that not all bc1 wallets will work with the Lightning Network.
Only P2WPKH wallets will work, i.e. multi-sig.
2FA and other P2WSHs will not work.

Using P2WPKH does not imply you are using multi-sig, your 'i.e.' is wrong.

Funds spent to bc1 addresses can either be P2WPKH or P2WSH. The length would determine which of these it is.

I think Electrum will not allow you to enable Lightning if you have the wrong wallet type. So I don't know if it really make sense to warn about this up-front, users will find out.
arorts
Sr. Member
****
Offline Offline

Activity: 408
Merit: 250


View Profile
July 06, 2020, 06:06:24 PM
 #7

Channels time out if the funding transaction is not confirmed within 24 hours so you can leave it be. I am not sure how a force-close would behave in this situation. Theoretically, it shouldn't have any impact on your wallet since you didn't sign the funding transaction.

At the moment, the channel status remains unchanged as "reestablishing" so I tried to force close (it warned me it'd take up to 600 blocks to get funds back) but it ultimately failed as it threw this error:

https://imgur.com/a/1HghOwk

It seems as if unsigned Txs have a longer time lock than signed Txs so I guess I shouldn't have to wait longer than 600 blocks to report back my findings.
zx9r_
Newbie
*
Offline Offline

Activity: 23
Merit: 0


View Profile
July 06, 2020, 07:30:17 PM
 #8

Nice tutorial.

Just a typo: When you say "To create an invoice, go to 'Send', fill out 'Description' and 'Requested amount', optionally change when the invoice should expire and press 'Lightning'."

just replace "go to 'Send'" with "go to 'Receive'"
pooya87
Legendary
*
Offline Offline

Activity: 3668
Merit: 11107


Crypto Swap Exchange


View Profile
July 07, 2020, 04:17:17 AM
 #9

Quote
a native SegWit wallet is required (your addresses should start with bc1)
He claims that not all bc1 wallets will work with the Lightning Network.
Only P2WPKH wallets will work, i.e. multi-sig.
2FA and other P2WSHs will not work.

for reference: https://github.com/spesmilo/electrum/blob/01a2d127878642c8bcb123e5e7f3de744aeb071c/electrum/wallet.py#L314-L316

by the way P2WPKH is a simple single signature script similar to P2PKH (addresses starting with 1) and has nothing to do with multi-sig. similarly P2WSH is simply a pay to "script hash" scripts which can be multi-sig or any other script.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
igor72
Legendary
*
Offline Offline

Activity: 2044
Merit: 2100


Crypto Swap Exchange


View Profile
July 07, 2020, 05:05:25 AM
Merited by nc50lc (1)
 #10

He claims that not all bc1 wallets will work with the Lightning Network.
Only P2WPKH wallets will work, i.e. multi-sig.
2FA and other P2WSHs will not work.
You made a little typo here, but it changed what I said  Wink.

Here's the corrected text:
Quote
He claims that not all bc1 wallets will work with the Lightning Network.
Only P2WPKH wallets will work. It means that bc1 multi-sig, 2FA and other P2WSHs will not work.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
Rath_ (OP)
aka BitCryptex
Legendary
*
Offline Offline

Activity: 1876
Merit: 3139



View Profile
July 07, 2020, 09:46:50 AM
 #11

Does "- a P2WPKH wallet is required; this type of wallet is now the default for standard wallets" or "- P2WPKH addresses are required; this kind of addresses are now the default for standard wallets" sound better? Either should be more understandable for most people.

So I don't know if it really make sense to warn about this up-front, users will find out.

SegWit has been the default wallet kind for some time now, but I wanted to mention it in case someone tried to send some coins to an old legacy wallet to test out the LN support. Transaction fees are relatively low right now, but they tend to change rapidly. It could help someone save some money on the fees and there is no harm in mentioning it.

just replace "go to 'Send'" with "go to 'Receive'"

Thanks, fixed.
nc50lc
Legendary
*
Offline Offline

Activity: 2632
Merit: 6512


Self-proclaimed Genius


View Profile
July 07, 2020, 12:07:39 PM
 #12

Does "- a P2WPKH wallet is required; this type of wallet is now the default for standard wallets" or "- P2WPKH addresses are required; this kind of addresses are now the default for standard wallets" sound better? Either should be more understandable for most people.
The former sounds right, the latter suggests that a wallet with imported P2WPKH addresses can be used for LN.

Tried it and the "enable" button is disabled for imported wallet with a single native SegWit address.
But it might change in the future because of this message when I clicked help:
Quote from: Electrum 4.0.1
Lightning is currently restricted to HD wallets with p2wpkh addresses.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
wchancao
Newbie
*
Offline Offline

Activity: 9
Merit: 1


View Profile
July 19, 2020, 01:45:52 PM
Merited by JayJuanGee (1)
 #13

Hello, i have enable Lightning on Electrum following your steps, channel is Open, but i cant send using Lightning, i have tried sending to 3 different wallets (BLW, Phoenix and Wallet of  Satoshi) and all 3 give me the "Payment Failed. No path found" error. What could it be? How can I solve this issue?
Chikito
Legendary
*
Offline Offline

Activity: 2604
Merit: 2090


Top-tier crypto casino and sportsbook


View Profile WWW
July 19, 2020, 02:16:16 PM
Merited by JayJuanGee (1), Rath_ (1)
 #14

Hello, i have enable Lightning on Electrum following your steps, channel is Open, but i cant send using Lightning, i have tried sending to 3 different wallets (BLW, Phoenix and Wallet of  Satoshi) and all 3 give me the "Payment Failed. No path found" error. What could it be? How can I solve this issue?

Maybe you have change amount/base unit btc into sat at preference.

 


 
 BETFURY .....
██████▄██▄███████████▄█▄
█████▄█████▄████▄▄▄█
███████████████████
████▐███████████████████
███████████▀▀▄▄▄▄███████
██▄███████▄▀███▀█▀▀█▄▄▄█
▀██████████▄█████▄▄█████▀██
██████████▄████▀██▄▀▀▀█████▄
█████████████▐█▄▀▄███▀██▄
███████▄▄▄███▌▌█▄▀▀███████▄
▀▀▀███████████▌██▀▀▀▀▀█▄▄▄████▀
███████▀▀██████▄▄██▄▄▄▄███▀▀
████████████▀▀▀██████████
 
..... UP TO 60% APR BTC STAKING .....

 
 Exclusive 200% APR in USDT
& Extra Bonus
▬▬▬▬▬ ◤◤
█▀▀











█▄▄
CODE: BTSTAKE
 
...STAKE NOW...
▀▀█











▄▄█
Rath_ (OP)
aka BitCryptex
Legendary
*
Offline Offline

Activity: 1876
Merit: 3139



View Profile
July 19, 2020, 02:48:31 PM
Last edit: July 19, 2020, 03:12:39 PM by BitCryptex
Merited by JayJuanGee (1)
 #15

i have tried sending to 3 different wallets (BLW, Phoenix and Wallet of  Satoshi) and all 3 give me the "Payment Failed. No path found" error. What could it be? How can I solve this issue?

Either the node with which you opened a channel is badly connected or there aren't any nodes with enough liquidity to route your payment. You might have made a mistake from the post above. If you didn't specify the node manually when opening the channel then Electrum should have suggested a well-connected node. I am not sure about BlueWallet and Wallet of Satoshi since they are custodial wallets, but channels created using the Phoenix wallet definitely do not have any inbound capacity by default. You will have to spend some of your coins before attempting to receive to it. That's also the case for Eclair Mobile.
wchancao
Newbie
*
Offline Offline

Activity: 9
Merit: 1


View Profile
July 19, 2020, 10:59:33 PM
 #16

i have tried sending to 3 different wallets (BLW, Phoenix and Wallet of  Satoshi) and all 3 give me the "Payment Failed. No path found" error. What could it be? How can I solve this issue?

Either the node with which you opened a channel is badly connected or there aren't any nodes with enough liquidity to route your payment. You might have made a mistake from the post above. If you didn't specify the node manually when opening the channel then Electrum should have suggested a well-connected node. I am not sure about BlueWallet and Wallet of Satoshi since they are custodial wallets, but channels created using the Phoenix wallet definitely do not have any inbound capacity by default. You will have to spend some of your coins before attempting to receive to it. That's also the case for Eclair Mobile.

Yes, I used a suggested node from Electrum, so im asumming that node has enough liquidity... I think i din not make  a mistake following the post above, i read twice before starting, and followed it when i was doing it Electrum... One of the channels I already had in Phoenix has enough inbound capacity...
wchancao
Newbie
*
Offline Offline

Activity: 9
Merit: 1


View Profile
July 19, 2020, 11:14:54 PM
 #17

Hello, i have enable Lightning on Electrum following your steps, channel is Open, but i cant send using Lightning, i have tried sending to 3 different wallets (BLW, Phoenix and Wallet of  Satoshi) and all 3 give me the "Payment Failed. No path found" error. What could it be? How can I solve this issue?

Maybe you have change amount/base unit btc into sat at preference.


I'll switch to sats and let you know if it was that silly detail...  Cheesy
nc50lc
Legendary
*
Offline Offline

Activity: 2632
Merit: 6512


Self-proclaimed Genius


View Profile
July 20, 2020, 04:41:40 AM
 #18

-snip-
Yes, I used a suggested node from Electrum, so im asumming that node has enough liquidity... I think i din not make  a mistake following the post above, i read twice before starting, and followed it when i was doing it Electrum... One of the channels I already had in Phoenix has enough inbound capacity...
I'm getting a different error when the receiver's inbound capacity isn't enough, so it can't be the other party's inbound capacity:


I second BitCryptex's first guess, "Payment Failed. No path found" is most likely an issue with your channel's remote node's liquidity.
And I've been getting that error in testnet before when I have only one channel, probably because not all of the suggested nodes are reliable.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
wchancao
Newbie
*
Offline Offline

Activity: 9
Merit: 1


View Profile
July 20, 2020, 11:51:10 AM
 #19

-snip-
Yes, I used a suggested node from Electrum, so im asumming that node has enough liquidity... I think i din not make  a mistake following the post above, i read twice before starting, and followed it when i was doing it Electrum... One of the channels I already had in Phoenix has enough inbound capacity...
I'm getting a different error when the receiver's inbound capacity isn't enough, so it can't be the other party's inbound capacity:
https://i.imgur.com/rJNQZAR.png

I second BitCryptex's first guess, "Payment Failed. No path found" is most likely an issue with your channel's remote node's liquidity.
And I've been getting that error in testnet before when I have only one channel, probably because not all of the suggested nodes are reliable.

Yes, im thinking its the remote node problem, i'll try opening another channel with one of ACINQ's node... i'll let you know how that goes... Which other nodes do you recommend? Thanks for your time and answers!
Rath_ (OP)
aka BitCryptex
Legendary
*
Offline Offline

Activity: 1876
Merit: 3139



View Profile
July 20, 2020, 01:04:36 PM
 #20

Which other nodes do you recommend?

ACINQ's node should be completely fine. You can use 1ml.com to choose another node. Scroll down a little and you should see "Top Capacity Nodes" and "Most Connected Nodes". Any of the nodes listed there should be a good choice.
Pages: [1] 2 3 4 5 6 7 8 9 »  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!