diff --git a/Makefile b/Makefile
index ae213f8..ae497d3 100644
--- a/Makefile
+++ b/Makefile
@@ -80,3 +80,7 @@ fmt:
lint: $(LINT_BIN)
@$(call print, "Linting source.")
$(LINT)
+
+docs: install
+ @$(call print, "Rendering docs.")
+ chantools doc
diff --git a/README.md b/README.md
index 0921cc2..e7f9da3 100644
--- a/README.md
+++ b/README.md
@@ -7,25 +7,6 @@
* [Seed and passphrase input](#seed-and-passphrase-input)
* [Command overview](#command-overview)
* [Commands](#commands)
- + [chanbackup](#chanbackup)
- + [compactdb](#compactdb)
- + [derivekey](#derivekey)
- + [dumpbackup](#dumpbackup)
- + [dumpchannels](#dumpchannels)
- + [filterbackup](#filterbackup)
- + [fixoldbackup](#fixoldbackup)
- + [genimportscript](#genimportscript)
- + [forceclose](#forceclose)
- + [removechannel](#removechannel)
- + [rescueclosed](#rescueclosed)
- + [rescuefunding](#rescuefunding)
- + [showrootkey](#showrootkey)
- + [signrescuefunding](#signrescuefunding)
- + [summary](#summary)
- + [sweeptimelock](#sweeptimelock)
- + [sweeptimelockmanual](#sweeptimelockmanual)
- + [vanitygen](#vanitygen)
- + [walletinfo](#walletinfo)
This tool provides helper functions that can be used to rescue funds locked in
`lnd` channels in case `lnd` itself cannot run properly anymore.
@@ -83,7 +64,7 @@ file based backup or the recovered file from the crashed node).
[this](https://github.com/lightningnetwork/lnd/issues/3473) or
[this](https://github.com/lightningnetwork/lnd/issues/4102), it is possible
that a simple compaction (a full copy in safe mode) can solve your problem.
- See [`chantools compactdb`](#compactdb).
+ See [`chantools compactdb`](doc/chantools_compactdb.md).
If that doesn't work and you need to continue the recovery, make sure you can
at least extract the `channel.backup` file and if somehow possible any version
@@ -164,7 +145,7 @@ file based backup or the recovered file from the crashed node).
`chantools` thinks are still open. This is achieved by publishing the latest
known channel state of the `channel.db` file.
**Please read the full warning text of the
- [`forceclose` command below](#forceclose) as this command can put
+ [`forceclose` command below](doc/chantools_forceclose.md) as this command can put
your funds at risk** if the state in the channel DB is not the most recent
one. This command should only be executed for channels where the remote peer
is not online anymore.
@@ -261,537 +242,60 @@ Your BIP32 HD root key is: xprv9s21ZrQH1...
```text
Usage:
- chantools [OPTIONS]
-
-Application Options:
- --testnet Set to true if testnet parameters should be used.
- --apiurl= API URL to use (must be esplora compatible). (default: https://blockstream.info/api)
- --listchannels= The channel input is in the format of lncli's listchannels format. Specify '-' to read from stdin.
- --pendingchannels= The channel input is in the format of lncli's pendingchannels format. Specify '-' to read from stdin.
- --fromsummary= The channel input is in the format of this tool's channel summary. Specify '-' to read from stdin.
- --fromchanneldb= The channel input is in the format of an lnd channel.db file.
-
-Help Options:
- -h, --help Show this help message
-
-Available commands:
- chanbackup Create a channel.backup file from a channel database.
- compactdb Open a source channel.db database file in safe/read-only mode and copy it to a fresh database, compacting it in the process.
- derivekey Derive a key with a specific derivation path from the BIP32 HD root key.
- dumpbackup Dump the content of a channel.backup file.
- dumpchannels Dump all channel information from lnd's channel database.
- filterbackup Filter an lnd channel.backup file and remove certain channels.
- fixoldbackup Fixes an old channel.backup file that is affected by the lnd issue #3881 (unable to derive shachain root key).
- forceclose Force-close the last state that is in the channel.db provided.
- genimportscript Generate a script containing the on-chain keys of an lnd wallet that can be imported into other software like bitcoind.
- removechannel Remove a single channel from the given channel DB.
- rescueclosed Try finding the private keys for funds that are in outputs of remotely force-closed channels.
- rescuefunding Rescue funds locked in a funding multisig output that never resulted in a proper channel. This is the command the initiator of the channel needs to run.
- showrootkey Extract and show the BIP32 HD root key from the 24 word lnd aezeed.
- signrescuefunding Rescue funds locked in a funding multisig output that never resulted in a proper channel. This is the command the remote node (the non-initiator) of the channel needs to run.
- summary Compile a summary about the current state of channels.
- sweeptimelock Sweep the force-closed state after the time lock has expired.
- sweeptimelockmanual Sweep the force-closed state of a single channel manually if only a channel backup file is available
- vanitygen Generate a seed with a custom lnd node identity public key that starts with the given prefix.
- walletinfo Shows relevant information about an lnd wallet.db file and optionally extracts the BIP32 HD root key.
+ chantools [command]
+
+Available Commands:
+ chanbackup Create a channel.backup file from a channel database
+ compactdb Create a copy of a channel.db file in safe/read-only mode
+ derivekey Derive a key with a specific derivation path
+ dumpbackup Dump the content of a channel.backup file
+ dumpchannels Dump all channel information from an lnd channel database
+ filterbackup Filter an lnd channel.backup file and remove certain channels
+ fixoldbackup Fixes an old channel.backup file that is affected by the lnd issue #3881 (unable to derive shachain root key)
+ forceclose Force-close the last state that is in the channel.db provided
+ genimportscript Generate a script containing the on-chain keys of an lnd wallet that can be imported into other software like bitcoind
+ help Help about any command
+ removechannel Remove a single channel from the given channel DB
+ rescueclosed Try finding the private keys for funds that are in outputs of remotely force-closed channels
+ rescuefunding Rescue funds locked in a funding multisig output that never resulted in a proper channel; this is the command the initiator of the channel needs to run
+ showrootkey Extract and show the BIP32 HD root key from the 24 word lnd aezeed
+ signrescuefunding Rescue funds locked in a funding multisig output that never resulted in a proper channel; this is the command the remote node (the non-initiator) of the channel needs to run
+ summary Compile a summary about the current state of channels
+ sweeptimelock Sweep the force-closed state after the time lock has expired
+ sweeptimelockmanual Sweep the force-closed state of a single channel manually if only a channel backup file is available
+ vanitygen Generate a seed with a custom lnd node identity public key that starts with the given prefix
+ walletinfo Shows info about an lnd wallet.db file and optionally extracts the BIP32 HD root key
+
+Flags:
+ -h, --help help for chantools
+ -r, --regtest Indicates if regtest parameters should be used
+ -t, --testnet Indicates if testnet parameters should be used
+
+Use "chantools [command] --help" for more information about a command.
```
## Commands
-### chanbackup
-
-```text
-Usage:
- chantools [OPTIONS] chanbackup [chanbackup-OPTIONS]
-
-[chanbackup command options]
- --rootkey= BIP32 HD root key of the wallet that should be used to create the backup. Leave empty to prompt for lnd 24 word aezeed.
- --channeldb= The lnd channel.db file to create the backup from.
- --multi_file= The lnd channel.backup file to create.
-```
-
-This command creates a new channel.backup from a channel.db file.
-
-Example command:
-
-```bash
-chantools chanbackup --rootkey xprvxxxxxxxxxx \
- --channeldb ~/.lnd/data/graph/mainnet/channel.db \
- --multi_file new_channel_backup.backup
-```
-
-### compactdb
-
-```text
-Usage:
- chantools [OPTIONS] compactdb [compactdb-OPTIONS]
-
-[compactdb command options]
- --txmaxsize= Maximum transaction size. (default 65536)
- --sourcedb= The lnd channel.db file to create the database backup from.
- --destdb= The lnd new channel.db file to copy the compacted database to.
-```
-
-This command opens a database in read-only mode and tries to create a copy of it
-to a destination file, compacting it in the process.
-
-Example command:
-
-```bash
-chantools compactdb --sourcedb ~/.lnd/data/graph/mainnet/channel.db \
- --destdb ./results/compacted.db
-```
-
-### derivekey
-
-```text
-Usage:
- chantools [OPTIONS] derivekey [derivekey-OPTIONS]
-
-[derivekey command options]
- --rootkey= BIP32 HD root key to derive the key from. Leave empty to prompt for lnd 24 word aezeed.
- --path= The BIP32 derivation path to derive. Must start with "m/".
- --neuter Do not output the private key, just the public key.
-```
-
-This command derives a single key with the given BIP32 derivation path from the
-root key and prints it to the console. Make sure to escape apostrophes in the
-derivation path.
-
-Example command:
-
-```bash
-chantools derivekey --rootkey xprvxxxxxxxxxx --path m/1017\'/0\'/5\'/0/0 \
- --neuter
-```
-
-### dumpbackup
-
-```text
-Usage:
- chantools [OPTIONS] dumpbackup [dumpbackup-OPTIONS]
-
-[dumpbackup command options]
- --rootkey= BIP32 HD root key of the wallet that was used to create the backup. Leave empty to prompt for lnd 24 word aezeed.
- --multi_file= The lnd channel.backup file to dump.
-```
-
-This command dumps all information that is inside a `channel.backup` file in a
-human readable format.
-
-Example command:
-
-```bash
-chantools dumpbackup --rootkey xprvxxxxxxxxxx \
- --multi_file ~/.lnd/data/chain/bitcoin/mainnet/channel.backup
-```
-
-### dumpchannels
-
-```text
-Usage:
- chantools [OPTIONS] dumpchannels [dumpchannels-OPTIONS]
-
-[dumpchannels command options]
- --channeldb= The lnd channel.db file to dump the channels from.
-```
-
-This command dumps all open and pending channels from the given lnd `channel.db`
-file in a human readable format.
-
-Example command:
-
-```bash
-chantools dumpchannels --channeldb ~/.lnd/data/graph/mainnet/channel.db
-```
-
-### filterbackup
-
-```text
-Usage:
- chantools [OPTIONS] filterbackup [filterbackup-OPTIONS]
-
-[filterbackup command options]
- --rootkey= BIP32 HD root key of the wallet that was used to create the backup. Leave empty to prompt for lnd 24 word aezeed.
- --multi_file= The lnd channel.backup file to filter.
- --discard= A comma separated list of channel funding outpoints (format :) to remove from the backup file.
-```
-
-Filter an `lnd` `channel.backup` file by removing certain channels (identified by
-their funding transaction outpoints).
-
-Example command:
-
-```bash
-chantools filterbackup --rootkey xprvxxxxxxxxxx \
- --multi_file ~/.lnd/data/chain/bitcoin/mainnet/channel.backup \
- --discard 2abcdef2b2bffaaa...db0abadd:1,4abcdef2b2bffaaa...db8abadd:0
-```
-
-### fixoldbackup
-
-```text
-Usage:
- chantools [OPTIONS] fixoldbackup [fixoldbackup-OPTIONS]
-
-[fixoldbackup command options]
- --rootkey= BIP32 HD root key of the wallet that was used to create the backup. Leave empty to prompt for lnd 24 word aezeed.
- --multi_file= The lnd channel.backup file to fix.
-```
-
-Fixes an old channel.backup file that is affected by the `lnd` issue
-[#3881](https://github.com/lightningnetwork/lnd/issues/3881) ([lncli]
-unable to restore chan backups: rpc error: code = Unknown desc = unable
-to unpack chan backup: unable to derive shachain root key: unable to derive
-private key
).
-
-Example command:
-
-```bash
-chantools fixoldbackup --rootkey xprvxxxxxxxxxx \
- --multi_file ~/.lnd/data/chain/bitcoin/mainnet/channel.backup
-```
-
-### forceclose
-
-```text
-Usage:
- chantools [OPTIONS] forceclose [forceclose-OPTIONS]
-
-[forceclose command options]
- --rootkey= BIP32 HD root key to use. Leave empty to prompt for lnd 24 word aezeed.
- --channeldb= The lnd channel.db file to use for force-closing channels.
- --publish Should the force-closing TX be published to the chain API?
-```
-
-If you are certain that a node is offline for good (AFTER you've tried SCB!) and
-a channel is still open, you can use this method to force-close your latest
-state that you have in your channel.db.
-
-**!!! WARNING !!! DANGER !!! WARNING !!!**
-
-If you do this and the state that you publish is *not* the latest state, then
-the remote node *could* punish you by taking the whole channel amount *if* they
-come online before you can sweep the funds from the time locked (144 - 2000
-blocks) transaction *or* they have a watch tower looking out for them.
-
-**This should absolutely be the last resort and you have been warned!**
-
-Example command:
-
-```bash
-chantools --fromsummary results/summary-xxxx-yyyy.json \
- forceclose \
- --channeldb ~/.lnd/data/graph/mainnet/channel.db \
- --rootkey xprvxxxxxxxxxx \
- --publish
-```
-
-### genimportscript
-
-```text
-Usage:
- chantools [OPTIONS] genimportscript [genimportscript-OPTIONS]
-
-[genimportscript command options]
- --rootkey= BIP32 HD root key to use. Leave empty to prompt for lnd 24 word aezeed.
- --format= The format of the generated import script. Currently supported are: bitcoin-cli, bitcoin-cli-watchonly, bitcoin-importwallet.
- --lndpaths Use all derivation paths that lnd uses. Results in a large number of results. Cannot be used in conjunction with --derivationpath.
- --derivationpath= Use one specific derivation path. Specify the first levels of the derivation path before any internal/external branch. Cannot be used in conjunction with --lndpaths. (default m/84'/0'/0')
- --recoverywindow= The number of keys to scan per internal/external branch. The output will consist of double this amount of keys. (default 2500)
- --rescanfrom= The block number to rescan from. Will be set automatically from the wallet birthday if the lnd 24 word aezeed is entered. (default 500000)
-```
-
-Generates a script that contains all on-chain private (or public) keys derived
-from an `lnd` 24 word aezeed wallet. That script can then be imported into other
-software like bitcoind.
-
-The following script formats are currently supported:
-* `bitcoin-cli`: Creates a list of `bitcoin-cli importprivkey` commands that can
- be used in combination with a `bitcoind` full node to recover the funds locked
- in those private keys.
-* `bitcoin-cli-watchonly`: Does the same as `bitcoin-cli` but with the
- `bitcoin-cli importpubkey` command. That means, only the public keys are
- imported into `bitcoind` to watch the UTXOs of those keys. The funds cannot be
- spent that way as they are watch-only.
-* `bitcoin-importwallet`: Creates a text output that is compatible with
- `bitcoind`'s `importwallet command.
-
-Example command:
-
-```bash
-chantools genimportscript --format bitcoin-cli --recoverywindow 5000
-```
-
-### removechannel
-
-```text
-Usage:
- chantools [OPTIONS] removechannel [removechannel-OPTIONS]
-
-[removechannel command options]
- --channeldb= The lnd channel.db file to remove the channel from.
- --channel= The channel to remove from the DB file, identified by its channel point (:).
-```
-
-Removes a single channel from the given channel DB.
-
-Example command:
-
-```bash
-chantools --channeldb ~/.lnd/data/graph/mainnet/channel.db \
- --channel 3149764effbe82718b280de425277e5e7b245a4573aa4a0203ac12cee1c37816:0
-```
-
-### rescueclosed
-
-```text
-Usage:
- chantools [OPTIONS] rescueclosed [rescueclosed-OPTIONS]
-
-[rescueclosed command options]
- --rootkey= BIP32 HD root key to use. Leave empty to prompt for lnd 24 word aezeed.
- --channeldb= The lnd channel.db file to use for rescuing force-closed channels.
-```
-
-If channels have already been force-closed by the remote peer, this command
-tries to find the private keys to sweep the funds from the output that belongs
-to our side. This can only be used if we have a channel DB that contains the
-latest commit point. Normally you would use SCB to get the funds from those
-channels. But this method can help if the other node doesn't know about the
-channels any more but we still have the channel.db from the moment they
-force-closed.
-
-Example command:
-
-```bash
-chantools --fromsummary results/summary-xxxx-yyyy.json \
- rescueclosed \
- --channeldb ~/.lnd/data/graph/mainnet/channel.db \
- --rootkey xprvxxxxxxxxxx
-```
-
-### rescuefunding
-
-```text
-Usage:
- chantools [OPTIONS] rescuefunding [rescuefunding-OPTIONS]
-
-[rescuefunding command options]
- --rootkey= BIP32 HD root key to use. Leave empty to prompt for lnd 24 word aezeed.
- --channeldb= The lnd channel.db file to rescue a channel from. Must contain the pending channel specified with --channelpoint.
- --channelpoint= The funding transaction outpoint of the channel to rescue (:) as it is recorded in the DB.
- --confirmedchannelpoint= The channel outpoint that got confirmed on chain (:). Normally this is the same as the --channelpoint so it will be set to that value if this is left empty.
- --sweepaddr= The address to sweep the rescued funds to.
- --satperbyte= The fee rate to use in satoshis/vByte.
-```
-
-This is part 1 of a two phase process to rescue a channel funding output that
-was created on chain by accident but never resulted in a proper channel and no
-commitment transactions exist to spend the funds locked in the 2-of-2 multisig.
-
-**You need the cooperation of the channel partner (remote node) for this to
-work**! They need to run the second command of this process:
-[`signrescuefunding`](#signrescuefunding)
-
-Example command (run against the channel DB of the initiator node):
-
-```bash
-chantools rescuefunding \
- --channeldb ~/.lnd/data/graph/mainnet/channel.db \
- --channelpoint xxxxxxx:xx \
- --sweepaddr bc1qxxxxxxxxx \
- --satperbyte 10 \
- --rootkey xprvxxxxxxxxxx
-```
-
-If successful, this will create a PSBT that then has to be sent to the channel
-partner (remote node operator).
-
-### showrootkey
-
-This command converts the 24 word `lnd` aezeed phrase and password to the BIP32
-HD root key that is used as the `rootkey` parameter in other commands of this
-tool.
-
-Example command:
-
-```bash
-chantools showrootkey
-```
-
-### signrescuefunding
-
-```text
-Usage:
- chantools [OPTIONS] signrescuefunding [signrescuefunding-OPTIONS]
-
-[signrescuefunding command options]
- --rootkey= BIP32 HD root (m/) key to derive the key for our part of the signature from.
- --psbt= The Partially Signed Bitcoin Transaction that was provided by the initiator of the channel to rescue.
-```
-
-This is part 2 of a two phase process to rescue a channel funding output that
-was created on chain by accident but never resulted in a proper channel and no
-commitment transactions exist to spend the funds locked in the 2-of-2 multisig.
-
-Example command (run by the non-initiator of the channel):
-
-```bash
-chantools signrescuefunding \
- --psbt \
- --rootkey xprvxxxxxxxxxx
-```
-
-If successful, this will create a final on-chain transaction that can be
-broadcast by any Bitcoin node.
-
-### summary
-
-```text
-Usage:
- chantools [OPTIONS] summary
-```
-
-From a list of channels, find out what their state is by querying the funding
-transaction on a block explorer API.
-
-Example command 1:
-
-```bash
-lncli listchannels | chantools --listchannels - summary
-```
-
-Example command 2:
-
-```bash
-chantools --fromchanneldb ~/.lnd/data/graph/mainnet/channel.db
-```
-
-### sweeptimelock
-
-```text
-Usage:
- chantools [OPTIONS] sweeptimelock [sweeptimelock-OPTIONS]
-
-[sweeptimelock command options]
- --rootkey= BIP32 HD root key to use. Leave empty to prompt for lnd 24 word aezeed.
- --publish Should the sweep TX be published to the chain API?
- --sweepaddr= The address the funds should be sweeped to
- --maxcsvlimit= Maximum CSV limit to use. (default 2000)
-```
-
-Use this command to sweep the funds from channels that you force-closed with the
-`forceclose` command. You **MUST** use the result file that was created with the
-`forceclose` command, otherwise it won't work. You also have to wait until the
-highest time lock (can be up to 2000 blocks which is more than two weeks) of all
-the channels has passed. If you only want to sweep channels that have the
-default CSV limit of 1 day, you can set the `--maxcsvlimit` parameter to 144.
-
-Example command:
-
-```bash
-chantools --fromsummary results/forceclose-xxxx-yyyy.json \
- sweeptimelock
- --rootkey xprvxxxxxxxxxx \
- --publish \
- --sweepaddr bc1q.....
-```
-
-### sweeptimelockmanual
-
-```text
-Usage:
- chantools [OPTIONS] sweeptimelockmanual [sweeptimelockmanual-OPTIONS]
-
-[sweeptimelockmanual command options]
- --rootkey= BIP32 HD root key to use. Leave empty to prompt for lnd 24 word aezeed.
- --publish Should the sweep TX be published to the chain API?
- --sweepaddr= The address the funds should be sweeped to.
- --maxcsvlimit= Maximum CSV limit to use. (default 2000)
- --feerate= The fee rate to use for the sweep transaction in sat/vByte. (default 2 sat/vByte)
- --timelockaddr= The address of the time locked commitment output where the funds are stuck in.
- --remoterevbasepoint= The remote's revocation base point, can be found in a channel.backup file.
-```
-
-Sweep the locally force closed state of a single channel manually if only a
-channel backup file is available. This can only be used if a channel is force
-closed from the local node but then that node's state is lost and only the
-`channel.backup` file is available.
-
-To get the value for `--remoterevbasepoint` you must use the
-[`dumpbackup`](#dumpbackup) command, then look up the value for
-`RemoteChanCfg -> RevocationBasePoint -> PubKey`.
-
-To get the value for `--timelockaddr` you must look up the channel's funding
-output on chain, then follow it to the force close output. The time locked
-address is always the one that's longer (because it's P2WSH and not P2PKH).
-
-Example command:
-
-```bash
-chantools sweeptimelockmanual \
- --rootkey xprvxxxxxxxxxx \
- --sweepaddr bc1q..... \
- --timelockaddr bc1q............ \
- --remoterevbasepoint 03xxxxxxx \
- --feerate 10 \
- --publish
-```
-
-### vanitygen
-
-```
-Usage:
- chantools [OPTIONS] vanitygen [vanitygen-OPTIONS]
-
-[vanitygen command options]
- --prefix= Hex encoded prefix to find in node public key.
- --threads= Number of parallel threads. (default: 4)
-```
-
-Try random lnd compatible seeds until one is found that produces a node identity
-public key that starts with the given prefix.
-
-Example command:
-
-```bash
-chantools vanitygen --prefix 022222 --threads 8
-```
-
-Example output:
-
-```text
-Running vanitygen on 8 threads. Prefix bit length is 17, expecting to approach
-probability p=1.0 after 131,072 seeds.
-Tested 185k seeds, p=1.41296, speed=14k/s, elapsed=13s
-Looking for 022222, found pubkey: 022222f015540ddde9bdf7c95b24f1d44f7ea6ab69bec83d6fbe622296d64b51d6
-with seed: [ability roast pear stomach wink cable tube trumpet shy caught hunt someone border organ spoon only prepare calm silent million tobacco chaos normal phone]
-```
-
-### walletinfo
-
-```text
-Usage:
- chantools [OPTIONS] walletinfo [walletinfo-OPTIONS]
-
-[walletinfo command options]
- --walletdb= The lnd wallet.db file to dump the contents from.
- --withrootkey Should the BIP32 HD root key of the wallet be printed to standard out?
-```
-
-Shows some basic information about an `lnd` `wallet.db` file, like the node
-identity the wallet belongs to, how many on-chain addresses are used and, if
-enabled with `--withrootkey` the BIP32 HD root key of the wallet. The latter can
-be useful to recover funds from a wallet if the wallet password is still known
-but the seed was lost. **The 24 word seed phrase itself cannot be extracted**
-because it is hashed into the extended HD root key before storing it in the
-`wallet.db`.
-
-Example command:
-
-```bash
-chantools walletinfo \
- --walletdb ~/.lnd/data/chain/bitcoin/mainnet/wallet.db \
- --withrootkey
-```
+Detailed documentation for each sub command is available in the
+[docs](doc/chantools.md) folder.
+
+Quick access:
++ [chanbackup](doc/chantools_chanbackup.md)
++ [compactdb](doc/chantools_compactdb.md)
++ [derivekey](doc/chantools_derivekey.md)
++ [dumpbackup](doc/chantools_dumpbackup.md)
++ [dumpchannels](doc/chantools_dumpchannels.md)
++ [filterbackup](doc/chantools_filterbackup.md)
++ [fixoldbackup](doc/chantools_fixoldbackup.md)
++ [genimportscript](doc/chantools_genimportscript.md)
++ [forceclose](doc/chantools_forceclose.md)
++ [removechannel](doc/chantools_removechannel.md)
++ [rescueclosed](doc/chantools_rescueclosed.md)
++ [rescuefunding](doc/chantools_rescuefunding.md)
++ [showrootkey](doc/chantools_showrootkey.md)
++ [signrescuefunding](doc/chantools_signrescuefunding.md)
++ [summary](doc/chantools_summary.md)
++ [sweeptimelock](doc/chantools_sweeptimelock.md)
++ [sweeptimelockmanual](doc/chantools_sweeptimelockmanual.md)
++ [vanitygen](doc/chantools_vanitygen.md)
++ [walletinfo](doc/chantools_walletinfo.md)
diff --git a/cmd/chantools/root.go b/cmd/chantools/root.go
index 6abdb8d..9c1e7d5 100644
--- a/cmd/chantools/root.go
+++ b/cmd/chantools/root.go
@@ -64,6 +64,7 @@ var rootCmd = &cobra.Command{
log.Infof("chantools version v%s commit %s", version,
Commit)
},
+ DisableAutoGenTag: true,
}
func init() {
@@ -82,6 +83,7 @@ func init() {
newDeriveKeyCommand(),
newDumpBackupCommand(),
newDumpChannelsCommand(),
+ newDocCommand(),
newFilterBackupCommand(),
newFixOldBackupCommand(),
newForceCloseCommand(),
diff --git a/doc/chantools.md b/doc/chantools.md
new file mode 100644
index 0000000..c04940d
--- /dev/null
+++ b/doc/chantools.md
@@ -0,0 +1,42 @@
+## chantools
+
+Chantools helps recover funds from lightning channels
+
+### Synopsis
+
+This tool provides helper functions that can be used rescue
+funds locked in lnd channels in case lnd itself cannot run
+properly anymore.
+
+Complete documentation is available at https://github.com/guggero/chantools/.
+
+### Options
+
+```
+ -h, --help help for chantools
+ -r, --regtest Indicates if regtest parameters should be used
+ -t, --testnet Indicates if testnet parameters should be used
+```
+
+### SEE ALSO
+
+* [chantools chanbackup](chantools_chanbackup.md) - Create a channel.backup file from a channel database
+* [chantools compactdb](chantools_compactdb.md) - Create a copy of a channel.db file in safe/read-only mode
+* [chantools derivekey](chantools_derivekey.md) - Derive a key with a specific derivation path
+* [chantools dumpbackup](chantools_dumpbackup.md) - Dump the content of a channel.backup file
+* [chantools dumpchannels](chantools_dumpchannels.md) - Dump all channel information from an lnd channel database
+* [chantools filterbackup](chantools_filterbackup.md) - Filter an lnd channel.backup file and remove certain channels
+* [chantools fixoldbackup](chantools_fixoldbackup.md) - Fixes an old channel.backup file that is affected by the lnd issue #3881 (unable to derive shachain root key)
+* [chantools forceclose](chantools_forceclose.md) - Force-close the last state that is in the channel.db provided
+* [chantools genimportscript](chantools_genimportscript.md) - Generate a script containing the on-chain keys of an lnd wallet that can be imported into other software like bitcoind
+* [chantools removechannel](chantools_removechannel.md) - Remove a single channel from the given channel DB
+* [chantools rescueclosed](chantools_rescueclosed.md) - Try finding the private keys for funds that are in outputs of remotely force-closed channels
+* [chantools rescuefunding](chantools_rescuefunding.md) - Rescue funds locked in a funding multisig output that never resulted in a proper channel; this is the command the initiator of the channel needs to run
+* [chantools showrootkey](chantools_showrootkey.md) - Extract and show the BIP32 HD root key from the 24 word lnd aezeed
+* [chantools signrescuefunding](chantools_signrescuefunding.md) - Rescue funds locked in a funding multisig output that never resulted in a proper channel; this is the command the remote node (the non-initiator) of the channel needs to run
+* [chantools summary](chantools_summary.md) - Compile a summary about the current state of channels
+* [chantools sweeptimelock](chantools_sweeptimelock.md) - Sweep the force-closed state after the time lock has expired
+* [chantools sweeptimelockmanual](chantools_sweeptimelockmanual.md) - Sweep the force-closed state of a single channel manually if only a channel backup file is available
+* [chantools vanitygen](chantools_vanitygen.md) - Generate a seed with a custom lnd node identity public key that starts with the given prefix
+* [chantools walletinfo](chantools_walletinfo.md) - Shows info about an lnd wallet.db file and optionally extracts the BIP32 HD root key
+
diff --git a/doc/chantools_chanbackup.md b/doc/chantools_chanbackup.md
new file mode 100644
index 0000000..2be0662
--- /dev/null
+++ b/doc/chantools_chanbackup.md
@@ -0,0 +1,29 @@
+## chantools chanbackup
+
+Create a channel.backup file from a channel database
+
+```
+chantools chanbackup [flags]
+```
+
+### Options
+
+```
+ --bip39 read a classic BIP39 seed and passphrase from the terminal instead of asking for lnd seed format or providing the --rootkey flag
+ --channeldb string lnd channel.db file to create the backup from
+ -h, --help help for chanbackup
+ --multi_file string lnd channel.backup file to create
+ --rootkey string BIP32 HD root key of the wallet to use for creating the backup; leave empty to prompt for lnd 24 word aezeed
+```
+
+### Options inherited from parent commands
+
+```
+ -r, --regtest Indicates if regtest parameters should be used
+ -t, --testnet Indicates if testnet parameters should be used
+```
+
+### SEE ALSO
+
+* [chantools](chantools.md) - Chantools helps recover funds from lightning channels
+
diff --git a/doc/chantools_compactdb.md b/doc/chantools_compactdb.md
new file mode 100644
index 0000000..c6d6af9
--- /dev/null
+++ b/doc/chantools_compactdb.md
@@ -0,0 +1,28 @@
+## chantools compactdb
+
+Create a copy of a channel.db file in safe/read-only mode
+
+```
+chantools compactdb [flags]
+```
+
+### Options
+
+```
+ --destdb string new lnd channel.db file to copy the compacted database to
+ -h, --help help for compactdb
+ --sourcedb string lnd channel.db file to create the database backup from
+ --txmaxsize int maximum transaction size (default 65536)
+```
+
+### Options inherited from parent commands
+
+```
+ -r, --regtest Indicates if regtest parameters should be used
+ -t, --testnet Indicates if testnet parameters should be used
+```
+
+### SEE ALSO
+
+* [chantools](chantools.md) - Chantools helps recover funds from lightning channels
+
diff --git a/doc/chantools_derivekey.md b/doc/chantools_derivekey.md
new file mode 100644
index 0000000..3194d73
--- /dev/null
+++ b/doc/chantools_derivekey.md
@@ -0,0 +1,29 @@
+## chantools derivekey
+
+Derive a key with a specific derivation path
+
+```
+chantools derivekey [flags]
+```
+
+### Options
+
+```
+ --bip39 read a classic BIP39 seed and passphrase from the terminal instead of asking for lnd seed format or providing the --rootkey flag
+ -h, --help help for derivekey
+ --neuter don't output private key(s), only public key(s)
+ --path string BIP32 derivation path to derive; must start with "m/"
+ --rootkey string BIP32 HD root key of the wallet to use for decrypting the backup; leave empty to prompt for lnd 24 word aezeed
+```
+
+### Options inherited from parent commands
+
+```
+ -r, --regtest Indicates if regtest parameters should be used
+ -t, --testnet Indicates if testnet parameters should be used
+```
+
+### SEE ALSO
+
+* [chantools](chantools.md) - Chantools helps recover funds from lightning channels
+
diff --git a/doc/chantools_dumpbackup.md b/doc/chantools_dumpbackup.md
new file mode 100644
index 0000000..443369b
--- /dev/null
+++ b/doc/chantools_dumpbackup.md
@@ -0,0 +1,28 @@
+## chantools dumpbackup
+
+Dump the content of a channel.backup file
+
+```
+chantools dumpbackup [flags]
+```
+
+### Options
+
+```
+ --bip39 read a classic BIP39 seed and passphrase from the terminal instead of asking for lnd seed format or providing the --rootkey flag
+ -h, --help help for dumpbackup
+ --multi_file string lnd channel.backup file to dump
+ --rootkey string BIP32 HD root key of the wallet to use for decrypting the backup; leave empty to prompt for lnd 24 word aezeed
+```
+
+### Options inherited from parent commands
+
+```
+ -r, --regtest Indicates if regtest parameters should be used
+ -t, --testnet Indicates if testnet parameters should be used
+```
+
+### SEE ALSO
+
+* [chantools](chantools.md) - Chantools helps recover funds from lightning channels
+
diff --git a/doc/chantools_dumpchannels.md b/doc/chantools_dumpchannels.md
new file mode 100644
index 0000000..3e31444
--- /dev/null
+++ b/doc/chantools_dumpchannels.md
@@ -0,0 +1,27 @@
+## chantools dumpchannels
+
+Dump all channel information from an lnd channel database
+
+```
+chantools dumpchannels [flags]
+```
+
+### Options
+
+```
+ --channeldb string lnd channel.db file to dump channels from
+ --closed dump closed channels instead of open
+ -h, --help help for dumpchannels
+```
+
+### Options inherited from parent commands
+
+```
+ -r, --regtest Indicates if regtest parameters should be used
+ -t, --testnet Indicates if testnet parameters should be used
+```
+
+### SEE ALSO
+
+* [chantools](chantools.md) - Chantools helps recover funds from lightning channels
+
diff --git a/doc/chantools_filterbackup.md b/doc/chantools_filterbackup.md
new file mode 100644
index 0000000..1788097
--- /dev/null
+++ b/doc/chantools_filterbackup.md
@@ -0,0 +1,29 @@
+## chantools filterbackup
+
+Filter an lnd channel.backup file and remove certain channels
+
+```
+chantools filterbackup [flags]
+```
+
+### Options
+
+```
+ --bip39 read a classic BIP39 seed and passphrase from the terminal instead of asking for lnd seed format or providing the --rootkey flag
+ --discard string comma separated list of channel funding outpoints (format :) to remove from the backup file
+ -h, --help help for filterbackup
+ --multi_file string lnd channel.backup file to filter
+ --rootkey string BIP32 HD root key of the wallet to use for decrypting the backup; leave empty to prompt for lnd 24 word aezeed
+```
+
+### Options inherited from parent commands
+
+```
+ -r, --regtest Indicates if regtest parameters should be used
+ -t, --testnet Indicates if testnet parameters should be used
+```
+
+### SEE ALSO
+
+* [chantools](chantools.md) - Chantools helps recover funds from lightning channels
+
diff --git a/doc/chantools_fixoldbackup.md b/doc/chantools_fixoldbackup.md
new file mode 100644
index 0000000..09fcb82
--- /dev/null
+++ b/doc/chantools_fixoldbackup.md
@@ -0,0 +1,28 @@
+## chantools fixoldbackup
+
+Fixes an old channel.backup file that is affected by the lnd issue #3881 (unable to derive shachain root key)
+
+```
+chantools fixoldbackup [flags]
+```
+
+### Options
+
+```
+ --bip39 read a classic BIP39 seed and passphrase from the terminal instead of asking for lnd seed format or providing the --rootkey flag
+ -h, --help help for fixoldbackup
+ --multi_file string lnd channel.backup file to fix
+ --rootkey string BIP32 HD root key of the wallet to use for decrypting the backup; leave empty to prompt for lnd 24 word aezeed
+```
+
+### Options inherited from parent commands
+
+```
+ -r, --regtest Indicates if regtest parameters should be used
+ -t, --testnet Indicates if testnet parameters should be used
+```
+
+### SEE ALSO
+
+* [chantools](chantools.md) - Chantools helps recover funds from lightning channels
+
diff --git a/doc/chantools_forceclose.md b/doc/chantools_forceclose.md
new file mode 100644
index 0000000..48933c0
--- /dev/null
+++ b/doc/chantools_forceclose.md
@@ -0,0 +1,34 @@
+## chantools forceclose
+
+Force-close the last state that is in the channel.db provided
+
+```
+chantools forceclose [flags]
+```
+
+### Options
+
+```
+ --apiurl string API URL to use (must be esplora compatible) (default "https://blockstream.info/api")
+ --bip39 read a classic BIP39 seed and passphrase from the terminal instead of asking for lnd seed format or providing the --rootkey flag
+ --channeldb string lnd channel.db file to use for force-closing channels
+ --fromchanneldb string channel input is in the format of an lnd channel.db file
+ --fromsummary string channel input is in the format of chantool's channel summary; specify '-' to read from stdin
+ -h, --help help for forceclose
+ --listchannels string channel input is in the format of lncli's listchannels format; specify '-' to read from stdin
+ --pendingchannels string channel input is in the format of lncli's pendingchannels format; specify '-' to read from stdin
+ --publish publish force-closing TX to the chain API instead of just printing the TX
+ --rootkey string BIP32 HD root key of the wallet to use for decrypting the backup; leave empty to prompt for lnd 24 word aezeed
+```
+
+### Options inherited from parent commands
+
+```
+ -r, --regtest Indicates if regtest parameters should be used
+ -t, --testnet Indicates if testnet parameters should be used
+```
+
+### SEE ALSO
+
+* [chantools](chantools.md) - Chantools helps recover funds from lightning channels
+
diff --git a/doc/chantools_genimportscript.md b/doc/chantools_genimportscript.md
new file mode 100644
index 0000000..f0e5fa9
--- /dev/null
+++ b/doc/chantools_genimportscript.md
@@ -0,0 +1,32 @@
+## chantools genimportscript
+
+Generate a script containing the on-chain keys of an lnd wallet that can be imported into other software like bitcoind
+
+```
+chantools genimportscript [flags]
+```
+
+### Options
+
+```
+ --bip39 read a classic BIP39 seed and passphrase from the terminal instead of asking for lnd seed format or providing the --rootkey flag
+ --derivationpath string use one specific derivation path; specify the first levels of the derivation path before any internal/external branch; Cannot be used in conjunction with --lndpaths
+ --format string format of the generated import script; currently supported are: bitcoin-importwallet, bitcoin-cli and bitcoin-cli-watchonly (default "bitcoin-importwallet")
+ -h, --help help for genimportscript
+ --lndpaths use all derivation paths that lnd used; results in a large number of results; cannot be used in conjunction with --derivationpath
+ --recoverywindow uint32 number of keys to scan per internal/external branch; output will consist of double this amount of keys (default 2500)
+ --rescanfrom uint32 block number to rescan from; will be set automatically from the wallet birthday if the lnd 24 word aezeed is entered (default 500000)
+ --rootkey string BIP32 HD root key of the wallet to use for decrypting the backup; leave empty to prompt for lnd 24 word aezeed
+```
+
+### Options inherited from parent commands
+
+```
+ -r, --regtest Indicates if regtest parameters should be used
+ -t, --testnet Indicates if testnet parameters should be used
+```
+
+### SEE ALSO
+
+* [chantools](chantools.md) - Chantools helps recover funds from lightning channels
+
diff --git a/doc/chantools_removechannel.md b/doc/chantools_removechannel.md
new file mode 100644
index 0000000..1f62875
--- /dev/null
+++ b/doc/chantools_removechannel.md
@@ -0,0 +1,27 @@
+## chantools removechannel
+
+Remove a single channel from the given channel DB
+
+```
+chantools removechannel [flags]
+```
+
+### Options
+
+```
+ --channel string channel to remove from the DB file, identified by its channel point (:)
+ --channeldb string lnd channel.backup file to remove the channel from
+ -h, --help help for removechannel
+```
+
+### Options inherited from parent commands
+
+```
+ -r, --regtest Indicates if regtest parameters should be used
+ -t, --testnet Indicates if testnet parameters should be used
+```
+
+### SEE ALSO
+
+* [chantools](chantools.md) - Chantools helps recover funds from lightning channels
+
diff --git a/doc/chantools_rescueclosed.md b/doc/chantools_rescueclosed.md
new file mode 100644
index 0000000..35ae27f
--- /dev/null
+++ b/doc/chantools_rescueclosed.md
@@ -0,0 +1,32 @@
+## chantools rescueclosed
+
+Try finding the private keys for funds that are in outputs of remotely force-closed channels
+
+```
+chantools rescueclosed [flags]
+```
+
+### Options
+
+```
+ --bip39 read a classic BIP39 seed and passphrase from the terminal instead of asking for lnd seed format or providing the --rootkey flag
+ --channeldb string lnd channel.db file to use for rescuing force-closed channels
+ --fromchanneldb string channel input is in the format of an lnd channel.db file
+ --fromsummary string channel input is in the format of chantool's channel summary; specify '-' to read from stdin
+ -h, --help help for rescueclosed
+ --listchannels string channel input is in the format of lncli's listchannels format; specify '-' to read from stdin
+ --pendingchannels string channel input is in the format of lncli's pendingchannels format; specify '-' to read from stdin
+ --rootkey string BIP32 HD root key of the wallet to use for decrypting the backup; leave empty to prompt for lnd 24 word aezeed
+```
+
+### Options inherited from parent commands
+
+```
+ -r, --regtest Indicates if regtest parameters should be used
+ -t, --testnet Indicates if testnet parameters should be used
+```
+
+### SEE ALSO
+
+* [chantools](chantools.md) - Chantools helps recover funds from lightning channels
+
diff --git a/doc/chantools_rescuefunding.md b/doc/chantools_rescuefunding.md
new file mode 100644
index 0000000..1eaadd3
--- /dev/null
+++ b/doc/chantools_rescuefunding.md
@@ -0,0 +1,32 @@
+## chantools rescuefunding
+
+Rescue funds locked in a funding multisig output that never resulted in a proper channel; this is the command the initiator of the channel needs to run
+
+```
+chantools rescuefunding [flags]
+```
+
+### Options
+
+```
+ --bip39 read a classic BIP39 seed and passphrase from the terminal instead of asking for lnd seed format or providing the --rootkey flag
+ --channeldb string lnd channel.db file to rescue a channel from; must contain the pending channel specified with --channelpoint
+ --channelpoint string funding transaction outpoint of the channel to rescue (:) as it is recorded in the DB
+ --confirmedchannelpoint string channel outpoint that got confirmed on chain (:); normally this is the same as the --channelpoint so it will be set to that value ifthis is left empty
+ --feerate uint16 fee rate to use for the sweep transaction in sat/vByte (default 2)
+ -h, --help help for rescuefunding
+ --rootkey string BIP32 HD root key of the wallet to use for deriving keys; leave empty to prompt for lnd 24 word aezeed
+ --sweepaddr string address to sweep the funds to
+```
+
+### Options inherited from parent commands
+
+```
+ -r, --regtest Indicates if regtest parameters should be used
+ -t, --testnet Indicates if testnet parameters should be used
+```
+
+### SEE ALSO
+
+* [chantools](chantools.md) - Chantools helps recover funds from lightning channels
+
diff --git a/doc/chantools_showrootkey.md b/doc/chantools_showrootkey.md
new file mode 100644
index 0000000..bc0b875
--- /dev/null
+++ b/doc/chantools_showrootkey.md
@@ -0,0 +1,27 @@
+## chantools showrootkey
+
+Extract and show the BIP32 HD root key from the 24 word lnd aezeed
+
+```
+chantools showrootkey [flags]
+```
+
+### Options
+
+```
+ --bip39 read a classic BIP39 seed and passphrase from the terminal instead of asking for lnd seed format or providing the --rootkey flag
+ -h, --help help for showrootkey
+ --rootkey string BIP32 HD root key of the wallet to use for decrypting the backup; leave empty to prompt for lnd 24 word aezeed
+```
+
+### Options inherited from parent commands
+
+```
+ -r, --regtest Indicates if regtest parameters should be used
+ -t, --testnet Indicates if testnet parameters should be used
+```
+
+### SEE ALSO
+
+* [chantools](chantools.md) - Chantools helps recover funds from lightning channels
+
diff --git a/doc/chantools_signrescuefunding.md b/doc/chantools_signrescuefunding.md
new file mode 100644
index 0000000..1539654
--- /dev/null
+++ b/doc/chantools_signrescuefunding.md
@@ -0,0 +1,26 @@
+## chantools signrescuefunding
+
+Rescue funds locked in a funding multisig output that never resulted in a proper channel; this is the command the remote node (the non-initiator) of the channel needs to run
+
+```
+chantools signrescuefunding [flags]
+```
+
+### Options
+
+```
+ -h, --help help for signrescuefunding
+ --psbt string Partially Signed Bitcoin Transaction that was provided by the initiator of the channel to rescue
+```
+
+### Options inherited from parent commands
+
+```
+ -r, --regtest Indicates if regtest parameters should be used
+ -t, --testnet Indicates if testnet parameters should be used
+```
+
+### SEE ALSO
+
+* [chantools](chantools.md) - Chantools helps recover funds from lightning channels
+
diff --git a/doc/chantools_summary.md b/doc/chantools_summary.md
new file mode 100644
index 0000000..d111c67
--- /dev/null
+++ b/doc/chantools_summary.md
@@ -0,0 +1,30 @@
+## chantools summary
+
+Compile a summary about the current state of channels
+
+```
+chantools summary [flags]
+```
+
+### Options
+
+```
+ --apiurl string API URL to use (must be esplora compatible) (default "https://blockstream.info/api")
+ --fromchanneldb string channel input is in the format of an lnd channel.db file
+ --fromsummary string channel input is in the format of chantool's channel summary; specify '-' to read from stdin
+ -h, --help help for summary
+ --listchannels string channel input is in the format of lncli's listchannels format; specify '-' to read from stdin
+ --pendingchannels string channel input is in the format of lncli's pendingchannels format; specify '-' to read from stdin
+```
+
+### Options inherited from parent commands
+
+```
+ -r, --regtest Indicates if regtest parameters should be used
+ -t, --testnet Indicates if testnet parameters should be used
+```
+
+### SEE ALSO
+
+* [chantools](chantools.md) - Chantools helps recover funds from lightning channels
+
diff --git a/doc/chantools_sweeptimelock.md b/doc/chantools_sweeptimelock.md
new file mode 100644
index 0000000..9d0099e
--- /dev/null
+++ b/doc/chantools_sweeptimelock.md
@@ -0,0 +1,36 @@
+## chantools sweeptimelock
+
+Sweep the force-closed state after the time lock has expired
+
+```
+chantools sweeptimelock [flags]
+```
+
+### Options
+
+```
+ --apiurl string API URL to use (must be esplora compatible) (default "https://blockstream.info/api")
+ --bip39 read a classic BIP39 seed and passphrase from the terminal instead of asking for lnd seed format or providing the --rootkey flag
+ --feerate uint16 fee rate to use for the sweep transaction in sat/vByte (default 2)
+ --fromchanneldb string channel input is in the format of an lnd channel.db file
+ --fromsummary string channel input is in the format of chantool's channel summary; specify '-' to read from stdin
+ -h, --help help for sweeptimelock
+ --listchannels string channel input is in the format of lncli's listchannels format; specify '-' to read from stdin
+ --maxcsvlimit uint16 maximum CSV limit to use (default 2016)
+ --pendingchannels string channel input is in the format of lncli's pendingchannels format; specify '-' to read from stdin
+ --publish publish sweep TX to the chain API instead of just printing the TX
+ --rootkey string BIP32 HD root key of the wallet to use for deriving keys; leave empty to prompt for lnd 24 word aezeed
+ --sweepaddr string address to sweep the funds to
+```
+
+### Options inherited from parent commands
+
+```
+ -r, --regtest Indicates if regtest parameters should be used
+ -t, --testnet Indicates if testnet parameters should be used
+```
+
+### SEE ALSO
+
+* [chantools](chantools.md) - Chantools helps recover funds from lightning channels
+
diff --git a/doc/chantools_sweeptimelockmanual.md b/doc/chantools_sweeptimelockmanual.md
new file mode 100644
index 0000000..e44660d
--- /dev/null
+++ b/doc/chantools_sweeptimelockmanual.md
@@ -0,0 +1,38 @@
+## chantools sweeptimelockmanual
+
+Sweep the force-closed state of a single channel manually if only a channel backup file is available
+
+```
+chantools sweeptimelockmanual [flags]
+```
+
+### Options
+
+```
+ --apiurl string API URL to use (must be esplora compatible) (default "https://blockstream.info/api")
+ --bip39 read a classic BIP39 seed and passphrase from the terminal instead of asking for lnd seed format or providing the --rootkey flag
+ --feerate uint16 fee rate to use for the sweep transaction in sat/vByte (default 2)
+ --fromchanneldb string channel input is in the format of an lnd channel.db file
+ --fromsummary string channel input is in the format of chantool's channel summary; specify '-' to read from stdin
+ -h, --help help for sweeptimelockmanual
+ --listchannels string channel input is in the format of lncli's listchannels format; specify '-' to read from stdin
+ --maxcsvlimit uint16 maximum CSV limit to use (default 2016)
+ --pendingchannels string channel input is in the format of lncli's pendingchannels format; specify '-' to read from stdin
+ --publish publish sweep TX to the chain API instead of just printing the TX
+ --remoterevbasepoint string remote node's revocation base point, can be found in a channel.backup file
+ --rootkey string BIP32 HD root key of the wallet to use for deriving keys; leave empty to prompt for lnd 24 word aezeed
+ --sweepaddr string address to sweep the funds to
+ --timelockaddr string address of the time locked commitment output where the funds are stuck in
+```
+
+### Options inherited from parent commands
+
+```
+ -r, --regtest Indicates if regtest parameters should be used
+ -t, --testnet Indicates if testnet parameters should be used
+```
+
+### SEE ALSO
+
+* [chantools](chantools.md) - Chantools helps recover funds from lightning channels
+
diff --git a/doc/chantools_vanitygen.md b/doc/chantools_vanitygen.md
new file mode 100644
index 0000000..6badbd1
--- /dev/null
+++ b/doc/chantools_vanitygen.md
@@ -0,0 +1,27 @@
+## chantools vanitygen
+
+Generate a seed with a custom lnd node identity public key that starts with the given prefix
+
+```
+chantools vanitygen [flags]
+```
+
+### Options
+
+```
+ -h, --help help for vanitygen
+ --prefix string hex encoded prefix to find in node public key
+ --threads uint8 number of parallel threads (default 4)
+```
+
+### Options inherited from parent commands
+
+```
+ -r, --regtest Indicates if regtest parameters should be used
+ -t, --testnet Indicates if testnet parameters should be used
+```
+
+### SEE ALSO
+
+* [chantools](chantools.md) - Chantools helps recover funds from lightning channels
+
diff --git a/doc/chantools_walletinfo.md b/doc/chantools_walletinfo.md
new file mode 100644
index 0000000..b3bd155
--- /dev/null
+++ b/doc/chantools_walletinfo.md
@@ -0,0 +1,27 @@
+## chantools walletinfo
+
+Shows info about an lnd wallet.db file and optionally extracts the BIP32 HD root key
+
+```
+chantools walletinfo [flags]
+```
+
+### Options
+
+```
+ -h, --help help for walletinfo
+ --walletdb string lnd wallet.db file to dump the contents from
+ --withrootkey print BIP32 HD root key of wallet to standard out
+```
+
+### Options inherited from parent commands
+
+```
+ -r, --regtest Indicates if regtest parameters should be used
+ -t, --testnet Indicates if testnet parameters should be used
+```
+
+### SEE ALSO
+
+* [chantools](chantools.md) - Chantools helps recover funds from lightning channels
+