LND merged a fix on November 4, 2026 that stops a node from crashing when someone tries to force-close a channel restored from a static channel backup. Bitcoin Optech newsletter #431 flagged the change on November 13. The fix matters because it exposes how thin the Lightning safety net is. Your seed phrase gets your on-chain coins back, but it knows nothing about your channels. The one file that does, channel.backup, is only useful if a current copy sits somewhere other than the machine that just died.

This build turns that file into a monitored pipeline for your LND node. A small Python script exports a fresh backup, verifies it against the node, copies it to two or more destinations, reads each copy back to confirm the hash, and reports drift through exit codes your monitoring already understands. Then you rehearse the restore. A Lightning channel backup you have never tested is a hope, not a plan.

The whole project runs on the Python standard library plus lncli. Budget about 60 minutes, most of it spent on the restore rehearsal and on writing down the runbook for the day your disk fails at 3 a.m.

Don't miss new tech stories on Google

Add Shattered once in the Google app and our stories show up in your news suggestions.

What a Lightning channel backup protects, and what it cannot

A Lightning channel is a shared 2-of-2 output on the Bitcoin chain plus a stream of off-chain updates that only you and your peer hold. Lose the node and you lose the updates. The coins are not gone, since the funding output still sits on-chain, but you cannot spend them without your peer signing a closing transaction, and your peer has no obligation to do that on request.

LND ships a mechanism for exactly this case. The static channel backup (SCB) records which channels you had and who your peers were. It does not record balances, HTLCs, or commitment state. The official LND documentation in the Builder’s Guide describes the restore step in plain terms on its disaster-recovery page: “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.” That is the entire promise. Your peers close the channels, and your seed-derived keys sweep what belongs to you.

What is inside channel.backup

The file is an encrypted bundle that LND rewrites whenever you open or close a channel. The encryption key derives from your wallet seed, which has two consequences. First, you can store copies on a NAS, a USB stick, or a cloud bucket without handing anyone a spendable secret. Second, the copies are worthless without the seed, so the backup and the seed phrase must both survive. Keep them in different places.

What a restore does and does not do

Restoring an SCB does not reopen anything. LND reconnects to each former peer, announces that it lost data, and asks the peer to broadcast its latest commitment transaction. Funds arrive on-chain after the close confirms. With the v0.21 line, Lightning Labs changed channel-close handling so that closes require 3 to 6 confirmations before LND treats them as final. Plan for a slower payout than older guides describe.

The Optech item from November 13 adds a sharp edge. A restored channel is a shell without the local commitment transaction, so LND cannot sign a local force-close for it. The merged change rejects that path cleanly instead of crashing. The only route out is the peer closing on your behalf.

Prerequisites and versions

Pin versions before you start. Channel recovery behavior changed repeatedly across 2026, and instructions that skip the version are the ones that hurt people.

  • LND: v0.21.8-beta, the release marked Latest on the official repository with artifacts dated November 11, 2026. The parallel v0.20.8-beta line shipped the same day. Both lines also carry the MPTCP change from October 30, 2026 (v0.21.6-beta and v0.20.7-beta), which disables MPTCP listeners by default in response to the Linux kernel flaw tracked as CVE-2026-98432.
  • lncli: the same version as the daemon. Mismatched builds are a classic source of confusing RPC errors.
  • Python: 3.12 or newer. The project was built and tested on Python 3.12.3 and uses nothing outside the standard library.
  • OS: a Linux host with systemd. The path-unit trigger in Step 9 depends on it.
  • Storage: at least two independent destinations, for example a USB drive mounted at /mnt/scb-usb and a NAS share at /mnt/scb-nas. One destination on the same disk as the node does not count.
  • Access: the Unix user that owns the LND directory, plus a readable macaroon. Export and verify calls need the node to be unlocked.
  • Test network: a second machine or VM where you can run a throwaway LND on a test network for the restore drill in Step 11.

Core Lightning, Eclair, and LDK-based wallets handle recovery differently. Do not paste these commands into a non-LND node. Taproot Assets users should treat the LND backup as the base layer, because the v0.8 announcement says a full Taproot Assets restore still needs the corresponding LND wallet.

Why stale copies and old databases cost real money

Lightning punishes old state. Every channel update revokes the previous one, and a peer that publishes a revoked commitment forfeits the whole channel balance to the honest side if the honest side notices in time. That rule protects you from cheating peers. It also means an honest node that restores an old copy of its own database and broadcasts stale state is the cheater.

Recent educational material on Lightning backups repeats the same instruction for this reason: never restore an old database file as a backup. The SCB design exists because it avoids that trap. It carries no state at all, so it cannot revoke anything. It can only ask peers to close with the state they hold.

The scheme has three honest limits that shape the rest of this build:

  1. The peer must be online and willing. If a former peer is gone for good, that channel stays stuck until the peer returns.
  2. The backup is only as current as its last write. A channel opened after your newest copy is invisible to a restore. That is the drift the script monitors.
  3. The seed is still required. A perfect backup file with a lost seed recovers nothing.

The second limit drives the architecture. LND rewrites channel.backup on open and close events, so the file on the node is always fresh. Your offsite copy is the weak link, and it can silently fall behind. A cron job that copies the file nightly can leave a channel opened at noon uncovered for twelve hours. A path-triggered snapshot narrows that to seconds, and a status check turns any remaining gap into an alert.

Phase 1: locate, export, and verify the backup (Steps 1 to 4)

Step 1: Check your LND and lncli versions

Confirm what you run before you touch anything. The output should show the daemon and client on the same release.

Expected output on a current install:

If you run v0.21.5 or older, plan an upgrade. The October 30 releases carry the MPTCP mitigation, and the November 11 releases carry the recovery-path fixes described above. If you stay on the 0.20 line, v0.20.8-beta is the matching target.

Step 2: Find channel.backup and pin its path

By default LND keeps the file under its data directory, in a folder named for the chain and network, for example ~/.lnd/data/chain/bitcoin/mainnet/channel.backup. Confirm it exists and note the modification time.

LND also accepts a backupfilepath option in lnd.conf, which relocates the live file. Some operators point it at a separate mounted volume so a dead boot disk does not take the file with it. Check the sample config for your version before using it, then restart LND and confirm the file appears at the new path.

Step 3: Export a fresh multi-channel backup by hand

Even though the live file updates itself, you want an explicit export in your toolbox. It lets you capture a snapshot on demand and confirms the RPC path works with your macaroon.

A successful export writes a non-empty file. If the command returns an authentication error, fix the macaroon path first. The script in Phase 2 reuses whatever flags you put in its config, so get a working command line now.

Step 4: Verify the file against the node

Verification checks that the node can decrypt the file with its own keys. It proves integrity and ownership, and nothing more.

A good file prints an empty JSON object and returns exit code 0. A truncated or foreign file returns a non-zero exit code, which the script treats as a hard failure. Remember what this does not prove. A file can verify and still be useless if the peer vanished or the seed is lost.

Phase 2: build the scb_guard script (Steps 5 to 8)

The script does five jobs: fingerprint the live channel set, export and verify, fan out to every destination, read each copy back, and report drift. It deliberately avoids third-party packages so it runs on a bare node.

Step 5: Create the project and the config

Each key has a job. keep bounds how many dated copies each destination retains. max_age_hours sets the point where status goes critical even if nothing changed, which catches a dead timer. refresh_hours forces a new snapshot after a day of quiet so a silent failure cannot hide behind an unchanged channel set. require_marker makes the script refuse to write to a destination that lacks a .scb-marker file, which stops it from filling the boot disk when a drive is unmounted.

Step 6: Write the helpers

Start with the building blocks. The fingerprint hashes the sorted list of channel points from lncli listchannels. LND may re-encrypt the backup on every export, so comparing file hashes would flag a change that never happened. The channel set is the stable signal.

Two details deserve attention. copy_verified writes to a .part file, calls fsync, re-hashes what landed on disk, and only then renames. A copy that fails the read-back never becomes visible under its final name. And save_manifest uses an atomic replace, so a power cut mid-write cannot leave half a JSON file.

Step 7: Write the snapshot command

The snapshot flow is export, verify, hash, fan out, prune, record. It exits 0 on full success, 1 when at least one destination failed, and 2 when every destination failed or the export itself broke.

A single dead destination produces a warning rather than a failure, which matches reality. A flaky NAS should page you at a lower urgency than a node with no offsite copy at all.

Step 8: Add status, drill, and the CLI, then run the tests

status is the monitoring hook. It goes critical on four conditions: no manifest, a snapshot older than the limit, a live channel set that differs from the snapshot, and any destination whose copy is missing or fails its hash. drill re-verifies the newest file on every destination against the node, which catches bit rot without touching a live channel.

Now the offline test harness. It includes a test for the marker check. A stub lncli mimics listchannels, exportchanbackup, and verifychanbackup against a JSON state file, so you can test drift, corruption, and pruning without a running node. The stub writes a header plus random bytes on each export, which mimics the way real exports can differ even when nothing changed.

Run the suite from the project root:

Expected result on Python 3.12.3:

Phase 3: automate, monitor, and rehearse (Steps 9 to 12)

Step 9: Trigger snapshots from file changes

A systemd path unit watches the live file and starts a one-shot service whenever LND rewrites it. This approach mirrors the sync pattern in the RaspiBolt channel backup guide, adapted here to run the verifying script instead of a bare copy.

Install the files, copy the script to /opt/scb-guard and the config to /etc/scb-guard/config.json, then enable the path unit:

Open a test channel on a test network, or trigger a channel close on one, and watch the journal. The service should run within a second or two of the file change and log a snapshot line.

Step 10: Add an hourly status check and an alert hook

The path unit handles the happy path. The status timer handles everything else, including the case where the path unit never fired.

Replace notify-me with whatever you already use for alerts, such as a mail command, a chat webhook, or a push notifier. Any non-zero exit from status marks the unit failed, which fires the alert service. Enable the timer with sudo systemctl enable --now scb-guard-status.timer.

Step 11: Rehearse the restore on a throwaway node

This is the step people skip, and it is the one that tells you whether the rest works. Read the warning first. Restoring an SCB asks every peer in the file to force-close. Never run a restore on a machine holding your mainnet backup unless you truly want every channel closed.

Run the rehearsal with a backup produced by a node on a test network, using test channels. The sequence on the second machine:

  1. Install the same LND version you run in production.
  2. Create a wallet from the test node’s seed using lncli create and choose the existing-seed option.
  3. Let the node sync and unlock.
  4. Run lncli restorechanbackup --multi_file=/path/to/channel.backup with the file from your offsite destination.
  5. Watch the log for peer reconnects and for the peers broadcasting their commitment transactions.
  6. Time the whole run from the dead disk to confirmed funds on-chain and write the number down.

Your version of the LND documentation lists any extra flags that apply when you restore during wallet creation. Follow the docs for your release, because the recovery tooling moved several times in 2026.

Step 12: Write the runbook

Panic is a bad operator. Put the steps on one page and store it with the seed, not on the node. A workable runbook has six lines: where the seed lives, where each backup copy lives, the LND version to install, the restore command, the expected wait for closes to confirm, and the contact route for peers that need a nudge. Add the date of your last successful drill at the bottom and update it every quarter.

Watchtowers: the other half of the safety net

An SCB answers one question: how do I get out if my node dies. A watchtower answers a different one: who stops my peer from cheating while I am offline. LND includes watchtower server and client support behind build tags and config switches, and the project documentation still covers it as of November 2026. According to the release listing, binaries from the October 30 release include the watchtowerrpc build tag.

The Knowing Bitcoin lesson on backups and watchtowers covers both mechanisms side by side. The practical split is simple. Backups protect against your own failure and towers protect against a counterparty’s fraud. Do not read watchtower coverage as a backup. A tower holds encrypted breach-remedy data, not your channel list, and it cannot rebuild a node.

One caution about money. The research behind this build found no confirmed current pricing or paid hosted watchtower product from Lightning Labs. If a vendor quotes you a price, treat it as that vendor’s own offer and read their terms. A documentation update dated November 12, 2026 reportedly references watchtower policy changes, so recheck your version’s tower settings after each upgrade.

Choosing destinations and retention that match your risk

Two copies on two devices covers the common failures. A third copy in another building covers the rare ones. The right number depends on how much value sits in channels and how long you could tolerate waiting for a rebuild.

Pick media that fail differently

A USB stick and an SD card sold by the same vendor often die in similar ways. Mix technologies instead. Pair a flash drive with a NAS on spinning disks, or a local disk with an object-storage bucket. The script treats every destination as a plain directory, so anything you can mount works, including network shares and FUSE mounts for cloud storage. Mount reliability becomes the new variable, which is why the config includes a marker-file switch.

Check one thing on every mount before trusting it. If a USB drive disconnects, Linux can leave the empty mount-point directory behind and let a careless script write into the root filesystem. The require_marker option from Step 5 closes that hole. Create .scb-marker on the mounted volume once, and the script reports a failure for that destination whenever the marker is missing. A guard that quietly fills the boot disk with backup copies is worse than no guard.

Set retention for forensics, not just recovery

Only the newest file matters for a restore, because it lists the most channels. Older copies still earn their keep. If you ever need to explain how a channel went missing from your records, a dated trail answers the question. A keep value of 14 holds about two weeks of snapshots, because the 24-hour refresh writes a new copy daily even on a quiet node. Each file is small, so raise the number if the audit trail matters to you.

Decide how stale is too stale

The max_age_hours setting is a policy choice. A personal node that opens a channel every few months can live with 72 hours. A routing node that opens and closes channels weekly should set 24 and treat any alert as urgent. Remember that status also goes critical on channel drift, so the age limit only has to catch the dead-timer case.

What changes when you run many channels

A node with three channels and a node with three hundred share the same recovery logic, but the operational feel differs. Restores generate a burst of force-closes, and each one pays on-chain fees and enters the confirmation queue. With the v0.21 close behavior of 3 to 6 confirmations before LND treats a close as final, a large restore can stretch over many hours. Build that wait into your expectations, and do not decide a restore failed because balances have not appeared in the first hour.

Large nodes also feel the cost of drift more sharply. A single channel missing from a stale backup is one stuck position. At scale, a month-old copy can miss dozens of channels, and each missing one needs a manual approach to the peer. That is the case for the short path-trigger delay in Step 9 and the hourly audit in Step 10, rather than a nightly cron.

Finally, think about peers. Channels to large, well-run nodes tend to resolve quickly after a restore because their operators run monitored infrastructure. Channels to small hobby nodes can take longer, since those peers may be offline for days. When you open channels, weigh peer uptime as a recovery factor alongside fees and capacity. A channel to a peer that answers reliably is a channel you can recover reliably.

The real recovery sequence on the bad day

Rehearsal pays off here. When a node truly dies, work in this order and resist the urge to improvise.

  1. Stop and isolate. If the old disk is merely unmounted rather than destroyed, do not start the old node again alongside a new one. Two nodes with the same keys and divergent state is how penalties happen.
  2. Gather the seed and the newest backup copy. Compare the manifest date against the date you last opened a channel.
  3. Install the current LND release on clean hardware and let it sync.
  4. Create the wallet from the seed with a generous address look-ahead so every on-chain address is rescanned.
  5. Restore the channel backup and let LND contact the peers.
  6. Wait for closes to confirm. Under the v0.21 behavior, expect 3 to 6 confirmations before LND treats a close as final.
  7. Sweep and re-open. Once funds sit in the on-chain wallet, decide where to open new channels. The old ones are gone.

Peers that never respond deserve patience, not panic. A peer on a flaky connection may need hours. You can contact node operators directly if the channel was large, since force-close recovery depends on their cooperation.

Sample output: healthy runs and broken runs

These lines come from real runs of the script against the stub node (three channels, then a fourth opened). Paths are shortened. Your first run on a real node prints the same shape with real channel counts and hashes.

First snapshot, then an immediate repeat that finds nothing to do:

Healthy status, then status after a fourth channel opens and before the script has snapshotted it:

A corrupted copy on the USB drive, caught by the hash check and by the drill:

The stub’s error text stands in for the real lncli message. Your node will word it differently, but the exit-code logic is identical.

  • Exit 0: everything is current and verified.
  • Exit 1: the snapshot succeeded on at least one destination but failed on another.
  • Exit 2: no usable copy exists, the copy is stale, or the channel set drifted.

Common pitfalls that break channel recovery

Pitfall 1: Keeping the only copy on the node

A backup on the same disk as the database dies with it. A second partition on the same SSD does not help either. Use separate physical media, and make one of them leave the building.

Pitfall 2: Treating the seed as the backup

The seed recovers on-chain coins and nothing else. People who skip the channel file discover this when a restore shows an empty channel list and funds locked in channels with nobody to ask.

Pitfall 3: Restoring a database copy instead of the SCB

An old database copy looks like the more complete option. It is the dangerous one. Stale state can trigger the penalty path against your own node. Use the SCB.

Pitfall 4: Assuming rebalancing updates the backup

Routing payments and channel rebalancing change balances inside existing channels. They do not change the channel set, so the SCB does not change either. That is fine, because the SCB holds no balances. The pitfall is the opposite assumption, that a fresh-looking file implies fresh state. It implies a fresh channel list and nothing more.

Pitfall 5: Never testing the restore

Verification proves a file decrypts. It does not prove your peers will respond, your seed is legible, or your runbook works. Schedule a quarterly drill on a test network and record the elapsed time.

Pitfall 6: Running the drill against mainnet channels

The mainnet restore command asks real peers to close real channels. Keep drill material strictly on a test network. The script’s own drill command only verifies files and never restores.

Pitfall 7: Forgetting the on-chain look-ahead

If your wallet used many addresses, a small look-ahead during seed restore leaves coins unseen. Pick a generous value and rescan if balances look low.

Troubleshooting: ten failures and their fixes

If a row does not match, read the LND log before changing anything. Most recovery trouble leaves a clear line about a peer, a file, or a wallet state.

Advanced tips for production nodes

  • Add a third destination off-site. A bucket in another region protects against a fire or a flood that takes both local copies. The file is encrypted with a seed-derived key, but treat bucket permissions seriously anyway.
  • Pin the config in version control. Keep scb_guard.json and the unit files in a private repository. Never commit the seed, a macaroon, or a copy of the backup.
  • Alert on the manifest, not the file. The manifest has a creation time, a channel count, and a hash. Ship those three values to your metrics system and chart the age.
  • Re-run after every upgrade. Upgrades are exactly when file paths, units, and permissions drift. A manual snapshot --force and drill take under a minute.
  • Gate upgrades on the release notes. The November 2026 LND notes touch restored-channel force-closes, pending-channel reconnects, and AMP on-chain recovery. Read them before you upgrade a node with many channels. The AMP recovery backport, for example, targets the v0.21.x branch.
  • Close channels gracefully when you can. A cooperative close beats any recovery. If you retire a node on purpose, close first and migrate only on-chain funds.
  • Keep the seed on a different trust boundary. Use a metal backup in a safe and keep SCB copies on networked storage. Compromise of one should not reveal the other.

Operators running large routing nodes sometimes add a second guard on a separate host that only executes status and drill against copies. That host needs no access to the node’s wallet. It reads files and compares hashes against a manifest you replicate, which gives you an independent witness.

The complete working project

The finished layout has four parts. Every file appeared above, and the Python files match what ran for the test and sample output in this build.

To assemble it, concatenate the three script blocks from Steps 6, 7, and 8 in order into one scb_guard.py, mark it executable, and run the test suite. A quick end-to-end check on a real node:

Success looks like one ok line per destination and exit code 0. Anything else points to the troubleshooting table. For more Bitcoin and Lightning walkthroughs, browse the cryptocurrency section.

The takeaway: your seed phrase and your channel file protect different things, and only one of them goes stale. Automate the one that does, verify it against the node, and rehearse the restore before you need it.

FAQ: Lightning channel backups

Does my seed phrase back up my Lightning channels?

No. The seed recovers on-chain funds and the keys derived from it. Channels need the separate channel.backup file, and the file in turn needs the seed to decrypt.

How often does LND update channel.backup?

LND rewrites the file when you open or close a channel. Routing payments and rebalancing change balances but not the channel list, so they do not trigger a rewrite.

Can I keep using my channels after an SCB restore?

No. A restore asks your peers to force-close. The funds return on-chain after the closes confirm, and you open fresh channels afterward.

Is it safe to store channel.backup in the cloud?

The file is encrypted with a key derived from your seed, so a copy on its own does not hand anyone spending power. Still, restrict access and keep the seed somewhere else. A leaked file reveals your peers and channel points.

What if a peer stays offline forever?

Recovery depends on the peer cooperating, so that channel can remain stuck. Large channels justify contacting the operator directly. This limit is a core reason to prefer cooperative closes when you retire a node.

Do I still need a watchtower if I have the backup?

They solve different problems. The backup rescues you after you lose the node. A watchtower defends against a peer that publishes old state while you are offline. Many operators run both.

Which LND version should I run right now?

As of November 22, 2026, v0.21.8-beta is marked Latest, with v0.20.8-beta as the parallel maintenance line, both dated November 11, 2026. Check the release notes for restored-channel and pending-channel fixes before upgrading.

Does the same process work for Core Lightning?

No. Core Lightning and other implementations use different recovery files and commands. Use the documentation for your implementation and test its restore path separately.

Dr. Heinrich Vogel reviews shattered.io technical coverage for accuracy, checking explanations against primary specifications and published research before they go live. His background is in cryptography and security engineering.