From ab77030cbec0a08dee559aa2af9a32367dc0f49e Mon Sep 17 00:00:00 2001 From: ShahanaFarooqui Date: Wed, 15 Nov 2023 15:39:06 -0800 Subject: [PATCH] doc: Recovery using database - Adds instructions to recover the wallet with database - Breaks the recovery subtitle into separate page Changelog-None. --- doc/beginners-guide/backup-and-recovery.md | 29 ------------ .../backup-and-recovery/recovery.md | 46 +++++++++++++++++++ 2 files changed, 46 insertions(+), 29 deletions(-) create mode 100644 doc/beginners-guide/backup-and-recovery/recovery.md diff --git a/doc/beginners-guide/backup-and-recovery.md b/doc/beginners-guide/backup-and-recovery.md index 4599c02cd..2f66e063a 100644 --- a/doc/beginners-guide/backup-and-recovery.md +++ b/doc/beginners-guide/backup-and-recovery.md @@ -113,32 +113,3 @@ lightningd also stores detailed information of funds locked in Lightning Network Real-time database replication is the recommended approach to backing up node data. Tools for replication are currently in active development, using the db write plugin hook. Click [here](doc:advanced-db-backup) to learn more about advanced DB backup methods. - - -## Recovery - -> 🚧 -> -> **Only** recover from database if you are sure that it is **latest**. -> -> Snapshot-style backups of the lightningd database is **discouraged**, as _any_ loss of state may result in permanent loss of funds. -> -> See the [penalty mechanism](https://github.com/lightning/bolts/blob/master/05-onchain.md#revoked-transaction-close-handling) for more details. - - -### Using `emergency.recover` - - - Copy the valid binary formatted `hsm_secret` into `$LIGHTNINGDIR` directory - - Copy the latest `emergency.recover` backup file into the `$LIGHTNINGDIR` before starting up the node - - Start `lightningd` - - Run `lightning-cli emergencyrecover` (RPC command)[https://docs.corelightning.org/reference/lightning-emergencyrecover] to recover all the channels on the node. - - Wait until your peer force closes the channel and the node would automatically sweep the funds. This could take some time. - - -### Using `--recover` flag - - - Copy the latest `emergency.recover` backup file into the `$LIGHTNINGDIR` before starting up the node - - Start `lightningd --recover=`. It will automatically generate your node's hsm_secret using the codex32 secret. - - The node will initiate in offline mode. As a result, it won't establish connections with peers automatically. - - Restart `lightningd`. - - Run `lightning-cli emergencyrecover` (RPC command)[https://docs.corelightning.org/reference/lightning-emergencyrecover] to recover all the channels on the node. diff --git a/doc/beginners-guide/backup-and-recovery/recovery.md b/doc/beginners-guide/backup-and-recovery/recovery.md new file mode 100644 index 000000000..70415dbdb --- /dev/null +++ b/doc/beginners-guide/backup-and-recovery/recovery.md @@ -0,0 +1,46 @@ +--- +title: "Wallet Recovery" +slug: "recovery" +excerpt: "Learn about various recovery methods." +hidden: false +--- + + +## Recovery + + +### Using `emergency.recover` + + - Copy the valid binary formatted `hsm_secret` into `$LIGHTNINGDIR` directory + - Copy the latest `emergency.recover` backup file into the `$LIGHTNINGDIR` before starting up the node + - Start `lightningd` + - Run `lightning-cli emergencyrecover` (RPC command)[https://docs.corelightning.org/reference/lightning-emergencyrecover] to recover all the channels on the node + - Wait until your peer force closes the channel and the node would automatically sweep the funds. This could take some time + + +### Using `--recover` flag + + - Copy the latest `emergency.recover` backup file into the `$LIGHTNINGDIR` before starting up the node + - Start `lightningd --recover=`. It will automatically generate your node's hsm_secret using the codex32 secret + - The node will initiate in offline mode. As a result, it won't establish connections with peers automatically + - Restart `lightningd` + - Run `lightning-cli emergencyrecover` (RPC command)[https://docs.corelightning.org/reference/lightning-emergencyrecover] to recover all the channels on the node + + +> 🚧 +> +> **Only** recover from database if you are sure that it is **latest**. +> +> Snapshot-style backups of the lightningd database is **discouraged**, as _any_ loss of state may result in permanent loss of funds. +> +> See the [penalty mechanism](https://github.com/lightning/bolts/blob/master/05-onchain.md#revoked-transaction-close-handling) for more details. + + +### Using database + +If you already have **latest** wallet backup and hsm_secret, it is technically not recovery. It is similar to restarting your lightning node. + + - Copy the DB backup `lightningd.sqlite3` from your NFS backup directory into `$LIGHTNINGDIR` directory + - Either copy the valid binary formatted `hsm_secret` into `$LIGHTNINGDIR` directory and start `lightningd` + - Or start lightningd with recover flag (`lightningd --recover=`) + - Note that `emergency.recover` backup file is not required here but you can copy it into `$LIGHTNINGDIR` directory (if exists)