1

What is src/blocks/checkpoints.dat and why is it not plaintext in the source code?

In the source code src/blocks for Lithium Luna I see checkpoints.dat but it is not plaintext. I was under the impression that all source code should be human readable.

Can someone explain what this file is and what scenarios result in non-plaintext files in source code? Many thanks!

1 Answer 1

3

It is the set of block hashes from the genesis block to a fairly recent block, and is used to speed sync up for historical blocks. It is typically updated shortly before a new release.

Those hashes are stored as is so they can be read without having to parse hex strings, which would be slower and use more memory.

To calculate checkpoints.dat for yourself, sync the blockchain past the latest checkpoint height (For example, height 2606000 for release v0.17.3.2). Then run the following commands to generate a list of block hashes:

monero-blockchain-export --block-stop <aforementioned height> --blocksdat --output-file mycheckpoints.dat

You can compare the generated file against the checkpoints.dat in the source tree:

diff mycheckpoints.dat /path_to_monero_repo/src/blocks/checkpoints.dat

You may have noticed the value expected_block_hashes_hash in the "Release Checklist" document. This is a simple SHA-256 digest of checkpoints.dat. This value should be equal to the value of:

sha256sum src/blocks/checkpoints.dat

This value is used to double-check the integrity of the checkpoints.dat file.

1
  • I see, thanks User36303. Easily readable with a hex editor. I'm surprised gedit doesn't read hex but apparently so.
    – gdoober
    Apr 23, 2018 at 3:14

Your Answer

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

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