[#CTxIn]
= CTxIn
:mrdocs:

An input of a transaction&period; It contains the location of the previous transaction&apos;s output that it claims and a signature that matches the output&apos;s public key&period;

== Synopsis

Declared in `&lt;primitives&sol;transaction&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
class CTxIn;
----

== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:CTxIn/2constructor-0e.adoc[`CTxIn`]         [.small]#[constructor]#
| Constructors
| xref:CTxIn/ToString.adoc[`ToString`] 
| Returns a human&hyphen;readable description of the input&period;
|===


== Data Members

[cols="1,4"]
|===
| Name| Description
| xref:CTxIn/nSequence.adoc[`nSequence`] 
| Sequence number, used for relative lock&hyphen;times and replaceability&period;
| xref:CTxIn/prevout.adoc[`prevout`] 
| The previous output being spent by this input&period;
| xref:CTxIn/scriptSig.adoc[`scriptSig`] 
| Script that satisfies the spending conditions of the previous output&period;
| xref:CTxIn/scriptWitness.adoc[`scriptWitness`] 
| Only serialized through CTransaction
|===


== Static Data Members

[cols="1,4"]
|===
| Name| Description
| xref:CTxIn/MAX_SEQUENCE_NONFINAL.adoc[`MAX&lowbar;SEQUENCE&lowbar;NONFINAL`] 
| This is the maximum sequence number that enables both nLockTime and OP&lowbar;CHECKLOCKTIMEVERIFY (BIP 65)&period; It has SEQUENCE&lowbar;LOCKTIME&lowbar;DISABLE&lowbar;FLAG set (BIP 68&sol;112)&period;
| xref:CTxIn/SEQUENCE_FINAL.adoc[`SEQUENCE&lowbar;FINAL`] 
| Setting nSequence to this value for every input in a transaction disables nLockTime&sol;IsFinalTx()&period; It fails OP&lowbar;CHECKLOCKTIMEVERIFY&sol;CheckLockTime() for any input that has it set (BIP 65)&period; It has SEQUENCE&lowbar;LOCKTIME&lowbar;DISABLE&lowbar;FLAG set (BIP 68&sol;112)&period;
| xref:CTxIn/SEQUENCE_LOCKTIME_DISABLE_FLAG.adoc[`SEQUENCE&lowbar;LOCKTIME&lowbar;DISABLE&lowbar;FLAG`] 
| If this flag is set, CTxIn&colon;&colon;nSequence is NOT interpreted as a relative lock&hyphen;time&period; It skips SequenceLocks() for any input that has it set (BIP 68)&period; It fails OP&lowbar;CHECKSEQUENCEVERIFY&sol;CheckSequence() for any input that has it set (BIP 112)&period;
| xref:CTxIn/SEQUENCE_LOCKTIME_GRANULARITY.adoc[`SEQUENCE&lowbar;LOCKTIME&lowbar;GRANULARITY`] 
| In order to use the same number of bits to encode roughly the same wall&hyphen;clock duration, and because blocks are naturally limited to occur every 600s on average, the minimum granularity for time&hyphen;based relative lock&hyphen;time is fixed at 512 seconds&period; Converting from CTxIn&colon;&colon;nSequence to seconds is performed by multiplying by 512 &equals; 2&circ;9, or equivalently shifting up by 9 bits&period;
| xref:CTxIn/SEQUENCE_LOCKTIME_MASK.adoc[`SEQUENCE&lowbar;LOCKTIME&lowbar;MASK`] 
| If CTxIn&colon;&colon;nSequence encodes a relative lock&hyphen;time, this mask is applied to extract that lock&hyphen;time from the sequence field&period;
| xref:CTxIn/SEQUENCE_LOCKTIME_TYPE_FLAG.adoc[`SEQUENCE&lowbar;LOCKTIME&lowbar;TYPE&lowbar;FLAG`] 
| If CTxIn&colon;&colon;nSequence encodes a relative lock&hyphen;time and this flag is set, the relative lock&hyphen;time has units of 512 seconds, otherwise it specifies blocks with a granularity of 1&period;
|===


== Friends

[cols="1,4"]
|===
| Name| Description
| `xref:operator_eq-07a.adoc[operator&equals;&equals;]`
| Compares two inputs for equality&period;
|===

== Non-Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:GetVirtualTransactionInputSize.adoc[`GetVirtualTransactionInputSize`]
| Compute the virtual size of a single transaction input&period;
| xref:UpdateInput.adoc[`UpdateInput`]
| Write the scriptSig and witness from signature data back into an input&period;
|===


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