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
## 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
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.
```
## summary command
## Commands
### dumpbackup
```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:
chantools [OPTIONS] dumpbackup [dumpbackup-OPTIONS]
```bash
lncli listchannels | chantools --listchannels - summary
[dumpbackup command options]
--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
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
Usage:
chantools [OPTIONS] rescueclosed [rescueclosed-OPTIONS]
chantools [OPTIONS] dumpchannels [dumpchannels-OPTIONS]
[rescueclosed command options]
--rootkey= BIP32 HD root key to use.
--channeldb= The lnd channel.db file to use for rescuing force-closed channels.
[dumpchannels command options]
--channeldb= The lnd channel.db file to dump the channels from.
```
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.
This command dumps all open and pending channels from the given lnd `channel.db`
file in a human readable format.
Example command:
```bash
chantools --fromsummary results/summary-xxxx-yyyy.json \
rescueclosed \
--channeldb ~/.lnd/data/graph/mainnet/channel.db \
--rootkey xprvxxxxxxxxxx
chantools dumpchannels --channeldb ~/.lnd/data/graph/mainnet/channel.db
```
## forceclose command
### forceclose
```text
Usage:
@ -132,84 +137,94 @@ chantools --fromsummary results/summary-xxxx-yyyy.json \
--publish
```
## sweeptimelock command
### rescueclosed
```text
Usage:
chantools [OPTIONS] sweeptimelock [sweeptimelock-OPTIONS]
chantools [OPTIONS] rescueclosed [rescueclosed-OPTIONS]
[sweeptimelock command options]
[rescueclosed command options]
--rootkey= BIP32 HD root key to use.
--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)
--channeldb= The lnd channel.db file to use for rescuing force-closed channels.
```
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.
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/forceclose-xxxx-yyyy.json \
sweeptimelock
--rootkey xprvxxxxxxxxxx \
--publish \
--sweepaddr bc1q.....
chantools --fromsummary results/summary-xxxx-yyyy.json \
rescueclosed \
--channeldb ~/.lnd/data/graph/mainnet/channel.db \
--rootkey xprvxxxxxxxxxx
```
## 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
Usage:
chantools [OPTIONS] dumpchannels [dumpchannels-OPTIONS]
[dumpchannels command options]
--channeldb= The lnd channel.db file to dump the channels from.
chantools [OPTIONS] summary
```
This command dumps all open and pending channels from the given lnd `channel.db`
file in a human readable format.
From a list of channels, find out what their state is by querying the funding
transaction on a block explorer API.
Example command:
Example command 1:
```bash
chantools dumpchannels --channeldb ~/.lnd/data/graph/mainnet/channel.db
lncli listchannels | chantools --listchannels - summary
```
## showrootkey command
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:
Example command 2:
```bash
chantools showrootkey
chantools --fromchanneldb ~/.lnd/data/graph/mainnet/channel.db
```
## dumpbackup command
### sweeptimelock
```text
Usage:
chantools [OPTIONS] dumpbackup [dumpbackup-OPTIONS]
chantools [OPTIONS] sweeptimelock [sweeptimelock-OPTIONS]
[dumpbackup command options]
--rootkey= BIP32 HD root key of the wallet that was used to create the backup.
--multi_file= The lnd channel.backup file to dump.
[sweeptimelock command options]
--rootkey= BIP32 HD root key to use.
--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
human readable format.
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 dumpbackup --rootkey xprvxxxxxxxxxx \
--multi_file ~/.lnd/data/chain/bitcoin/mainnet/channel.backup
```
chantools --fromsummary results/forceclose-xxxx-yyyy.json \
sweeptimelock
--rootkey xprvxxxxxxxxxx \
--publish \
--sweepaddr bc1q.....
```

Loading…
Cancel
Save