user127251: This resource states that "data": "hex",(string, required) A key-value pair. The key must be "data", the value is hex-encoded data.

Questions

It says that the field is "required" but what exactly should that data be ??
If the data isn't provided does that invalidate the coinbase transaction (even when block height is encoded into scriptSig)?

I asked the question here but an answer wasn't provided. So I decided to make it a stand-alone question.

Goal

To confirm what data should be inserted within this data field


user208: The data field is only for when you want to create data-carrying transactions (ones with an OP_RETURN). This is generally not needed in normal transactions (and its usage there is somewhat controversial even). For coinbase transactions, you do need an OP_RETURN output with the witness commitment as specified in BIP141, if you want to include segwit transactions in your block.
However, you shouldn't use createrawtransaction and related RPCs for constructing coinbase transactions, as they will miss the necessary scriptSig contents. Even if you could, it would most likely be so slow as to be useless (a modern miner like an AntMiner S17 needs 13000 coinbases per second). Thus, the miner firmware constructs them using hardcoded logic.
The field is marked as required in the RPC documentation for such outputs. If you don't want a data-carrying output, the object simply wouldn't exist.

127251: <p><a href="https://developer.bitcoin.org/reference/rpc/createrawtransaction.html" rel="nofollow noreferrer">This</a> resource states that <a href="https://developer.bitcoin.org/reference/rpc/createrawtransaction.html#:%7E:text=%22data%22%3A%20%22hex%22%2C%20%20%20%20%20%20%20%20(string%2C%20required)%20A%20key%2Dvalue%20pair.%20The%20key%20must%20be%20%22data%22%2C%20the%20value%20is%20hex%2Dencoded%20data" rel="nofollow noreferrer">&quot;data&quot;: &quot;hex&quot;,(string, required) A key-value pair. The key must be &quot;data&quot;, the value is hex-encoded data</a>.</p>
<hr />
<h2>Questions</h2>
<ol>
<li>It says that the field is <strong>&quot;required&quot;</strong> but what exactly should that <strong><code>data</code></strong> be ??</li>
<li>If the <strong><code>data</code></strong> isn't provided does that invalidate the coinbase transaction (even when block height is encoded into scriptSig)?</li>
</ol>
<p>I asked the question <a href="https://bitcoin.stackexchange.com/q/111184/127251">here</a> but an answer wasn't provided. So I decided to make it a stand-alone question.</p>
<hr />
<h2>Goal</h2>
<ol>
<li>To confirm what <strong><code>data</code></strong> should be inserted within <a href="https://developer.bitcoin.org/reference/rpc/createrawtransaction.html#:%7E:text=%22data%22%3A%20%22hex%22%2C%20%20%20%20%20%20%20%20(string%2C%20required)%20A%20key%2Dvalue%20pair.%20The%20key%20must%20be%20%22data%22%2C%20the%20value%20is%20hex%2Dencoded%20data" rel="nofollow noreferrer">this data field</a></li>
</ol>
 208: <p>The data field is only for when you want to create data-carrying transactions (ones with an OP_RETURN). This is generally not needed in normal transactions (and its usage there is somewhat controversial even). For coinbase transactions, you do need an OP_RETURN output with the witness commitment as specified in BIP141, if you want to include segwit transactions in your block.</p>
<p>However, you shouldn't use <code>createrawtransaction</code> and related RPCs for constructing coinbase transactions, as they will miss the necessary scriptSig contents. Even if you could, it would most likely be so slow as to be useless (a modern miner like an AntMiner S17 needs 13000 coinbases per second). Thus, the miner firmware constructs them using hardcoded logic.</p>
<p>The field is marked as required in the RPC documentation <em>for such outputs</em>. If you don't want a data-carrying output, the object simply wouldn't exist.</p>
