Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jb55/clightning-dumpkeys
Dump funding wallet private keys from your clightning node
https://github.com/jb55/clightning-dumpkeys
bitcoin clightning lightning-network
Last synced: 3 months ago
JSON representation
Dump funding wallet private keys from your clightning node
- Host: GitHub
- URL: https://github.com/jb55/clightning-dumpkeys
- Owner: jb55
- License: other
- Created: 2019-05-24T20:48:21.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-08-02T21:10:35.000Z (over 1 year ago)
- Last Synced: 2023-08-02T22:35:45.513Z (over 1 year ago)
- Topics: bitcoin, clightning, lightning-network
- Language: C
- Homepage:
- Size: 49.8 KB
- Stars: 14
- Watchers: 3
- Forks: 4
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# clightning-dumpkeys
Dump funding wallet xpubs and xprv from your clightning node.
**WARNING** just saving your xprvs is not enough to backup your
clightning node. There are other channel state (p2wsh) outputs that are
not dumped here. Please use the recommended backup method provided by
clightning (as of this writing there aren't any, but that should
change soon).## usage
$ ./clightning-dumpkeys ~/.lightning/hsm_secret
It will dump your root+extended xprv/xpub with [output descriptors](https://github.com/bitcoin/bitcoin/blob/master/doc/descriptors.md):
```
xprv9s21ZrQH143K2W9UqiTJL3qndXzRkEuzAoNwd6VLRu2VDtX6tACVz9q8BzDmJDkB6c6QQnfEWWvLtxB9M68XVpmcJCQodFrr843paWAXGeD root private
xpub661MyMwAqRbcEzDwwjzJhBnXBZpv9hdqY2JYRUtwzEZU6grFRhWkXx9c3HJ4EKR1Nvdwf5U3VoekstoKSKjfcJYhRrhMYeEzZzu2h7uZAQX root publicxprv9wPk6zRy29x8BLXUHWh8ssqf89xQWtrZeLUgEXyUKSqNdUJhXTJsMtdLCexXxhgxPYUFpQvUhz2WAyhh3uCXSLedbHkvX7jTnX4xQofjdbA extended private
combo(xprv9wPk6zRy29x8BLXUHWh8ssqf89xQWtrZeLUgEXyUKSqNdUJhXTJsMtdLCexXxhgxPYUFpQvUhz2WAyhh3uCXSLedbHkvX7jTnX4xQofjdbA/*)#u4tc9nwu extended private descriptor
xpub6AP6WVxrrXWRPpbwPYE9F1nPgBntvMaR1ZQH2vP5snNMWGdr4zd7ugwp3wukcTUxKu2rLCN9VBQAW3xioATnEWjZvQpx9cybj1jztJHJyp7 extended public
combo(xpub6AP6WVxrrXWRPpbwPYE9F1nPgBntvMaR1ZQH2vP5snNMWGdr4zd7ugwp3wukcTUxKu2rLCN9VBQAW3xioATnEWjZvQpx9cybj1jztJHJyp7/*)#f64dm6yh extended public descriptor
```## building
You need to have the `secp256k1` library installed for this to compile
$ make
## output descriptors
You can load your clightning wallet keys into your full node with importmulti.
First, save the `extended public (or private) descriptor` into a
`descriptors.json` file, this will be used for importing into bitcoin-core:`descriptors.json`:
```json
[
{
"desc": "combo(xpub6AP6WVxrrXWRPpbwPYE9F1nPgBntvMaR1ZQH2vP5snNMWGdr4zd7ugwp3wukcTUxKu2rLCN9VBQAW3xioATnEWjZvQpx9cybj1jztJHJyp7/*)#f64dm6yh",
"keypool": false,
"timestamp": "now",
"watchonly": true,
"internal": false,
"range": [0, 1000]
}
]
```Change `watchonly` to `false` and `keypool` to `true` if you're using the
extended private descriptor.`watchonly` means we're only going to watch these addresses, not spend them.
`keypool` adds these keys into bitcoin-cores internal pool of keys, these are
used when creating new addresses from the api, etc.Now we can import this into bitcoin:
$ bitcoin-cli -named createwallet wallet_name=clightning disable_private_keys=true descriptors=true load_on_startup=true
$ bitcoin-cli -rpcwallet=clightning importdescriptors "$(cat descriptors.json)"
$ bitcoin-cli -rpcwallet=clightning rescanblockchain 503500