user91116: 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                                                              │
{                                                                                                                                       │
  "isvalid": true,                                                                                                                      │
  "address": "bcrt1qmckts70jsq2u5886lgcq2yn7xjmp97t09zlrgj",                                                                            │
  "scriptPubKey": "0014de2cb879f28015ca1cfafa3005127e34b612f96f",                                                                       │
  "isscript": false,                                                                                                                    │
  "iswitness": true,                                                                                                                    │
  "witness_version": 0,                                                                                                                 │
  "witness_program": "de2cb879f28015ca1cfafa3005127e34b612f96f"                                                                         │
} 


user101498: 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="bip32 seed")

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.

91116: <p>I'm studying Lightning network and I use c-lightning.
I can Get a new address with <code>newaddr</code> method, but I can't find private key.
My address is <code>bcrt1qmckts70jsq2u5886lgcq2yn7xjmp97t09zlrg</code>, how can I retrieve it's public key?
Where Can I find it's private key?</p>
<pre><code>$ 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;                                                                         │
} 
</code></pre>
 101498: <p><code>lightningd</code> doesn't offer simple RPC commands to dump keys.</p>
<p>If you really need to access the keys the simplest way would be to derive them directly from the <code>hsm_secret</code>.</p>
<p>Keys for onchain transactions (since you mentioned <code>newaddr</code>. The other derivations are more involved) are derived using BIP32 unhardened derivation from <code>m/0/0</code>.<br />
The root seed is derived from the <code>hsm_secret</code> with :</p>
<pre><code>root_seed = hkdf_sha256(hsm_secret, salt=NULL, info=&quot;bip32 seed&quot;)
</code></pre>
<p>There exist tools such as the <a href="https://github.com/ElementsProject/lightning/blob/master/tools/hsmtool.c" rel="nofollow noreferrer"><code>hsmtools</code></a> <em>(which currently only derive keys for the commitment transactions but might be extended in the furure)</em> or jb55's <a href="https://github.com/jb55/clightning-dumpkeys/" rel="nofollow noreferrer"><code>clightning-dumpkeys</code></a> which take care of the derivation for you.</p>
