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?
Asked
Active
Viewed 169 times
1 Answers
3
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.
Andrew Chow
- 67,209
- 5
- 76
- 149
-
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 Apr 24 '21 at 15:22
-
1Yes, the order can only truly be determined by building the linked list. – Andrew Chow Apr 24 '21 at 21:40