A shell script that automatically generates and updates CryptoNoteCheckpoints.h for the DeroGold blockchain node, using the public block explorer API.
Checkpoints are known-good block height/hash pairs embedded directly into the node source code. They allow new nodes to skip re-validating old blocks, speeding up initial sync significantly.
This script:
- Queries the DeroGold public API for the current chain height
- Fetches block headers in bulk (1000 at a time)
- Selects every 5000th block as a checkpoint
- Writes (or incrementally updates)
CryptoNoteCheckpoints.hwith the correct C++ structure
bashcurljq
Before running, set your API base URL at the top of checkpoints.sh:
API_BASE="https://your-api-node-here"Point this at your own DeroGold node or any compatible block explorer API.
./checkpoints.shIf CryptoNoteCheckpoints.h does not exist, the script generates it from scratch — fetching all blocks from genesis to the current tip and writing the full C++ header file.
If CryptoNoteCheckpoints.h already exists, the script reads the last checkpoint height, resumes from there, and appends only the new checkpoints. It will exit early if the file is already up to date.
Already up to date. Last checkpoint: 1500000, network tip: 1502341
The script produces CryptoNoteCheckpoints.h, a C++ header ready to drop into the DeroGold node source tree:
namespace CryptoNote
{
struct CheckpointData
{
uint32_t index;
const char *blockId;
};
const CheckpointData CHECKPOINTS[] = {
{0, "..."},
{5000, "..."},
// ...
};
} // namespace CryptoNoteThe script expects a node/explorer API with these endpoints:
GET {API_BASE}/height— returns{"height": N}GET {API_BASE}/block/headers/{height}/bulk— returns an array of block headers up to the given height
LGPL-3.0, following the upstream CryptoNote / Bytecoin codebase.