I'd like to know how checkpoints for the monero network are formed and hardcoded in the checkpoint.cpp. Especially when having a fresh fork with the first genesis block having to be made. How to effectively generate the very first checkpoint?
From the Monero source code:
ADD_CHECKPOINT2(1, "771fbcd656ec1464d3a02ead5e18644030007a0fc664c0a964d30922821a8148", "0x2");
ADD_CHECKPOINT2(10, "c0e3b387e47042f72d8ccdca88071ff96bff1ac7cde09ae113dbb7ad3fe92381", "0x2a974");
ADD_CHECKPOINT2(100, "ac3e11ca545e57c49fca2b4e8c48c03c23be047c43e471e1394528b1f9f80b2d", "0x35d14b");
ADD_CHECKPOINT2(1000, "5acfc45acffd2b2e7345caf42fa02308c5793f15ec33946e969e829f40b03876", "0x36a0373");
ADD_CHECKPOINT2(10000, "c758b7c81f928be3295d45e230646de8b852ec96a821eac3fea4daf3fcac0ca2", "0x60a91390");
What are those values? Height, block hash, checksum? How are those created specifically?
Additionally, it would be useful to know what effect the PER_BLOCK_CHECKPOINT
flag has on checkpoints in general.
Update
I figured out the checkpoint consists out of "height", "transaction id" and "cumulative difficulty" and can be received from the daemon via RPC call:
curl http://127.0.0.1:18081/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"get_block_header_by_height","params":{"height":2851000}}' -H 'Content-Type: application/json'
But, how can I send this RPC call when the daemon wouldn't pass the first block being validated?
Update 2
When the database is finally created, the daemon will retrieve the "block hash" of the first block via:
mdb_block_info* bi = (mdb_block_info*)result.mv_data;
crypto::hash ret = bi->bi_hash;
The daemon will print an EXPECTED HASH
and a GIVEN HASH
, neither of those work in the checkpoints.cpp
, I guess because this is the hash of the transaction ID?