How to get my c-lightning node's private key?

1

lightning-cli getinfo outputs my node's id, which is its public key. How can I get its underlying private key?

fiatjaf

Posted 2019-04-04T01:46:17.157

Reputation: 223

Answers

2

c-lightning uses this code to obtain the node's private key from the hsm_secret.

I've came up with a way to do the same using Python and posted my highly-commented tutorial-like code in this gist.

Basically you have to call an hkdf function with the hsm_secret contents, a salt which will usually be zero, \x00, and the label "nodeid".

fiatjaf

Posted 2019-04-04T01:46:17.157

Reputation: 223