[#SignPSBTInput]
= SignPSBTInput
:mrdocs:

Signs a PSBTInput, verifying that all provided data matches what is being signed&period;

== Synopsis

Declared in `&lt;psbt&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
&lsqb;&lsqb;nodiscard&rsqb;&rsqb;
xref:util/Expected-0b.adoc[util::Expected&lt;void, common::PSBTError&gt;]
SignPSBTInput(
    xref:SigningProvider.adoc[SigningProvider] const& provider,
    xref:PartiallySignedTransaction.adoc[PartiallySignedTransaction]& psbt,
    int index,
    xref:PrecomputedTransactionData.adoc[PrecomputedTransactionData] const* txdata,
    xref:common/PSBTFillOptions.adoc[common::PSBTFillOptions] const& options,
    xref:SignatureData.adoc[SignatureData]* out&lowbar;sigdata = nullptr);
----

== Description

txdata should be the output of PrecomputePSBTData (which can be shared across multiple SignPSBTInput calls)&period; If it is nullptr, a dummy signature will be created&period;

== Return Value

Success, or a PSBTError describing why signing failed&period;

[NOTE]
====
The return value https://en.cppreference.com/cpp/language/attributes/nodiscard[should not be discarded^].
====
== Parameters

[cols="1,4"]
|===
| Name| Description
| *provider*
| The source of keys and scripts used to sign&period;
| *psbt*
| The PSBT containing the input&period;
| *index*
| The index of the input to sign&period;
| *txdata*
| Precomputed transaction data, or nullptr for a dummy signature&period;
| *options*
| Options controlling how fields are filled&period;
| *out&lowbar;sigdata*
| Optional output receiving the resulting signature data&period;
|===


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