Post
Topic
Board Development & Technical Discussion
Re: Hashing coinbase transaction to get txid
by
DannyHamilton
on 22/09/2017, 19:20:24 UTC
- snip -
the txid is calculated from the non-witness serialization of a transaction, so you should strip out the witness parts of this and hash the remaining. That will get you the txid.
- snip -

This is the key information to take away from this thread.  Achow101 correct me if I'm mistaken, but I believe that is true regardless of whether it is a legacy transaction or a SegWit transaction.  This thread has taught me how to identify a SegWit transaction and how to identify the witness portion of the SegWit transaction. But regarding the topic of the thread (calculating the txid), the key is to remove the witness information before hashing.