Chantools
A rescue kit for broken Lightning channels: recovering funds from stuck, uncooperative or corrupted states.
Basically
Chantools helps you get your bitcoin back when a Lightning payment channel is stuck, damaged or closed unexpectedly. You run it by typing commands to find and fix problems.
Key Takeaways
- Chantools recovers funds from broken Lightning channels. It provides commands to extract and recover your bitcoin when channels get stuck, nodes become unresponsive or databases become corrupted.
- Chantools works with LND seed phrases and channel backups. Most recovery operations require your 24-word seed phrase and optionally your Static Channel Backup (SCB) file. Chantools can reconstruct channel states and force-close channels even without the original database.
- Chantools is a last resort tool, not a daily driver. It is designed for emergency recovery scenarios, and running certain commands will permanently close channels. Always exhaust normal troubleshooting before using chantools.
What Is Chantools?
Chantools is an open-source command-line utility created by Oliver Gugger (guggero), a Lightning Labs developer. It provides a collection of tools for diagnosing, repairing and recovering Lightning Network channels, primarily for LND (Lightning Network Daemon) users.
The name comes from "channel tools", and it has become the go-to recovery toolkit for Lightning node operators. People on X (Twitter) often mention chantools when sharing how they recovered stuck funds or rescued a corrupted node.
Chantools is available on GitHub and can be installed on Linux, macOS and Windows. It operates independently of a running LND instance, so you can use it even when your node is completely broken or offline.
Why Chantools Exists
Lightning Network channels are stateful. Your seed phrase alone cannot recover all funds as it can with on-chain bitcoin, because Lightning channels require the current channel state: who holds how much, pending HTLCs and commitment transactions. You can lose access to funds if this state gets corrupted or lost.
Several scenarios can leave you with inaccessible funds. Corrupted or lost channel state can cause this problem.
LND itself cannot always recover from these situations. Chantools fills the gap by providing low-level access to channel data and letting you craft recovery transactions manually.
Channel Recovery
The primary use case is recovering funds from channels that cannot be closed normally. Chantools can extract channel information from backups, reconstruct commitment transactions and broadcast force-close transactions to recover your balance.
Database Repair
Several commands help repair or extract data from corrupted LND databases. You can dump channel information, compact databases and migrate data between different formats.
Key Derivation
Chantools can derive all keys associated with your LND wallet from just the seed phrase. These keys include channel keys, on-chain keys and the various derivation paths LND uses. Recovery depends on these keys when you have lost everything except your seed.
Zombie Channel Handling
"Zombie" channels have peers that have been offline so long that the network has forgotten them. Chantools provides specific commands for these scenarios, including force-closing channels to peers that no longer exist in the public graph.
SCB (Static Channel Backup) Operations
Chantools can work with LND's Static Channel Backup files. It can decode SCB files, trigger the DLP (Data Loss Protection) recovery protocol and use SCB data to initiate force-closes when your database is gone but you have the backup file.
Scenario 1: Corrupted Database with SCB Available
Your LND database is corrupted, but you have a recent SCB file. Chantools can trigger the Data Loss Protection protocol, which asks your channel peers to force-close channels and return your funds. The chantools triggerforceclose command initiates this process.
Scenario 2: No Database, No SCB, Only Seed
The most difficult recovery scenario leaves you with only your seed phrase. Chantools can scan the blockchain for channels that belong to your keys, using chantools genimportscript to generate addresses and chantools rescueclosed to find and sweep funds from channels that the other party has already force-closed.
Scenario 3: Peer Offline Forever
Your channel partner has disappeared, and their node has been offline for months with no signs of returning. You need to force-close to recover your funds. The chantools forceclose command can broadcast your latest commitment transaction even without the peer's cooperation.
Scenario 4: Stuck Pending Channel
A channel is stuck in "pending open" state because the funding transaction has issues. The chantools rescuefunding command can help recover funds from channels that never fully opened, including situations where you need to double-spend the funding output.
How to Use Chantools
Chantools is a command-line tool with many subcommands. The sections below cover the most commonly used operations.
Understand the Consequences
Many chantools commands will permanently close channels, and force-closing is a one-way operation. Once you broadcast a force-close transaction, that channel is gone forever. Make absolutely sure you need to use chantools before proceeding.
Never Enter Seed Phrase Online
Chantools will ask for your seed phrase for most recovery operations. Only run chantools on a secure, offline machine when entering your seed. Your seed phrase controls all your funds, not just Lightning channels.
Wait for Time Locks
Force-closed channels have time locks, typically 144 blocks or about 1 day, but they can be up to 2016 blocks or about 2 weeks. You must wait for these time locks to expire before you can sweep your funds. The chantools sweeptimelock command handles this, but you need patience.
Keep Backups
You should make complete backups of your LND data directory before running any chantools command that modifies data. Some operations are destructive and cannot be undone.
Verify Before Publishing
Most commands have a --publish flag that broadcasts transactions. Run commands without this flag first to see what transactions would be created. Only add --publish when you are certain the output is correct.
Seek Help for Complex Cases
Community help is worth considering for complicated recovery scenarios. The Lightning Labs Slack, Reddit r/lightningnetwork and the LND GitHub issues are good places to ask. Provide transaction IDs and channel points, never your seed, when asking for help.