THAMER
Sovereign Bitcoin Wallet

WALLET AI BITCOIN

Your Bitcoin Wallet. Your Keys. Your Engine.

Self-hosted Bitcoin software built for developers, applications, and AI agents.

CREATE WALLET

Does a Bitcoin TXID Include SegWit Witness Data?

permalink THAMER
#bitcoin-txid-witness-data#segwit#wtxid

No. For SegWit transactions, the TXID is computed from the serialization without witness data. The WTXID is computed from the witness-inclusive serialization.

Why are there two hashes?

Separating witness data lets Bitcoin preserve TXID-based references to transaction outputs while also committing to the witness bytes through the WTXID and the block's witness commitment.

What if a transaction has no witness?

Its WTXID is equal to its TXID. For the witness Merkle tree, the coinbase transaction is a special case: its WTXID leaf is defined as all zero bytes.

Which identifier is used for a UTXO?

A UTXO outpoint uses the TXID and output index. Do not use WTXID in place of TXID when referencing an input's previous output.

Primary references

Bitcoin Developer Reference — Transactions: https://developer.bitcoin.org/reference/transactions.html
BIP141 — Segregated Witness: https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki
BIP144 — Segregated Witness Peer Services: https://github.com/bitcoin/bips/blob/master/bip-0144.mediawiki

Questions & Answers

Explore all questions →

Latest from the Lab

THAMER illustrated developer portrait and signature

ABOUT THE DEVELOPER

Independent Software Developer specializing in Bitcoin Script, Golang, and AI Agents.

Software engineering · Independent research · Open-source projects