[#CTransaction]
= CTransaction
:mrdocs:

The basic transaction that is broadcasted on the network and contained in blocks&period; A transaction can contain multiple inputs and outputs&period;

== Synopsis

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

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

== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:CTransaction/2constructor-04e.adoc[`CTransaction`]         [.small]#[constructor]#
| Constructors
| xref:CTransaction/ComputeTotalSize.adoc[`ComputeTotalSize`] 
| Calculate the total transaction size in bytes, including witness data&period; &quot;Total Size&quot; defined in BIP141 and BIP144&period;
| xref:CTransaction/GetHash.adoc[`GetHash`] 
| Returns the cached transaction id&period;
| xref:CTransaction/GetValueOut.adoc[`GetValueOut`] 
| Returns the total value of all outputs&period;
| xref:CTransaction/GetWitnessHash.adoc[`GetWitnessHash`] 
| Returns the cached witness transaction id&period;
| xref:CTransaction/HasWitness.adoc[`HasWitness`] 
| Returns true when any input carries witness data&period;
| xref:CTransaction/IsCoinBase.adoc[`IsCoinBase`] 
| Returns true when the transaction is a coinbase&period;
| xref:CTransaction/IsNull.adoc[`IsNull`] 
| Returns true when the transaction has no inputs and no outputs&period;
| xref:CTransaction/Serialize.adoc[`Serialize`] 
| Serializes the transaction using the stream&apos;s transaction parameters&period;
| xref:CTransaction/ToString.adoc[`ToString`] 
| Returns a human&hyphen;readable description of the transaction&period;
|===


== Data Members

[cols="1,4"]
|===
| Name| Description
| xref:CTransaction/nLockTime.adoc[`nLockTime`] 
| Lock time before which the transaction is not valid&period;
| xref:CTransaction/version.adoc[`version`] 
| Transaction version number&period;
| xref:CTransaction/vin.adoc[`vin`] 
| Inputs spent by this transaction&period;
| xref:CTransaction/vout.adoc[`vout`] 
| Outputs created by this transaction&period;
|===


== Static Data Members

[cols="1,4"]
|===
| Name| Description
| xref:CTransaction/CURRENT_VERSION.adoc[`CURRENT&lowbar;VERSION`] 
| Default transaction version used for newly created transactions&period;
|===


== Friends

[cols="1,4"]
|===
| Name| Description
| `xref:operator_eq-05b.adoc[operator&equals;&equals;]`
| Compares two transactions for equality by witness hash&period;
|===

== Non-Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:CalculateSequenceLocks.adoc[`CalculateSequenceLocks`]
| Calculates the block height and previous block&apos;s median time past at which the transaction will be considered final in the context of BIP 68&period; For each input that is not sequence locked, the corresponding entries in prevHeights are set to 0 as they do not affect the calculation&period;
| xref:CheckTransaction.adoc[`CheckTransaction`]
| Performs context&hyphen;independent validity checks on a transaction&period;
| xref:EncodeHexTx.adoc[`EncodeHexTx`]
| Serialize a transaction and encode it as a hex string&period;
| xref:GetDust.adoc[`GetDust`]
| Get the vout index numbers of all dust outputs
| xref:GetEntriesForConflicts.adoc[`GetEntriesForConflicts`]
| Get all descendants of iters&lowbar;conflicting&period; Checks that there are no more than MAX&lowbar;REPLACEMENT&lowbar;CANDIDATES distinct clusters affected&period;
| xref:GetLegacySigOpCount.adoc[`GetLegacySigOpCount`]
| Count ECDSA signature operations the old&hyphen;fashioned (pre&hyphen;0&period;6) way
| xref:GetP2SHSigOpCount.adoc[`GetP2SHSigOpCount`]
| Count ECDSA signature operations in pay&hyphen;to&hyphen;script&hyphen;hash inputs&period;
| xref:GetTransactionSigOpCost.adoc[`GetTransactionSigOpCost`]
| Compute total signature operation cost of a transaction&period;
| xref:GetVirtualTransactionSize-01.adoc[`GetVirtualTransactionSize`]
| Compute the virtual size of a transaction, accounting for sigop cost&period;
| xref:IsFinalTx.adoc[`IsFinalTx`]
| Check if transaction is final and can be included in a block with the specified height and time&period; Consensus critical&period;
| xref:IsRBFOptIn.adoc[`IsRBFOptIn`]
| Determine whether an unconfirmed transaction is signaling opt&hyphen;in to RBF according to BIP 125 This involves checking sequence numbers of the transaction, as well as the sequence numbers of all in&hyphen;mempool ancestors&period;
| xref:IsRBFOptInEmptyMempool.adoc[`IsRBFOptInEmptyMempool`]
| Determine the RBF signaling state of a transaction assuming an empty mempool&period;
| xref:IsStandardTx.adoc[`IsStandardTx`]
| Check for standard transaction types
| xref:IsWitnessStandard.adoc[`IsWitnessStandard`]
| Check if the transaction is over standard P2WSH resources limit&colon; 3600bytes witnessScript size, 80bytes per witness stack element, 100 witness stack elements These limits are adequate for multisignatures up to n&hyphen;of&hyphen;100 using OP&lowbar;CHECKSIG, OP&lowbar;ADD, and OP&lowbar;EQUAL&period;
| xref:PreCheckEphemeralTx.adoc[`PreCheckEphemeralTx`]
| Called for each transaction once transaction fees are known&period; Does context&hyphen;less checks about a single transaction&period;
| xref:SequenceLocks.adoc[`SequenceLocks`]
| Check if transaction is final per BIP 68 sequence numbers and can be included in a block&period; Consensus critical&period; Takes as input a list of heights at which tx&apos;s inputs (in order) confirmed&period;
| xref:SignalsOptInRBF.adoc[`SignalsOptInRBF`]
| Check whether the sequence numbers on this transaction are signaling opt&hyphen;in to replace&hyphen;by&hyphen;fee, according to BIP 125&period; Allow opt&hyphen;out of transaction replacement by setting nSequence &gt; MAX&lowbar;BIP125&lowbar;RBF&lowbar;SEQUENCE (SEQUENCE&lowbar;FINAL&hyphen;2) on all inputs&period;
| xref:SpendsNonAnchorWitnessProg.adoc[`SpendsNonAnchorWitnessProg`]
| Check whether this transaction spends any witness program but P2A, including not&hyphen;yet&hyphen;defined ones&period; May return `false` early for consensus&hyphen;invalid transactions&period;
| xref:TxToUniv.adoc[`TxToUniv`]
| Fill a JSON object with a human&hyphen;readable description of a transaction&period;
| xref:ValidateInputsStandardness.adoc[`ValidateInputsStandardness`]
| Check for standard transaction types
| xref:Consensus/CheckTxInputs.adoc[`Consensus&colon;&colon;CheckTxInputs`]
| Check whether all inputs of this transaction are valid (no double spends and amounts) This does not modify the UTXO set&period; This does not check scripts and sigs&period;
| xref:wallet/CalculateMaximumSignedTxSize-00.adoc[`wallet&colon;&colon;CalculateMaximumSignedTxSize`]
| Calculate the size of the transaction using CoinControl to determine whether to expect signature grinding when calculating the size of the input spend&period;
| xref:wallet/CalculateMaximumSignedTxSize-0d.adoc[`wallet&colon;&colon;CalculateMaximumSignedTxSize`]
| Calculate the size of the transaction, looking up previous outputs from the wallet&period;
|===


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