-
Notifications
You must be signed in to change notification settings - Fork 266
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a separate configuration file for Eclair's onchain signer
Eclair's onchain signer now has its own `eclair-signer.conf` configuration file in HOCON format. It includes BIP39 mnemonic codes and passphrase, a wallet name and a timestamp. When an `eclair-signer.conf` file is found, Eclair's API will return descriptors that can be imported into an empty watch-only Bitcoin Wallet. When wallet name in `eclair-signer.conf` matches the name of the Bitcoin Core wallet defined in `eclair.conf` (`eclair.bitcoind.wallet`), Eclair will bypass Bitcoin Core and sign onchain transactions directly.
- Loading branch information
Showing
27 changed files
with
211 additions
and
177 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
# Using Eclair to manage your Bitcoin Core wallet's private keys | ||
|
||
You can configure Eclair to control (and never expose) the private keys of your Bitcoin Core wallet. This is very useful if your Bitcoin and Eclair nodes run on different machines for example, with a setup for the Bitcoin host that | ||
is less secure than for Eclair (because it is shared among several services for example). | ||
|
||
Follow these steps to delegate onchain key management to eclair: | ||
|
||
1) Generate or import a BIP39 mnemonic code and passphrase | ||
|
||
You can use any BIP39-compatible tool, including most hardware wallets. | ||
|
||
2) Create an `eclair-signer.conf` configuration file add it to eclair's data directory | ||
|
||
A signer configuration file uses the HOCON format that we already use for `eclair.conf` and must include the following options: | ||
|
||
key | description | ||
--------------------------|-------------------------------------------------------------------------- | ||
eclair.signer.wallet | wallet name | ||
eclair.signer.mnemonics | BIP39 mnemonic words | ||
eclair.signer.passphrase | passphrase | ||
eclair.signer.timestamp | wallet creation UNIX timestamp. Set to the current time for new wallets. | ||
|
||
This is an example of `eclair-signer.conf` configuration file: | ||
|
||
```hocon | ||
{ | ||
eclair { | ||
signer { | ||
wallet = "eclair" | ||
mnemonics = "legal winner thank year wave sausage worth useful legal winner thank year wave sausage worth useful legal winner thank year wave sausage worth title" | ||
passphrase = "" | ||
timestamp = 1686055705 | ||
} | ||
} | ||
} | ||
``` | ||
|
||
You must set `eclair.signer.wallet` to a name that is different from your current Bitcoin Core wallet. | ||
|
||
3) Create an empty, descriptor-enabled, watch-only wallet in Bitcoin Core: | ||
:warning: The name must match the one that you set in `eclair-signer.conf` (here we use "eclair") | ||
|
||
```shell | ||
$ bitcoin-cli -named createwallet wallet_name=eclair disable_private_keys=true blank=true descriptors=true load_on_startup=true | ||
``` | ||
|
||
4) Import public descriptors generated by Eclair | ||
|
||
`eclair-cli listdescriptors` will return public wallet descriptors in a format that is compatible with Bitcoin Core, and that you can import with `bitcoin-cli -rpcwallet=eclair importdescriptors` | ||
For now, this descriptors follow the BIP84 standard (p2wpkh outputs). | ||
This is an example of descriptors generated by Eclair: | ||
|
||
```json | ||
[ | ||
{ | ||
"desc": "wpkh([0d9250da/84h/1h/0h]tpubDDGF9PnrXww2h1mKNjKiXoqdDFGEcZGCZUNq7g26LdzKXKiE31RrFWsogPy1uMLrbG8ksQ8eJS6u6KFLjYUUSVJRuwmMD2SYCr8uG1TcRgM/0/*)#jz5n2pcp", | ||
"internal": false, | ||
"timestamp": 1686055705, | ||
"active": true | ||
}, | ||
{ | ||
"desc": "wpkh([0d9250da/84h/1h/0h]tpubDDGF9PnrXww2h1mKNjKiXoqdDFGEcZGCZUNq7g26LdzKXKiE31RrFWsogPy1uMLrbG8ksQ8eJS6u6KFLjYUUSVJRuwmMD2SYCr8uG1TcRgM/1/*)#rk3jh5ge", | ||
"internal": true, | ||
"timestamp": 1686055705, | ||
"active": true | ||
} | ||
] | ||
``` | ||
|
||
You can combine the generation and import of descriptors with: | ||
|
||
```shell | ||
$ eclair-cli getdescriptors | jq --raw-output -c | xargs -0 bitcoin-cli -rpcwallet=eclair importdescriptors | ||
``` | ||
|
||
:warning: If you are restoring an existing `eclair-signer.conf` file with a timestamp that is fairly old, importing descriptors can take a long time, and your | ||
Bitcoin Core node will not be usable until it's done | ||
|
||
5) Configure Eclair to handle private keys for this wallet | ||
|
||
Set `eclair.bitcoind.wallet` to the name of the wallet just created (`eclair` in the example above) and restart Eclair. | ||
|
||
You now have a Bitcoin Core watch-only wallet for which only your Eclair node can sign transactions. This Bitcoin Core wallet can | ||
safely be copied to another Bitcoin Core node to monitor your onchain funds. | ||
|
||
You can also use `eclair-cli getmasterxpub` to get a BIP32 extended public key that you can import into any compatible Bitcoin wallet | ||
to create a watch-only wallet (Electrum for example) that you can use to monitor your Bitcoin Core balance. | ||
|
||
:warning: this means that your Bitcoin Core wallet cannot send funds on its on (since it cannot access private keys to sign transactions). | ||
To send funds onchain you must use `eclair-cli sendonchain`. | ||
|
||
:warning: to backup the private keys of this wallet you must either backup your mnemonic code and passphrase, or backup the `eclair-signer.conf` file in your eclair | ||
directory (default is `~/.eclair`) along with your channels and node seed files. | ||
|
||
:warning: You can also initialise a backup onchain wallet with the same mnemonic code and passphrase (a hardware wallet for example), but be warned that using them may interfere with your node's operations (for example you may end up | ||
double-spending funding transactions generated by your node). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.