1

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?

1 Answer 1

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.

2
  • 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? Commented Apr 24, 2021 at 15:22
  • 1
    Yes, the order can only truly be determined by building the linked list.
    – Ava Chow
    Commented Apr 24, 2021 at 21:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.