Bitcoin Forum

Bitcoin => Electrum => Topic started by: FibonacciTrader on August 13, 2023, 01:45:54 AM



Title: Can lightning channel be recovered from seed phrase?
Post by: FibonacciTrader on August 13, 2023, 01:45:54 AM
If a user has an open Lightning channel, their Electrum wallet file gets destroyed, and they restore their Electrum wallet from seed phrase, will the Lightning channel be recoverable or will it be lost?


Title: Re: Can lightning channel be recovered from seed phrase?
Post by: Shishir99 on August 13, 2023, 01:59:53 AM
If you restore the Electrum wallet from the seed phrase, the Lightning channel should be recoverable. Because the seed phrase is used to bring out all the private keys and addresses associated with your wallet including those which was used for Lightning channels.

If you restore your Electrum wallet, the wallet will regenerate all the necessary private keys and addresses including those which was used for the Lightning channels. Your Lightning channel's state is stored on the blockchain, and the private keys associated with your channels are executed from your seed phrase. Your existing Lightning channel information such as channel balances and channel state should be restored with the rest of your wallet.


Title: Re: Can lightning channel be recovered from seed phrase?
Post by: FibonacciTrader on August 13, 2023, 02:34:04 AM
Your Lightning channel's state is stored on the blockchain, and the private keys associated with your channels are executed from your seed phrase. Your existing Lightning channel information such as channel balances and channel state should be restored with the rest of your wallet.

I appreciate your reply. My basic understanding is that the amount contributed to a Lightning channel is on-chain, but the channel state is stored offline (channel peer-to-peer) to avoid the on-chain transaction fees. Given that, how does Electrum know how to find the offline channel state based on the seed phrase alone?


Title: Re: Can lightning channel be recovered from seed phrase?
Post by: Shishir99 on August 13, 2023, 04:11:06 AM
Your Lightning channel's state is stored on the blockchain, and the private keys associated with your channels are executed from your seed phrase. Your existing Lightning channel information such as channel balances and channel state should be restored with the rest of your wallet.

I appreciate your reply. My basic understanding is that the amount contributed to a Lightning channel is on-chain, but the channel state is stored offline (channel peer-to-peer) to avoid the on-chain transaction fees. Given that, how does Electrum know how to find the offline channel state based on the seed phrase alone?

Seems like I misunderstood. But I  guess there is some confusion in your understanding as well. The lightning network is 2nd layer scaling solution of a blockchain. The channels are funded with on-chain transactions. But when you participate in a lightning network, those transactions, balance, and channel states are off-chain. It's a 2nd layer blockchain. The lightning network transactions are not on the main blockchain.

The lightning channel state is stored locally within your Electrum wallet software. So I guess Electrum doesn't find an offline channel state based on the seed phrase alone. Wait for the expert guys. I have to learn more about these things as well!


Title: Re: Can lightning channel be recovered from seed phrase?
Post by: nc50lc on August 13, 2023, 04:44:09 AM
If a user has an open Lightning channel, their Electrum wallet file gets destroyed, and they restore their Electrum wallet from seed phrase, will the Lightning channel be recoverable or will it be lost?
It depends, it's only possible if you've enabled the setting "Create recoverable channels" when you created the channel.
The setting can be found in the small setting icon on the upper-right hand of Open channel window.
It can't be enabled (grayed-out) if you're using hardware wallet, using BIP39 seed or have a nodeID before the feature implementation (v4.1.0):
https://www.talkimg.com/images/2023/08/13/GbCJd.png

In case you want to check if your channels are recoverable from seed, the channel's icon on the left side of channels tab shouldn't have a "crossed-out blue cloud" icon.
Another indication is by checking the "open channel" transaction if it has a "SCRIPT" output containing OP_RETURN encrypted data from your lightning nodeID.

However, just like a manual channel backup, it's only a "static backup" which can't be used to spend or receive,
the only thing you can do to it is to request to force-close the channel to retrieve the funds.


Title: Re: Can lightning channel be recovered from seed phrase?
Post by: FibonacciTrader on August 13, 2023, 08:29:25 PM
The setting can be found in the small setting icon on the upper-right hand of Open channel window.
It can't be enabled (grayed-out) if you're using hardware wallet, using BIP39 seed or have a nodeID before the feature implementation (v4.1.0):

Thank you, @nc50lc ! I was able to export a QR code backup by right-clicking on the channel -> 'Export backup'
https://talkimg.com/images/2023/08/13/GDibd.png
Electrum says it can be recovered by scanning the QR code from the Electrum mobile app.

Note that I use a BIP39 seed and was still able to create the Lightning channel backup.

Cheers.


Title: Re: Can lightning channel be recovered from seed phrase?
Post by: nc50lc on August 14, 2023, 03:16:04 AM
Note that I use a BIP39 seed and was still able to create the Lightning channel backup.
The limitation is only applicable to the automatic channel backup (recoverable channels) that can be recovered via seed phrase.
Manual backup works in BIP39 seed or hardware wallet.

So as originally asked, your channels wont be recovered from seed phrase.