user140597: What is the relationship between transaction data and transaction id (which is used at mempool to generate Merkle root)?
Note : when we query the getblock with verbosity 2, we get raw block in json format. at the transactions part, each transaction have 3 suspicious part :

txid (transaction id)
hash
hex (which is raw transaction in hex string format)

I am looking for a relatio between these three parameters.

user208: Since BIP144, transaction data consists of two parts (normal data and witness data). There are also two distinct transaction serialization formats:

The legacy serialization format, which stores version number, transaction inputs, transaction outputs, and locktime.
The extended serialization format, which also has a flag/marker to indicate the extended format is in use, and has witness data for every transaction input.

The extended format must be used if witness data is present. The legacy format must be used if no witness data is present.
The txid is the double-SHA256 hash of the serialized transaction in legacy format, meaning that any witness data has to be stripped out (as the legacy format does not support witness data). If the transaction had no witness data in the first place (as pre-segwit transaction do), the txid is just the hash of the serialized transaction.
The hash (or wtxid) of a transaction is the double-SHA256 hash of the serialization including potential witness data. If the transaction contains no witness data, this identical to the txid.

140597: <p>What is the relationship between <strong>transaction data</strong> and <strong>transaction id</strong> (which is used at mempool to generate Merkle root)?</p>
<p>Note : when we query the <strong>getblock</strong> with <strong>verbosity 2</strong>, we get <strong>raw block</strong> in <strong>json</strong> format. at the transactions part, each transaction have 3 suspicious part :</p>
<ol>
<li><strong>txid</strong> (transaction id)</li>
<li><strong>hash</strong></li>
<li><strong>hex</strong> (which is raw transaction in hex string format)</li>
</ol>
<p>I am looking for a relatio between these three parameters.</p>
 208: <p>Since <a href="https://github.com/bitcoin/bips/blob/master/bip-0144.mediawiki" rel="nofollow noreferrer">BIP144</a>, transaction data consists of two parts (normal data and witness data). There are also two distinct transaction serialization formats:</p>
<ul>
<li>The legacy serialization format, which stores version number, transaction inputs, transaction outputs, and locktime.</li>
<li>The extended serialization format, which also has a flag/marker to indicate the extended format is in use, and has witness data for every transaction input.</li>
</ul>
<p>The extended format must be used if witness data is present. The legacy format must be used if no witness data is present.</p>
<p>The <strong>txid</strong> is the double-SHA256 hash of the serialized transaction <em>in legacy format</em>, meaning that any witness data has to be stripped out (as the legacy format does not support witness data). If the transaction had no witness data in the first place (as pre-segwit transaction do), the txid is just the hash of the serialized transaction.</p>
<p>The <strong>hash</strong> (or wtxid) of a transaction is the double-SHA256 hash of the serialization <em>including potential witness data</em>. If the transaction contains no witness data, this identical to the txid.</p>
