BIP141 says wtxid is SHA256 of [nVersion][marker][flag][txins][txouts][witness][nLockTime]. Is data that hashed as txid includes witness?
And will txid be presented in block, e.g. be counted when building Merkle tree?
Bitcoin Stack Exchange is a question and answer site for Bitcoin users, developers, and enthusiasts. It only takes a minute to sign up.
Sign up to join this communityBIP141 says wtxid is SHA256 of [nVersion][marker][flag][txins][txouts][witness][nLockTime]. Is data that hashed as txid includes witness?
And will txid be presented in block, e.g. be counted when building Merkle tree?
Is data that hashed as txid includes witness?
No, the txid is the hash of just [nVersion][txins][txouts][nLockTime]
which is the same as a serialized non-witness transaction. That means the signature is not included in the transaction hash, removing the potential for TXID malleability due to mauling the signature. Only WTXID contains the witness, marker and flag as you wrote in your post.
And will txid be presented in block, e.g. be counted when building Merkle tree?
Yes, the transaction ID is used in the same way that non-segwit TXIDs are used when building the merkle tree.