Distinguish txid from wtxid when decoding Bitcoin bytes

A tracing system can accidentally store the witness transaction hash where an API expects a transaction ID. Both values look like 64 hexadecimal characters.

Decode a witness transaction locally

Provide a complete serialized transaction as RAW. The decoder returns both identifiers without needing the transaction to be mined or present in this node's mempool.

bitcoin-cli decoderawtransaction "$RAW" | jq '{txid, wtxid: .hash, size, vsize, weight}'

Give identifiers separate database fields

The hash field includes witness data for a witness transaction. The txid identifies the transaction when referencing its outputs. For a transaction without witness data the two match, which can hide a mapping bug in legacy-only fixtures. Include a fixture with a nonempty witness when testing the integration.

bitcoincore.org decoderawtransaction