CTxIn

An input of a transaction. It contains the location of the previous transaction's output that it claims and a signature that matches the output's public key.

Synopsis

Declared in <primitives/transaction.h>

class CTxIn;

Member Functions

NameDescription
CTxIn [constructor]Constructors
ToString Returns a human-readable description of the input.

Data Members

NameDescription
nSequence Sequence number, used for relative lock-times and replaceability.
prevout The previous output being spent by this input.
scriptSig Script that satisfies the spending conditions of the previous output.
scriptWitness Only serialized through CTransaction

Static Data Members

NameDescription
MAX_SEQUENCE_NONFINAL This is the maximum sequence number that enables both nLockTime and OP_CHECKLOCKTIMEVERIFY (BIP 65). It has SEQUENCE_LOCKTIME_DISABLE_FLAG set (BIP 68/112).
SEQUENCE_FINAL Setting nSequence to this value for every input in a transaction disables nLockTime/IsFinalTx(). It fails OP_CHECKLOCKTIMEVERIFY/CheckLockTime() for any input that has it set (BIP 65). It has SEQUENCE_LOCKTIME_DISABLE_FLAG set (BIP 68/112).
SEQUENCE_LOCKTIME_DISABLE_FLAG If this flag is set, CTxIn::nSequence is NOT interpreted as a relative lock-time. It skips SequenceLocks() for any input that has it set (BIP 68). It fails OP_CHECKSEQUENCEVERIFY/CheckSequence() for any input that has it set (BIP 112).
SEQUENCE_LOCKTIME_GRANULARITY In order to use the same number of bits to encode roughly the same wall-clock duration, and because blocks are naturally limited to occur every 600s on average, the minimum granularity for time-based relative lock-time is fixed at 512 seconds. Converting from CTxIn::nSequence to seconds is performed by multiplying by 512 = 2^9, or equivalently shifting up by 9 bits.
SEQUENCE_LOCKTIME_MASK If CTxIn::nSequence encodes a relative lock-time, this mask is applied to extract that lock-time from the sequence field.
SEQUENCE_LOCKTIME_TYPE_FLAG If CTxIn::nSequence encodes a relative lock-time and this flag is set, the relative lock-time has units of 512 seconds, otherwise it specifies blocks with a granularity of 1.

Friends

NameDescription
operator==Compares two inputs for equality.

Non-Member Functions

NameDescription
GetVirtualTransactionInputSizeCompute the virtual size of a single transaction input.
UpdateInputWrite the scriptSig and witness from signature data back into an input.