<p>No, they are in the order by which your node received the blocks. This can be in any particular order as nodes receive blocks out of order during the initial sync. Furthermore, some nodes will receive and store blocks that become stale, while other nodes (particularly ones that come online after that block has been found) will not. So the blk*.dat files between two nodes are likely to differ.</p>

CC BY-SA 4.0
2021-04-24T15:22:31.683Z
So if I want to order them, only way to do it is to match them up by previous_hash from the blockheader then, right?
Bitcoingraffiti
CC BY-SA 4.0
2021-04-24T21:40:35.660Z
Yes, the order can only truly be determined by building the linked list.
Ava Chow
CC BY-SA 4.0
2021-04-24T14:15:19.997Z
2021-04-24T14:15:19.997Z
Ava Chow
<p>I'm parsing out de blockxxxxx.dat files for the bitcoin blockchain. Are the blocks ordered by height? So is the order of the data for everybody the same?</p>

<bitcoin-core><blockchain><bitcoin-core-development><raw-data><chainanalysis>
Are the blocks in blkxxxxx.dat files ordered by block height?
Bitcoingraffiti
# Are the blocks in blkxxxxx.dat files ordered by block height?

(Asked by: username_0 on 2021-04-24)

I'm parsing out de blockxxxxx.dat files for the bitcoin blockchain. Are the blocks ordered by height? So is the order of the data for everybody the same?

**Tags:** bitcoin-core, blockchain, bitcoin-core-development, raw-data, chainanalysis


---

## 1 answers

### Answer by username_1 on 2021-04-24. Score: 3 | Accepted answer

No, they are in the order by which your node received the blocks. This can be in any particular order as nodes receive blocks out of order during the initial sync. Furthermore, some nodes will receive and store blocks that become stale, while other nodes (particularly ones that come online after that block has been found) will not. So the blk\*.dat files between two nodes are likely to differ.

> **Comments:**
> **username_0**: So if I want to order them, only way to do it is to match them up by previous_hash from the blockheader then, right?  
> **username_1**: Yes, the order can only truly be determined by building the linked list.  

---

