user116555: When looking at block header for block 746632 I see that the version is 1073676292 or 3fff0004 or when reversed 0400ff3f, but the version I received from a getblocktemplate request is 536870912 or 20000000 or when reversed 00000020
My understanding is that the version field can not be different from the one in the block template.
getblockhash 746632
0000000000000000000573b8d27491283652e993c390d7be8a38129ec46672fa

getblockheader 0000000000000000000573b8d27491283652e993c390d7be8a38129ec46672fa
{
  "hash": "0000000000000000000573b8d27491283652e993c390d7be8a38129ec46672fa",
  "confirmations": 14,
  "height": 746632,
  "version": 1073676292,
  "versionHex": "3fff0004",
  "merkleroot": "24619c38bcd737edccbcce809692b66c374a0a81c148aa5e9eca45607fbf3f28",
  "time": 1658845216,
  "mediantime": 1658841797,
  "nonce": 1738315485,
  "bits": "170a2a04",
  "difficulty": 27692567959233.59,
  "chainwork": "0000000000000000000000000000000000000000321828fef78edcbcaa328aba",
  "nTx": 1089,
  "previousblockhash": "00000000000000000002d7a16b995df4b79deae619175f853efc68643a6eabea",
  "nextblockhash": "00000000000000000002a995ef37e16105a966e65face571aff76b2b88025a6b"
}

getblockheader 0000000000000000000573b8d27491283652e993c390d7be8a38129ec46672fa false
0400ff3feaab6e3a6468fc3e855f1719e6ea9db7f45d996ba1d702000000000000000000283fbf7f6045ca9e5eaa48c1810a4a376cb6929680cebccced37d7bc389c612420f8df62042a0a17dd969c67


user48884: There is no requirement that a miner must follow the block template. They can construct their own blocks as they see fit, so long as their block follows the consensus rules. There cannot be a requirement that blocks match block templates as each node can produce a different template depending on the transactions that they are aware of. If every node produced the same block template, then we wouldn't need mining in order to form consensus on the ordering of transactions.
The block version can largely be any value that the miner wants. There are only a few limitations on it, and these are largely that it cannot be specific values, not that it must be a specific value. 3fff0004 is a completely valid value.
Miners may choose to change the version number in order to use an optimization known as ASICBoost. Using the version number as an additional nonce field allows them to have a higher hashrate, so many miners will do this.

116555: <p>When looking at block header for block 746632 I see that the version is <code>1073676292</code> or <code>3fff0004</code> or when reversed <code>0400ff3f</code>, but the version I received from a <code>getblocktemplate</code> request is <code>536870912</code> or <code>20000000</code> or when reversed <code>00000020</code></p>
<p>My understanding is that the version field can not be different from the one in the block template.</p>
<pre><code>getblockhash 746632
0000000000000000000573b8d27491283652e993c390d7be8a38129ec46672fa
</code></pre>
<pre><code>getblockheader 0000000000000000000573b8d27491283652e993c390d7be8a38129ec46672fa
{
  &quot;hash&quot;: &quot;0000000000000000000573b8d27491283652e993c390d7be8a38129ec46672fa&quot;,
  &quot;confirmations&quot;: 14,
  &quot;height&quot;: 746632,
  &quot;version&quot;: 1073676292,
  &quot;versionHex&quot;: &quot;3fff0004&quot;,
  &quot;merkleroot&quot;: &quot;24619c38bcd737edccbcce809692b66c374a0a81c148aa5e9eca45607fbf3f28&quot;,
  &quot;time&quot;: 1658845216,
  &quot;mediantime&quot;: 1658841797,
  &quot;nonce&quot;: 1738315485,
  &quot;bits&quot;: &quot;170a2a04&quot;,
  &quot;difficulty&quot;: 27692567959233.59,
  &quot;chainwork&quot;: &quot;0000000000000000000000000000000000000000321828fef78edcbcaa328aba&quot;,
  &quot;nTx&quot;: 1089,
  &quot;previousblockhash&quot;: &quot;00000000000000000002d7a16b995df4b79deae619175f853efc68643a6eabea&quot;,
  &quot;nextblockhash&quot;: &quot;00000000000000000002a995ef37e16105a966e65face571aff76b2b88025a6b&quot;
}
</code></pre>
<pre><code>getblockheader 0000000000000000000573b8d27491283652e993c390d7be8a38129ec46672fa false
0400ff3feaab6e3a6468fc3e855f1719e6ea9db7f45d996ba1d702000000000000000000283fbf7f6045ca9e5eaa48c1810a4a376cb6929680cebccced37d7bc389c612420f8df62042a0a17dd969c67
</code></pre>
 48884: <p>There is no requirement that a miner must follow the block template. They can construct their own blocks as they see fit, so long as their block follows the consensus rules. There cannot be a requirement that blocks match block templates as each node can produce a different template depending on the transactions that they are aware of. If every node produced the same block template, then we wouldn't need mining in order to form consensus on the ordering of transactions.</p>
<p>The block version can largely be any value that the miner wants. There are only a few limitations on it, and these are largely that it cannot be specific values, not that it must be a specific value. <code>3fff0004</code> is a completely valid value.</p>
<p>Miners may choose to change the version number in order to use an optimization known as ASICBoost. Using the version number as an additional nonce field allows them to have a higher hashrate, so many miners will do this.</p>
