[#wallet-CWallet-GetExtKey]
= xref:wallet.adoc[wallet]::xref:wallet/CWallet.adoc[CWallet]::GetExtKey
:relfileprefix: ../../
:mrdocs:

Reconstruct the extended private key for an HD xpub&period; Returns nullopt when no descriptor has the private key, or the wallet is locked&period;

== Synopsis

Declared in `&lt;wallet&sol;wallet&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
std::optional&lt;CExtKey&gt;
GetExtKey(xref:CExtPubKey.adoc[CExtPubKey] const& xpub) const;
----

== Return Value

The extended private key, or nullopt if unavailable&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *xpub*
| The extended public key to reconstruct the private key for&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
