Bitcoin VerityOpen comparator

Level 9 · Advanced technical layer

Transaction structure, txid, wtxid and sighash

What a signature commits to, how inputs reference UTXOs and why SegWit has two identifiers.

Article
85
Reading time
15 minutes
Reviewed
10 September 2026

In a nutshell

A transaction consumes specific previous outputs and creates new ones. txid identifies its base serialization, wtxid includes SegWit witness data, and the sighash rules define exactly what a signature commits to.

01

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.

02

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.

03

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.

04

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.

Level 9 · Advanced technical layer

Terms to know

Outpoint
A txid and index identifying one previous output.
txid / wtxid
Identifiers excluding and including witness data.
Sighash
The digest rules and flag defining a signature's scope.

Common misconception

A Bitcoin signature always covers every byte in the same way.

A more accurate explanation

Its scope depends on the script version and sighash flag; specialised modes intentionally leave selected parts changeable.

A more accurate explanation

Why retain wtxid?

txid gives SegWit spends a stable economic reference, while wtxid identifies their complete witness-bearing representation for relay and block commitments.

85

Key takeaways

  1. 01An input spends one exact previous output.
  2. 02The fee is input value minus output value.
  3. 03A SegWit transaction can have txid and wtxid.
  4. 04Sighash defines what was actually signed.

A child-friendly recap

In very simple terms

A transaction names the old pieces it spends and the new pieces it creates. txid and wtxid are fingerprints, while sighash says which parts the signature protects.

Reviewed: 10 September 2026

Sources and further reading

Sources support particular facts and definitions; listing one does not mean the editors endorse every view of its author.

01
Bitcoin Developer Guide: transaction structureBitcoin Developer Guide
developer.bitcoin.org
02
BIP 141: txid and wtxidBitcoin Improvement Proposals
bips.dev
03
BIP 143: SegWit v0 signature digestBitcoin Improvement Proposals
bips.dev

Educational material, not an investment recommendation.