Skip to content

Commit

Permalink
Adding an article to FAQ-LightningNetwork.md
Browse files Browse the repository at this point in the history
 Date:      Thu Feb 20 22:36:10 2020 +0300
 Committer: bereska <[email protected]>

 Changes to be committed:
	modified:   FAQ/FAQ-LightningNetwork.md#

 Changes to be committed:
	modified:   FAQ/FAQ-LightningNetwork.md
	modified:   FAQ/readme.md
  • Loading branch information
bereska authored and bereska committed Feb 21, 2020
1 parent 7c2c627 commit 97841f9
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
53 changes: 53 additions & 0 deletions FAQ/FAQ-LightningNetwork.md
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,59 @@ cd btcpayserver-docker
export LIGHTNING_ALIAS="namehere"
. ./btcpay-setup.sh -i
```
### How to back up LND channels offsite
Currently your BTCPay Server Docker on every change in channels state saves static channels backup (SCB) locally on the same disk (on-site). This poses a threat to LN off-chain funds recovery in case of the server crash or fatal data loss.
IMPORTANT: to recover your LN on-chain and off-chain funds you need two things: LN wallet seed and SCB.
Every time a change is made to channel.backup file in your BTCPay Server docker it will instantly be copied to your remotes.
The following procedure will allow you to keep the latest SCB offsite (on a remote server and/or popular cloud):
NOTE: this has been tested on Linux systems only.

1. Ssh into your BTCPay Server and run ```lnd-channels-backup-dependencies.sh``` script.

```bash
sudo su -
cd btcpayserver-docker
./lnd-channels-backup-dependencies.sh
```

2. Copy your btcpayserver ssh key to your remote server and create btcpayserver directory there. Replace USER_NAME and IP wihth remote server credentials.

```bash
cat /root/.ssh/id_ed25519_btcpayserver | ssh USER_NAME@IP "mkdir ~/btcpayserver ~/.ssh; cat >> ~/.ssh/authorized_keys"
```

3. Configure rclone for a cloud storage of your choice and note your newly configured remote name. You will need it for the next step.
Please refer to this guide https://rclone.org/docs/
NOTE: you need to create a new folder btcpayserver in your cloud storage where your SCB will be synced to.

4. edit ```lnd-channels-remote-backup-on-change.sh``` script to add your remote server credentials and configured rclone remote from step 2 & 3.

```bash
nano lnd-channels-remote-backup-on-change.sh
```
Edit these two lines:

```
remote_server1="YOUR_REMOTE_SERVER_USER_NAME@YOUR_REMOTE_SERVER_IP:~/btcpayserver/"
cloud1="YOUR_RCLONE_REMOTE:btcpayserver/"
```

5. Run ```lnd-channels-backup-systemd.sh``` script to finally set it up on your system.

```bash
./lnd-channels-backup-systemd.sh
```

6. Test it

```bash
touch /var/lib/docker/volumes/generated_lnd_bitcoin_datadir/_data/data/chain/bitcoin/mainnet/channel.backup
```

Ssh into your remote server and log into your cloud to see the latest SCB (channel.backup file in ~/btcpayserver).

Now you have your latest SCB off-site!


## Lightning Network (c-lightning) FAQ

Expand Down
1 change: 1 addition & 0 deletions FAQ/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ Lightning Network troubleshooting and common problems.
* [What’s the default LND Directory in BTCPay?](FAQ-LightningNetwork.md#whats-the-default-directory-of-lnd-in-btcpay)
* [LND connection issue - cannot get macaroon: root key with id 0 doesn’t exist](FAQ-LightningNetwork.md#lnd-connection-issues-after-an-update)
* [How to change LND Node alias](FAQ-LightningNetwork.md#how-to-change-my-LND-Node-alias)
* [How to back up LND channels offsite?](FAQ-LightningNetwork.md#how-to-back-up-lnd-channels-offsite)

### [Lightning Network (c-lightning) FAQ](FAQ-LightningNetwork.md#lightning-network-c-lightning-faq)
* [How to find an on-chain address in Spark?](FAQ-LightningNetwork.md#how-to-find-an-on-chain-address-in-spark)
Expand Down

0 comments on commit 97841f9

Please sign in to comment.