Check continuity inside a CometBFT header export

An exporter can accidentally save a range in reverse order or repeat its boundary block. A short metadata query supplies the identifiers needed to detect either mistake.

Sort the block metadata by numeric height

Point RPC at a CometBFT endpoint and choose a retained ten-block range. Inspect block_metas and sort by header.height as integers before writing a forward sequence.

curl -fsS "$RPC/blockchain?minHeight=12000&maxHeight=12009"

For heights 12000 through 12009 expect ten distinct heights. For each adjacent pair compare the later header’s last_block_id.hash to the earlier entry’s block_id.hash. A missing height or mismatch merits a fresh fetch.

Carry the boundary into the next request

Retain the last height and block ID and compare them with the first successor in the next window. This checks internal linkage of the export. A trustworthy starting anchor and commit verification are needed to authenticate a chain supplied by an unknown endpoint. github.com CometBFT RPC