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

Submit the transaction to the node&apos;s mempool and then relay to peers&period; Should be called after CreateTransaction unless you want to abort broadcasting the transaction&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
void
CommitTransaction(
    xref:CTransactionRef.adoc[CTransactionRef] tx,
    std::optional&lt;Txid&gt; replaces&lowbar;txid = std&colon;&colon;nullopt,
    std::optional&lt;std::string&gt; comment = std&colon;&colon;nullopt,
    std::optional&lt;std::string&gt; comment&lowbar;to = std&colon;&colon;nullopt,
    std::vector&lt;std::string&gt; const& messages = &lcub;&rcub;,
    std::vector&lt;std::string&gt; const& payment&lowbar;requests = &lcub;&rcub;);
----

== Parameters

[cols="1,4"]
|===
| Name| Description
| *tx* [in]
| The transaction to be broadcast&period;
| *replaces&lowbar;txid* [in]
| The txid of the transaction that this transaction replaces
| *comment* [in]
| The user&apos;s comment for this transaction
| *comment&lowbar;to* [in]
| The comment for this transaction indicating where coins are sent to
| *messages* [in]
| The BIP 21 URI messages to attach to this transaction
| *payment&lowbar;requests* [in]
| The serialized BIP 70 payment requests to attach to this transaction
|===


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