Home › Glossary › TXID

TXID

Also called: transaction ID, transaction hash, tx hash, txid, tx id, wtxid.

A TXID (transaction ID) is the 32-byte hash that identifies a Bitcoin transaction, shown as 64 hex characters in wallets and block explorers.

A TXID, or transaction ID, is the identifier of a Bitcoin transaction. It is a hash of the transaction's data, written as 64 hexadecimal characters, and it is what you paste into a block explorer to look up a payment.

How it's calculated

The TXID is SHA-256 applied twice to the transaction in its original serialization:

[nVersion][inputs][outputs][nLockTime]

BIP 141 (SegWit) kept this definition and added a second identifier, the wtxid, which hashes the serialization including the witness data. For a transaction without witness data, the two are equal. As BIP 352 notes, TXIDs are displayed in the reverse byte order from how they are stored inside transactions.

Each input points at the coin it spends by TXID plus output index, so TXIDs chain UTXOs together.

Malleability

Before SegWit, signatures were part of the data hashed into the TXID. A third party could change a signature's encoding without invalidating it, giving an unconfirmed transaction a different TXID and breaking any transaction that referenced the old one. This is transaction malleability. BIP 62 catalogued the sources, and BIP 66 made strict DER signature encoding mandatory. SegWit's fix was structural: witness data no longer affects the TXID. That mattered for protocols like the Lightning Network, which sign transactions spending outputs that aren't confirmed yet.

Nodes can relay transactions by wtxid under BIP 339. BIP 30 and BIP 34 deal with duplicate TXIDs, which were possible because identical coinbase transactions hash to the same value.

BIPs that define TXID

  • BIP 141 (SegWit): Segregated Witness (Consensus layer): Deployed. Defines Segregated Witness (SegWit), which moves signatures into a separate "witness" section of each transaction while remaining compatible with older nodes. This fixed transaction malleability,…
  • BIP 339: WTXID-based transaction relay: Deployed. Nodes share new transactions by announcing short identifiers, and this change lets them use the "wtxid", an identifier that also covers a transaction's SegWit signature data. The older identifier…
  • BIP 62: Dealing with malleability: Closed. Proposed a set of rules to stop third parties from altering a transaction's ID without changing what it does, a problem called malleability. It was withdrawn after Segregated Witness (SegWit) solved…
  • BIP 66: Strict DER signatures: Deployed. Required all signatures to follow one strict encoding format, known as DER. Different software interpreted loosely encoded signatures differently, which risked splitting the network and let…
  • BIP 30: Duplicate transactions: Deployed. Added a rule forbidding a block from including a transaction with the same ID as an earlier one whose outputs are not fully spent. Such duplicates can overwrite earlier coins and make them…
  • BIP 34 (block height in coinbase): Block v2, Height in Coinbase: Deployed. Upgraded blocks to version 2 and required each block's coinbase transaction (the one paying the miner) to include the block's height. This makes every coinbase unique, preventing duplicate…

Related terms

  • UTXO: A UTXO (unspent transaction output) is an amount of bitcoin locked to a script and not yet spent. A wallet's balance is the sum of its UTXOs.
  • Transaction malleability: Transaction malleability is the ability to change a transaction's ID without changing what it does, for example by re-encoding its signatures.
  • Witness: The witness is the part of a SegWit transaction that holds signatures and scripts, kept out of the txid so it can't be changed to alter the transaction ID.
  • SegWit (Segregated Witness): SegWit (Segregated Witness) is the 2017 soft fork that moved signatures into a separate witness, fixing malleability and introducing block weight.

Learn more

Guides