Difference between revisions of "Backup/Recovery"

From PlebNet Wiki
Jump to navigation Jump to search
Line 1: Line 1:
Running an LN Node involves a certain level of risk and there is a possibility to lose funds however by following some simple steps could drastically reduce the possibility of losing funds.
Running an LN Node involves a certain level of risk and there is a possibility to lose funds however by following some simple steps you could drastically reduce the possibility of losing funds.


Let's look at backing up channels first:
Let's look at backing up channels first:

Revision as of 04:25, 22 August 2021

Running an LN Node involves a certain level of risk and there is a possibility to lose funds however by following some simple steps you could drastically reduce the possibility of losing funds.

Let's look at backing up channels first:

LND has a way to get a file that stores a backup of your channels using a method called Static Channel Backups or SCB. Instead of trying to maintain the latest channel state, the static channel backup package will attempt to notify remote peers to force close the channel. This will prevent users from accidentally broadcasting an old state and allow them to close out and receive their local balance. Note that when you use an SCB you will receive your funds fairly quickly as the time lock for force closures will only apply to the peers initiating the force closure and not the other peer. An SCB file is updated when a channel is opened or closed. Channel information is added to the SCB when it's opened and is removed from the SCB when it's closed. Important Note: SCBs will not restore your node back to normal, they are only a way to recover all the funds in your on-chain wallet and the funds on the local side of your channels (off-chain).

How to obtain an SCB? There are several ways to obtain an SCB. 1. Using BOS telegram bot (recommended): https://plebnet.wiki/wiki/Umbrel_-_Installing_BoS 2. Umbrel users: Can contact Umbrel for receiving your SCB if your node goes down. 3. Non-Umbrel users: Using ThunderHub, there is an option to download the latest backup from the tools option. 4. Using lncli: lncli exportchanbackup

BOS Telegram is a recommended way because it automatically sends you an SCB file to your telegram bot every time a channel is opened/closed, the other methods are a manual process and there is a risk of not maintaining the latest backup.

RECOVERY:

Shit happens! If your node ever goes down and you can't bring it back up again:

1. You still have access to your node: You will need your 24-word cipher seed and the SCB. Follow these instructions after -> https://github.com/lightningnetwork/lnd/blob/master/docs/recovery.md#recovering-using-scbs (Use lncli restorechanbackup)

2. There is a possibility that you don't have access to your node (might have gotten destroyed in a nuclear attack): In this scenario, you will need to start a new node to recover funds. You will need your 24-word cipher seed and the SCB. You can set up a new node in neutrino mode to save time, neutrino is a lightweight client that allows you to run an LN node without Bitcoin core. You can create a new neutrino node by following these instructions by Alex Bosworth: https://github.com/alexbosworth/ln-service These instructions are for creating a node on AWS EC2, however, you can create one on your laptop/desktop or on a Raspberry Pi. After you start a new node on neutrino, you can follow the same recovery instructions: https://github.com/lightningnetwork/lnd/blob/master/docs/recovery.md#recovering-using-scbs (use lncli create -multi_file=channel.backup) Note: Replace channel.backup with the name of your backup file.

3. ALL HOPE IS LOST (No SCB): If you don't have an SCB and all you have is your 24-word cipher seed, there is a possibility to recover your funds (no promises). First, contact all your peers and ask them to force close on you manually. After the force closure confirms, follow these instructions: https://github.com/guggero/chantools/blob/master/doc/chantools_genimportscript.md


Exception Scenarios:

1. Node goes down during an in-flight HTLC: If there was a payment that was in-flight that was being routed through your node or payment you were making and your node goes down and does not come back up, sorry, there is no way to recover funds that are stuck in the HTLC as of now but you can recover all the other on-chain and off-chain funds. This is probably a very extreme scenario.

2. You initiated a force closure, funds are still stuck in time-lock: If you initiate a force closure, the funds are locked for a certain number of blocks. If the node goes down during the time-lock period of a force closure initiated by you, unfortunately, LND has a bug today which removes the channel details from the latest SCB before the time-lock expires. The way to recover these funds would be to use an older SCB that you might have before the channel details were removed and use it start the recovery as shown in the previous steps and you will receive your funds back to your on-chain wallet after the time-lock expires. BOS Telegram bot can be a real savior in this scenario because the chat history with the bot will have older SCBs that you can use to recover funds. Lightning Labs say they will be fixing this in 0.14.0-beta. If you don't have an older SCB, unfortunately, there is no other way as of today to recover those funds, this also is an extreme scenario.