Get public or private key from address with C-lightning I'm studying Lightning network and I use c-lightning.
I can Get a new address with newaddr method, but I can't find private key.
My address is bcrt1qmckts70jsq2u5886lgcq2yn7xjmp97t09zlrg, how can I retrieve it's public key?
Where Can I find it's private key?
$ bitcoin-cli validateaddress bcrt1qmckts70jsq2u5886lgcq2yn7xjmp97t09zlrgj                                                              │
{                                                                                                                                       │
  &quot;isvalid&quot;: true,                                                                                                                      │
  &quot;address&quot;: &quot;bcrt1qmckts70jsq2u5886lgcq2yn7xjmp97t09zlrgj&quot;,                                                                            │
  &quot;scriptPubKey&quot;: &quot;0014de2cb879f28015ca1cfafa3005127e34b612f96f&quot;,                                                                       │
  &quot;isscript&quot;: false,                                                                                                                    │
  &quot;iswitness&quot;: true,                                                                                                                    │
  &quot;witness_version&quot;: 0,                                                                                                                 │
  &quot;witness_program&quot;: &quot;de2cb879f28015ca1cfafa3005127e34b612f96f&quot;                                                                         │
}
lightningd doesn't offer simple RPC commands to dump keys.
If you really need to access the keys the simplest way would be to derive them directly from the hsm_secret.
Keys for onchain transactions (since you mentioned newaddr. The other derivations are more involved) are derived using BIP32 unhardened derivation from m/0/0.
The root seed is derived from the hsm_secret with :
root_seed = hkdf_sha256(hsm_secret, salt=NULL, info=&quot;bip32 seed&quot;)

There exist tools such as the hsmtools (which currently only derive keys for the commitment transactions but might be extended in the furure) or jb55's clightning-dumpkeys which take care of the derivation for you.