clightning-dumpkeys

dump clightning output descriptors
git clone git://jb55.com/clightning-dumpkeys
Log | Files | Refs | README | LICENSE

README.md (2677B)


      1 
      2 # clightning-dumpkeys
      3 
      4 Dump funding wallet xpubs and xprv from your clightning node.
      5 
      6 **WARNING** just saving your xprvs is not enough to backup your
      7 clightning node. There are other channel state (p2wsh) outputs that are
      8 not dumped here. Please use the recommended backup method provided by
      9 clightning (as of this writing there aren't any, but that should
     10 change soon).
     11 
     12 
     13 ## usage
     14 
     15     $ ./clightning-dumpkeys ~/.lightning/hsm_secret
     16 
     17 It will dump your root+extended xprv/xpub with [output descriptors](https://github.com/bitcoin/bitcoin/blob/master/doc/descriptors.md):
     18 
     19 ```
     20 xprv9s21ZrQH143K2W9UqiTJL3qndXzRkEuzAoNwd6VLRu2VDtX6tACVz9q8BzDmJDkB6c6QQnfEWWvLtxB9M68XVpmcJCQodFrr843paWAXGeD	root private
     21 xpub661MyMwAqRbcEzDwwjzJhBnXBZpv9hdqY2JYRUtwzEZU6grFRhWkXx9c3HJ4EKR1Nvdwf5U3VoekstoKSKjfcJYhRrhMYeEzZzu2h7uZAQX	root public
     22 
     23 xprv9wPk6zRy29x8BLXUHWh8ssqf89xQWtrZeLUgEXyUKSqNdUJhXTJsMtdLCexXxhgxPYUFpQvUhz2WAyhh3uCXSLedbHkvX7jTnX4xQofjdbA	extended private
     24 combo(xprv9wPk6zRy29x8BLXUHWh8ssqf89xQWtrZeLUgEXyUKSqNdUJhXTJsMtdLCexXxhgxPYUFpQvUhz2WAyhh3uCXSLedbHkvX7jTnX4xQofjdbA/*)#u4tc9nwu	extended private descriptor
     25 xpub6AP6WVxrrXWRPpbwPYE9F1nPgBntvMaR1ZQH2vP5snNMWGdr4zd7ugwp3wukcTUxKu2rLCN9VBQAW3xioATnEWjZvQpx9cybj1jztJHJyp7	extended public
     26 combo(xpub6AP6WVxrrXWRPpbwPYE9F1nPgBntvMaR1ZQH2vP5snNMWGdr4zd7ugwp3wukcTUxKu2rLCN9VBQAW3xioATnEWjZvQpx9cybj1jztJHJyp7/*)#f64dm6yh	extended public descriptor
     27 ```
     28 
     29 ## building
     30 
     31 You need to have the `secp256k1` library installed for this to compile
     32 
     33     $ make
     34 
     35 
     36 ## output descriptors
     37 
     38 You can load your clightning wallet keys into your full node with importmulti.
     39 
     40 First, save the `extended public (or private) descriptor` into a
     41 `descriptors.json` file, this will be used for importing into bitcoin-core:
     42 
     43 `descriptors.json`:
     44 ```json
     45 [
     46   {
     47     "desc": "combo(xpub6AP6WVxrrXWRPpbwPYE9F1nPgBntvMaR1ZQH2vP5snNMWGdr4zd7ugwp3wukcTUxKu2rLCN9VBQAW3xioATnEWjZvQpx9cybj1jztJHJyp7/*)#f64dm6yh",
     48     "keypool": false,
     49     "timestamp": "now",
     50     "watchonly": true,
     51     "internal": false,
     52     "range": [0, 1000]
     53   }
     54 ]
     55 ```
     56 
     57 Change `watchonly` to `false` and `keypool` to `true` if you're using the
     58 extended private descriptor.
     59 
     60 `watchonly` means we're only going to watch these addresses, not spend them.
     61 
     62 `keypool` adds these keys into bitcoin-cores internal pool of keys, these are
     63 used when creating new addresses from the api, etc.
     64 
     65 Now we can import this into bitcoin:
     66 
     67     $ bitcoin-cli -named createwallet wallet_name=clightning disable_private_keys=true descriptors=true load_on_startup=true
     68     $ bitcoin-cli -rpcwallet=clightning importdescriptors "$(cat descriptors.json)"
     69     $ bitcoin-cli -rpcwallet=clightning rescanblockchain 503500