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

Initializes, creates and returns a new CWallet&semi; returns a null pointer in case of an error

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
std::shared&lowbar;ptr&lt;CWallet&gt;
CreateNew(
    xref:wallet/WalletContext.adoc[WalletContext]& context,
    std::string const& name,
    std::unique&lowbar;ptr&lt;WalletDatabase&gt; database,
    uint64&lowbar;t wallet&lowbar;creation&lowbar;flags,
    bool born&lowbar;encrypted,
    xref:bilingual_str.adoc[bilingual&lowbar;str]& error,
    std::vector&lt;bilingual&lowbar;str&gt;& warnings);
----

== Return Value

The new wallet, or nullptr on failure&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *context*
| The wallet context to create into&period;
| *name*
| The name for the new wallet&period;
| *database*
| The database backend for the new wallet&period;
| *wallet&lowbar;creation&lowbar;flags*
| Wallet flags to apply at creation&period;
| *born&lowbar;encrypted*
| Whether the wallet is created already encrypted&period;
| *error*
| Set to an error message on failure&period;
| *warnings*
| Warnings produced while creating&period;
|===


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