Builder's Guide
  • Welcome to the Builder's Guide to the LND Galaxy!
  • The Lightning Network
    • Overview
    • Payment Channels
      • Lifecycle of a Payment Channel
      • Watchtowers
      • Understanding Sweeping
      • Etymology
    • The Gossip Network
      • Identifying Good Peers on the Lightning Network
    • Pathfinding
      • Finding routes in the Lightning Network
      • Channel Fees
      • Multipath Payments (MPP)
    • Lightning Network Invoices
      • Understanding Lightning Invoices
    • Making Payments
      • The Payment Cycle
      • Timelocks
      • ⭐Hashed Timelock Contract (HTLC)
      • Payment Etymology
      • ⭐What Makes a Good Routing Node
      • Understanding Submarine Swaps
      • Instant Submarine Swaps
    • Liquidity
      • ⭐Understanding Liquidity
      • Managing Liquidity on the Lightning Network
      • Liquidity Management for Lightning Merchants
      • How to Get Inbound Capacity on the Lightning Network
      • Lightning Service Provider
    • L402: Lightning HTTP 402 Protocol
      • Macaroons
      • L402
      • 📋Protocol Specification
      • Implementations and Links
    • Taproot Assets
      • Taproot Assets Protocol
      • Taproot Assets on Lightning
      • Edge Nodes
      • Taproot Assets Trustless Swap
      • FAQ
      • Glossary
  • Lightning Network Tools
    • LND
      • 🛠️Get Started
      • lnd.conf
      • First Steps With LND
      • Wallet Management
      • Sending Payments
      • Atomic Multi-path Payments (AMP)
      • Receiving Payments
      • Unconfirmed Bitcoin Transactions
      • Channel Fees
      • Inbound Channel Fees
      • Macaroons
      • Configuring Watchtowers
      • Pathfinding
      • Blinded Paths
      • Key Import
      • Secure Your Lightning Network Node
      • Configuration of a Routing Node
      • Quick Tor Setup
      • Configuring Tor
      • Enable ‘Neutrino mode’ in Bitcoin Core
      • Send Messages With Keysend
      • Partially Signed Bitcoin Transactions
      • Bulk onchain actions with PSBTs
      • Sweeper
      • Debugging LND
      • Fuzzing LND
      • LND API documentation
      • Channel Acceptor
      • RPC Middleware Interceptor
      • HTLC Interceptor
      • NAT Traversal
      • Recovery: Planning for Failure
      • Migrating LND
      • Disaster recovery
      • Contribute to LND
    • Lightning Terminal
      • What is Lightning Terminal?
      • 🛠️Get litd
      • Run litd
      • Integrating litd
      • Demo: Litd Speed Run
      • Connect to Terminal
      • Recommended Channels
      • Rankings
      • Health Checks
      • Liquidity Report
      • Opening Lightning Network Channels
      • Managing Channel Liquidity
      • Autofees
      • AutoOpen
      • LND Accounts
      • Loop and Lightning Terminal
      • Loop Fees
      • Pool and Lightning Terminal
      • Command Line Interface
      • Troubleshooting
      • Lightning Node Connect: Under the hood
      • LNC Node Package
      • LITD API Documentation
      • Privacy and Security
      • Privacy Policy
      • Terms of Use
    • Loop
      • 🛠️Get Started
      • The Loop CLI
      • Autoloop
      • Static Loop In Addresses
      • Instant Loop Outs
      • Peer with Loop
      • Loop API Documentation
    • Pool
      • Overview
      • Quickstart
      • 🛠️Installation
      • First Steps
      • Accounts
      • Orders and Asks
      • Sidecar Channels
      • Zero-confirmation Channels
      • Channel Leases
      • Batch Execution
      • Account Recovery
      • Pool API Documentation
      • FAQs
    • Taproot Assets
      • Get Started
      • First Steps
      • Taproot Assets Channels
      • Asset Decimal Display
      • Become an Edge Node
      • RFQ
      • Collectibles
      • Universes
      • Asset Loop
      • Debugging Tapd
      • Multisignature
      • Minting Assets With an External Signer
      • Lightning Polar
      • Operational Safety Guidelines
      • Taproot Assets API Documentation
    • Aperture
      • ⚒️Get Aperture
      • LNC Backend
      • LNC Mailbox
      • Pricing
    • Faraday
      • 🛠️Get Started
      • The Faraday CLI
      • Faraday API Documentation
  • LAPPs
    • Guides
      • Use Polar to Build Your First LAPP
        • Setup: Local Cluster with Polar
        • Setup: Run the Completed App
        • Setup: Run the App Without LND
      • Add Features
        • Feature 1: Connect to LND
        • Feature 2: Display Node Alias and Balance
        • Feature 3: Sign and Verify Posts
        • Feature 4: Modify Upvote Action
      • Make Your own LNC-powered Application
    • Next Steps
  • Community Resources
    • Resource List
    • Lightning Bulb 💡
    • Glossary
    • FAQ
Powered by GitBook
On this page
  • 1. Recover as much data as you can
  • 2. Set up a new node
  • 3. Begin the recovery process
  • A) Initialize a new node
  • B) Static channel backup
  • C) Force-closing all other channels
  • D) Manual intervention
  • E) Secure your funds
  • Additional tools

Was this helpful?

  1. Lightning Network Tools
  2. LND

Disaster recovery

Learn how to recover your funds in the event of a catastrophic failure.

PreviousMigrating LNDNextContribute to LND

Last updated 24 days ago

Was this helpful?

Use this guide as a last resort if you have lost access to your node or are unable to start LND due to a fatal error. Before using this guide, carefully examine your logs, to the latest release and conduct a thorough analysis of the problem.

Following this guide will close all your channels. Your funds will become available on-chain with varying speed.

1. Recover as much data as you can

The more data we have from our node, the more successful our recovery will be, and the more quickly we will be able to secure our funds on-chain.

  • Seed phrase (aezeed)

The private key is an absolute must to recover any funds. Most commonly this key is derived from the aezeed seed phrase, but may also be recovered from the master private key found in the wallet.db file, together with the password used to encrypt it. Your seed phrase may have additionally been encrypted with a cipher seed phrase, which differs from your wallet password.

  • Static channel backup (SCB)

The static channel backup is a protocol to close channels once a peer indicates to have suffered from a catastrophic failure. The channel.backup file in .lnd/data/chain/bitcoin/mainnet contains information about each of your peers, how to reach them and your channels. The SCB may also exist as individual text strings for each channel.

Once invoked, your node will ask your peers to send you their latest commitment transaction and force-close your channel, from which you can calculate your keys and sweep your funds.

  • The most recent channel database

The channel.db file can be found in .lnd/data/graph/mainnet and contains all information about your channels, including your latest commitment transaction. Invoking this file as part of your recovery process can be risky if the channel.db is not up to date. Only use this file if you were able to recover it directly from your crashed node.

  • Information about your channels from third parties

In some rare cases, especially with regard to old channels where both peers have suffered failures, we might be unable to close channels with the above tools. It might be useful to consult third-party tools such as to make sure we have closed all channels successfully.

If you still have access to it, you may make a backup of the entire .lnd directory.

2. Set up a new node

To prepare for the recovery process, we will need to a LND node. Depending on the nature of our catastrophic failure, we may use the same node or set up a new node on a new machine.

If we are using the same node, don’t forget to move your old .lnd folder over somewhere else, so that we can start the recovery process with an empty directory.

In any other case, your old node should be turned off during the entire process and beyond.

3. Begin the recovery process

A) Initialize a new node

We will begin the recovery process by initializing our new node. We begin with the command lncli create which will first prompt you for a password. This password must be at least eight characters long and can otherwise be freely chosen.

Next, lnd will offer us to enter a mnemonic seed, at which point we will provide the seed phrase (aezeed) from our old node. If your seed phrase was previously encrypted, we will also need to provide this cipher seed phrase.

Your node will now scan the bitcoin blockchain for eventual on-chain funds it can recover right away. This may take a while.

Once complete, you will be able to check your on-chain wallet balance with lncli walletbalance. You may move out your coins with lncli sendcoins --sweepall <your bitcoin address>

B) Static channel backup

-> Don’t have a SCB file for your node? Skip to the next step.

In this step, we will invoke the channel.backup file. Make sure your node is synced to chain and graph before continuing. You can check the latest status with the command lncli getinfo. We can place it in a separate directory and call it with the command lncli restorechanbackup --multi_file /path/to/file/channel.backup

Alternatively we can initiate the SCB for each channel manually with the command lncli --single_backup <hex encoded channel backup>

This will trigger your node to reach out to its former channel peers and ask them to force close your channels. The funds should arrive in your wallet quickly and be spendable immediately.

Not all of your channel peers will react immediately or be online at the time of your recovery, so it might be worth it to pause at this step and wait for a day or two.

If some channels do not close after this period, but you believe the peers are online, try to obtain their latest IP or onion address and connect to them manually.

C) Force-closing all other channels

-> Don’t have the channel database? Skip to the next step.

If any of our peers do not support SCB, are permanently unavailable or suffered from a catastrophic failure themselves, we will have to initiate the force-close transaction.

D) Manual intervention

E) Secure your funds

Once you have recovered your on-chain funds, don’t forget to sweep them to a separate wallet you control with the command lncli sendcoins --sweepall <your bitcoin address>

Additional tools

You may also consult the following tools and resources as part of your node recovery:

Using external tools such as we can publish the commitment transactions from our channel database ourselves. This can only be done if the channels.db file was recovered directly from the failed node. If our file is not the latest, there is a serious risk our commitment transactions can be invalidated by our channel peers, causing us to lose all funds in these channels.

You can find the documentation for Chantools . It also includes other neat tools that allow you to recover funds from channels that might have been force closed in your absence.

In some instances it may be of advantage to reach out to your channel partners directly and ask them to force close on you. Your peer might have left contact details on a Lightning Network explorer, chat bot or personal website. Consult the for how to find these groups.

Read more: Get started with LND
Chantools
here
Community Resources
Guggero’s Chantools
Telegram Cheeserobot
Zombie Channel Recovery Matcher
upgrade LND
Lightning Network explorers