The transaction ID (also called transaction hash) of a transaction is computed as
the hash of
CHAIN_ID and the
serialized transaction with fields zeroed out for signing
(see different inputs and outputs for which fields are set to zero), and without witness data. In other words, only
all non-witness data is hashed.
sha256(CHAIN_ID ++ serialized_tx(tx))