Inputs point to earlier outputs
A transaction has a version, inputs, outputs and nLockTime. Each input names a previous txid and output index; nodes obtain the referenced amount and script from their UTXO view. The input total minus the output total is the fee.
Serialization is exact
Fields become an exact byte sequence, so even a small change produces a different hash. txid hashes the legacy serialization; BIP 141 defines wtxid from the serialization that includes witness data. They match for a transaction without witness.
SegWit separates signatures from txid
Before SegWit, changing some signature encodings could alter txid without changing the economic payment. SegWit inputs exclude witness from txid while still committing to it through wtxid and the block's witness commitment.
Sighash sets the signature's scope
SIGHASH_ALL normally commits to the transaction's inputs and outputs under the applicable rules. Other flags, including ANYONECANPAY, deliberately permit selected changes. A signer must therefore verify outputs, change, amounts and fee—not merely trust an app's summary.