1

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
andrewz
  • 257
  • 1
  • 7

1 Answers1

4

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.

Ava Chow
  • 70,382
  • 5
  • 81
  • 161
  • 2
    Specifically, only BIP16, BIP65, and BIP66 have put constraints on the block version number (together they imply that interpreted as a signed 32-bit integer, the block version must be >= 4). BIP9 and related deployments have specified criteria under which nodes may emit warnings, but no strict rules. – Pieter Wuille Jul 26 '22 at 17:22