Restructure README

pull/3/head
Oliver Gugger 4 years ago
parent 8f2c8db310
commit 506f761dd3
No known key found for this signature in database
GPG Key ID: 8E4256593F177720

@ -1,5 +1,18 @@
# Channel tools # Channel tools
## Index
* [Installation](#installation)
* [Overview](#overview)
* [Commands](#commands)
+ [dumpbackup](#dumpbackup)
+ [dumpchannels](#dumpchannels)
+ [forceclose](#forceclose)
+ [rescueclosed](#rescueclosed)
+ [showrootkey](#showrootkey)
+ [summary](#summary)
+ [sweeptimelock](#sweeptimelock)
This tool provides helper functions that can be used to rescue funds locked in This tool provides helper functions that can be used to rescue funds locked in
lnd channels in case lnd itself cannot run properly any more. lnd channels in case lnd itself cannot run properly any more.
@ -47,57 +60,49 @@ Available commands:
sweeptimelock Sweep the force-closed state after the time lock has expired. sweeptimelock Sweep the force-closed state after the time lock has expired.
``` ```
## summary command ## Commands
### dumpbackup
```text ```text
Usage: Usage:
chantools [OPTIONS] summary chantools [OPTIONS] dumpbackup [dumpbackup-OPTIONS]
```
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 [dumpbackup command options]
lncli listchannels | chantools --listchannels - summary --rootkey= BIP32 HD root key of the wallet that was used to create the backup.
--multi_file= The lnd channel.backup file to dump.
``` ```
Example command 2: This command dumps all information that is inside a `channel.backup` file in a
human readable format.
Example command:
```bash ```bash
chantools --fromchanneldb ~/.lnd/data/graph/mainnet/channel.db chantools dumpbackup --rootkey xprvxxxxxxxxxx \
--multi_file ~/.lnd/data/chain/bitcoin/mainnet/channel.backup
``` ```
## rescueclosed command ### dumpchannels
```text ```text
Usage: Usage:
chantools [OPTIONS] rescueclosed [rescueclosed-OPTIONS] chantools [OPTIONS] dumpchannels [dumpchannels-OPTIONS]
[rescueclosed command options] [dumpchannels command options]
--rootkey= BIP32 HD root key to use. --channeldb= The lnd channel.db file to dump the channels from.
--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 This command dumps all open and pending channels from the given lnd `channel.db`
tries to find the private keys to sweep the funds from the output that belongs file in a human readable format.
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: Example command:
```bash ```bash
chantools --fromsummary results/summary-xxxx-yyyy.json \ chantools dumpchannels --channeldb ~/.lnd/data/graph/mainnet/channel.db
rescueclosed \
--channeldb ~/.lnd/data/graph/mainnet/channel.db \
--rootkey xprvxxxxxxxxxx
``` ```
## forceclose command ### forceclose
```text ```text
Usage: Usage:
@ -132,84 +137,94 @@ chantools --fromsummary results/summary-xxxx-yyyy.json \
--publish --publish
``` ```
## sweeptimelock command ### rescueclosed
```text ```text
Usage: Usage:
chantools [OPTIONS] sweeptimelock [sweeptimelock-OPTIONS] chantools [OPTIONS] rescueclosed [rescueclosed-OPTIONS]
[sweeptimelock command options] [rescueclosed command options]
--rootkey= BIP32 HD root key to use. --rootkey= BIP32 HD root key to use.
--publish Should the sweep TX be published to the chain API? --channeldb= The lnd channel.db file to use for rescuing force-closed channels.
--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 If channels have already been force-closed by the remote peer, this command
`forceclose` command. You **MUST** use the result file that was created with the tries to find the private keys to sweep the funds from the output that belongs
`forceclose` command, otherwise it won't work. You also have to wait until the to our side. This can only be used if we have a channel DB that contains the
highest time lock (can be up to 2000 blocks which is more than two weeks) of all latest commit point. Normally you would use SCB to get the funds from those
the channels has passed. If you only want to sweep channels that have the channels. But this method can help if the other node doesn't know about the
default CSV limit of 1 day, you can set the `--maxcsvlimit` parameter to 144. channels any more but we still have the channel.db from the moment they
force-closed.
Example command: Example command:
```bash ```bash
chantools --fromsummary results/forceclose-xxxx-yyyy.json \ chantools --fromsummary results/summary-xxxx-yyyy.json \
sweeptimelock rescueclosed \
--rootkey xprvxxxxxxxxxx \ --channeldb ~/.lnd/data/graph/mainnet/channel.db \
--publish \ --rootkey xprvxxxxxxxxxx
--sweepaddr bc1q.....
``` ```
## dumpchannels command ### 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
```
### summary
```text ```text
Usage: Usage:
chantools [OPTIONS] dumpchannels [dumpchannels-OPTIONS] chantools [OPTIONS] summary
[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` From a list of channels, find out what their state is by querying the funding
file in a human readable format. transaction on a block explorer API.
Example command: Example command 1:
```bash ```bash
chantools dumpchannels --channeldb ~/.lnd/data/graph/mainnet/channel.db lncli listchannels | chantools --listchannels - summary
``` ```
## showrootkey command Example command 2:
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 ```bash
chantools showrootkey chantools --fromchanneldb ~/.lnd/data/graph/mainnet/channel.db
``` ```
## dumpbackup command ### sweeptimelock
```text ```text
Usage: Usage:
chantools [OPTIONS] dumpbackup [dumpbackup-OPTIONS] chantools [OPTIONS] sweeptimelock [sweeptimelock-OPTIONS]
[dumpbackup command options] [sweeptimelock command options]
--rootkey= BIP32 HD root key of the wallet that was used to create the backup. --rootkey= BIP32 HD root key to use.
--multi_file= The lnd channel.backup file to dump. --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)
``` ```
This command dumps all information that is inside a `channel.backup` file in a Use this command to sweep the funds from channels that you force-closed with the
human readable format. `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: Example command:
```bash ```bash
chantools dumpbackup --rootkey xprvxxxxxxxxxx \ chantools --fromsummary results/forceclose-xxxx-yyyy.json \
--multi_file ~/.lnd/data/chain/bitcoin/mainnet/channel.backup sweeptimelock
``` --rootkey xprvxxxxxxxxxx \
--publish \
--sweepaddr bc1q.....
```

Loading…
Cancel
Save