user127251: I've created a function for parsing Json Objects and values and just when I think nothing can stop me, just when I feel like I'm the king of the blockchain and I can finally join in on the mining race ..... I get a painful reminder/reality check...
The transactions within the getblocktemplate each have these as keys and thier values.

Question
Which Key value from the list of contents within each transaction array is my merkleroot function supposed to use to build a merklerot Hash.... Is it data or hash ? Or is it the txid?
Merkleroot needs transaction hash....so is it hash Json Key or is it the data Json Key ?

Thanks in advance

user208: The transaction Merkle tree, whose root is stored in the block header, is computed over the individual transactions' txid value (which are the double-SHA256 of their data after stripping the witness).
The witness Merkle tree, whose root is stored in a coinbase output (only required for blocks containing segwit transactions, see BIP141), is computed over the transactions' hash value (which are the double-SHA256 of their data including the witness).
I recommend you study the source code of existing mining software, instead of asking questions about every tiny detail of the process.

127251: <p>I've created a function for parsing Json Objects and values and just when I think nothing can stop me, just when I feel like I'm the king of the blockchain and I can finally join in on the mining race ..... I get a painful reminder/reality check...</p>
<p>The transactions within the getblocktemplate each have <a href="https://developer.bitcoin.org/reference/rpc/getblocktemplate.html#:%7E:text=%22transactions%22%20%3A%20%5B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20(json%20array,including%20witness%20data)" rel="nofollow noreferrer">these</a> as keys and thier values.</p>
<hr />
<h2>Question</h2>
<p>Which Key value <a href="https://developer.bitcoin.org/reference/rpc/getblocktemplate.html#:%7E:text=%22transactions%22%20%3A%20%5B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20(json%20array,including%20witness%20data)" rel="nofollow noreferrer">from the list of contents within each transaction array</a> is my merkleroot function supposed to use to build a merklerot Hash.... Is it <strong><code>data</code></strong> or <strong><code>hash</code></strong> ? Or is it the <strong><code>txid</code></strong>?</p>
<p>Merkleroot needs transaction hash....so is it <a href="https://developer.bitcoin.org/reference/rpc/getblocktemplate.html#:%7E:text=%22hash%22%20%3A%20%22hex%22%2C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20(string)%20hash%20encoded%20in%20little%2Dendian%20hexadecimal%20(including%20witness%20data)" rel="nofollow noreferrer">hash</a> Json Key or is it the <a href="https://developer.bitcoin.org/reference/rpc/getblocktemplate.html#:%7E:text=%22data%22%20%3A%20%22hex%22%2C%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20(string)%20transaction%20data%20encoded%20in%20hexadecimal%20(byte%2Dfor%2Dbyte)" rel="nofollow noreferrer">data</a> Json Key ?</p>
<hr />
<p>Thanks in advance</p>
 208: <p>The transaction Merkle tree, whose root is stored in the block header, is computed over the individual transactions' <em>txid</em> value (which are the double-SHA256 of their data after stripping the witness).</p>
<p>The witness Merkle tree, whose root is stored in a coinbase output (only required for blocks containing segwit transactions, see BIP141), is computed over the transactions' <em>hash</em> value (which are the double-SHA256 of their data including the witness).</p>
<p>I recommend you study the source code of existing mining software, instead of asking questions about every tiny detail of the process.</p>
