2
Using bitcoin-cli decoderawtransaction I see results like...
{
"txid": "d2183b3ea763f41a30ec5ba6fbf6e5f32e0ca6a5e8761249c533fe22190f71f1",
"hash": "d2183b3ea763f41a30ec5ba6fbf6e5f32e0ca6a5e8761249c533fe22190f71f1",
"version": 2,
"size": 225,
"vsize": 225,
etc...
Why is the "hash" field necessary if the txid field is already a hash? (more specifically a double-pass through SHA-256 of the transaction's data)
I'm noticing in some transactions that txid and hash are equal, but in others they're not. Appreciate any explanation on the difference since I'm struggling to figure it out through Google and the source code comments.
thank you - that makes sense regarding the hash field. But if txid is not included in the transaction, is it also not included in the vin/vout fields within a transaction? – d3wannabe – 2019-07-19T01:53:13.480
2No, the txids for the outputs being spent are included. Just the txid of the transaction itself is not since you can calculate the txid from it. – Andrew Chow – 2019-07-19T01:55:31.460