diff --git a/README.md b/README.md index 89e6de3..384410a 100644 --- a/README.md +++ b/README.md @@ -292,6 +292,7 @@ Quick access: + [dropchannelgraph](doc/chantools_dropchannelgraph.md) + [dumpbackup](doc/chantools_dumpbackup.md) + [dumpchannels](doc/chantools_dumpchannels.md) ++ [fakechanbackup](doc/chantools_fakechanbackup.md) + [filterbackup](doc/chantools_filterbackup.md) + [fixoldbackup](doc/chantools_fixoldbackup.md) + [genimportscript](doc/chantools_genimportscript.md) diff --git a/doc/chantools.md b/doc/chantools.md index 4cfca64..bbd34b1 100644 --- a/doc/chantools.md +++ b/doc/chantools.md @@ -24,6 +24,7 @@ Complete documentation is available at https://github.com/guggero/chantools/. * [chantools dropchannelgraph](chantools_dropchannelgraph.md) - Remove all graph related data from a channel DB * [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 fakechanbackup](chantools_fakechanbackup.md) - Fake a channel backup file to attempt fund recovery * [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 diff --git a/doc/chantools_dropchannelgraph.md b/doc/chantools_dropchannelgraph.md index 49789c5..e4e8379 100644 --- a/doc/chantools_dropchannelgraph.md +++ b/doc/chantools_dropchannelgraph.md @@ -7,6 +7,10 @@ Remove all graph related data from a channel DB This command removes all graph data from a channel DB, forcing the lnd node to do a full graph sync. +CAUTION: Running this command will make it impossible to use the channel DB +with an older version of lnd. Downgrading is not possible and you'll need to +run lnd v0.12.0-beta or later after using this command!' + ``` chantools dropchannelgraph [flags] ``` diff --git a/doc/chantools_fakechanbackup.md b/doc/chantools_fakechanbackup.md new file mode 100644 index 0000000..c92979c --- /dev/null +++ b/doc/chantools_fakechanbackup.md @@ -0,0 +1,60 @@ +## chantools fakechanbackup + +Fake a channel backup file to attempt fund recovery + +### Synopsis + +If for any reason a node suffers from data loss and there is no +channel.backup for one or more channels, then the funds in the channel would +theoretically be lost forever. +If the remote node is still online and still knows about the channel, there is +hope. We can initiate DLP (Data Loss Protocol) and ask the remote node to +force-close the channel and to provide us with the per_commit_point that is +needed to derive the private key for our part of the force-close transaction +output. But to initiate DLP, we would need to have a channel.backup file. +Fortunately, if we have enough information about the channel, we can create a +faked/skeleton channel.backup file that at least lets us talk to the other node +and ask them to do their part. Then we can later brute-force the private key for +the transaction output of our part of the funds (see rescueclosed command). + +``` +chantools fakechanbackup [flags] +``` + +### Examples + +``` +chantools fakechanbackup --rootkey xprvxxxxxxxxxx \ + --capacity 123456 \ + --channelpoint f39310xxxxxxxxxx:1 \ + --initiator \ + --remote_node_addr 022c260xxxxxxxx@213.174.150.1:9735 \ + --short_channel_id 566222x300x1 \ + --multi_file fake.backup +``` + +### Options + +``` + --bip39 read a classic BIP39 seed and passphrase from the terminal instead of asking for lnd seed format or providing the --rootkey flag + --capacity uint the channel's capacity in satoshis + --channelpoint string funding transaction outpoint of the channel to rescue (:) as it is displayed on 1ml.com + -h, --help help for fakechanbackup + --initiator whether our node was the initiator (funder) of the channel + --multi_file string the fake channel backup file to create (default "results/fake-2021-03-01-10-12-23.backup") + --remote_node_addr string the remote node connection information in the format pubkey@host:port + --rootkey string BIP32 HD root key of the wallet to use for encrypting the backup; leave empty to prompt for lnd 24 word aezeed + --short_channel_id string the short channel ID in the format xx +``` + +### 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 index 8335e90..094de49 100644 --- a/doc/chantools_rescueclosed.md +++ b/doc/chantools_rescueclosed.md @@ -12,6 +12,11 @@ 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. +The alternative use case for this command is if you got the commit point by +running the fund-recovery branch of my guggero/lnd fork in combination with the +fakechanbackup command. Then you need to specify the --commit_point and +--force_close_addr flags instead of the --channeldb and --fromsummary flags. + ``` chantools rescueclosed [flags] ``` @@ -22,19 +27,25 @@ chantools rescueclosed [flags] chantools rescueclosed --rootkey xprvxxxxxxxxxx \ --fromsummary results/summary-xxxxxx.json \ --channeldb ~/.lnd/data/graph/mainnet/channel.db + +chantools rescueclosed --rootkey xprvxxxxxxxxxx \ + --force_close_addr bc1q... \ + --commit_point 03xxxx ``` ### 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 + --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 + --commit_point string the commit point that was obtained from the logs after running the fund-recovery branch of guggero/lnd + --force_close_addr string the address the channel was force closed to + --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