<p>The bytes you would put in the block header would be, in order: 0x00 0x00 0x00 0x20. That's how the number <em>2<sup>21</sup></em> (= 0x20000000) is stored in 32-bit little endian encoding.</p>
<p>Note that this is actually a large number; that range is used for <a href="https://github.com/bitcoin/bips/blob/master/bip-0009.mediawiki" rel="nofollow noreferrer">BIP9</a>-compatible versions. Older blocks that use versions 1 through 4 predate BIP9.</p>

CC BY-SA 4.0
2020-08-03T00:27:02.513Z
2020-08-03T00:27:02.513Z
Pieter Wuille
<p>When i run <code>getblocktemplate</code>, Bitcoind gives me in the <code>version</code> field a decimal number, when i convert it to <code>Hex</code> it's <code>20000000</code></p>
<p>I know it must be in little endian, but to build the <code>blockheader</code> must i put it like this <code>00000020</code> or <code>02000000</code>  ?</p>
<p>I am asking this question because in version 1 the blockheaders are using <code>01000000</code> and not <code>00000010</code> so i am confused</p>
<p>Help is appreciated</p>
<p>Thanks to all of you</p>

<bitcoin-core><getblocktemplate><bip9-version-bits>
Block version 0x20000000
Hamita
# Block version 0x20000000

(Asked by: username_0 on 2020-08-02)

When i run `getblocktemplate`, Bitcoind gives me in the `version` field a decimal number, when i convert it to `Hex` it's `20000000`

I know it must be in little endian, but to build the `blockheader` must i put it like this `00000020` or `02000000` ?

I am asking this question because in version 1 the blockheaders are using `01000000` and not `00000010` so i am confused

Help is appreciated

Thanks to all of you

**Tags:** bitcoin-core, getblocktemplate, bip9-version-bits


---

## 1 answers

### Answer by username_1 on 2020-08-03. Score: 2 | Accepted answer

The bytes you would put in the block header would be, in order: 0x00 0x00 0x00 0x20. That's how the number *221* (= 0x20000000) is stored in 32-bit little endian encoding.

Note that this is actually a large number; that range is used for [BIP9](https://github.com/bitcoin/bips/blob/master/bip-0009.mediawiki)-compatible versions. Older blocks that use versions 1 through 4 predate BIP9.


---

