Pages:
Author

Topic: Electrum Lightning Network walkthrough - page 9. (Read 4930 times)

legendary
Activity: 1876
Merit: 3132
July 05, 2020, 11:34:25 AM
#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.
sr. member
Activity: 408
Merit: 250
July 05, 2020, 11:23:00 AM
#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?
legendary
Activity: 1876
Merit: 3132
July 04, 2020, 01:39:46 PM
#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.
Pages:
Jump to: