8

I have synced a Substrate-based parachain (Moonbase Alpha) and stopped the node to take a snapshot of the database directory. I would like to know what's the best block (block height, last finalized block) of this snapshot, but without running a node again with that data, only with the database itself.

Is there a way to read information directly from the database, without a separate process? Or at least more minimal process so not to require a complete node operating on the DB to discover the block height?

Thanks in advance

1

1 Answer 1

8

Is there a way to read information directly from the database, without a separate process?

It is always possible to reverse engineer the client db storage to read directly https://github.com/paritytech/substrate/blob/9461b2de04210c6c193726a745c3ec6552b4ce9f/client/db/src/utils.rs#L509 but then you need to decode the header manually, and it is not future proof. (and utils to read either db content will spawn a process).

Minimal process could be interesting though, I think adding a cli command to display chain info would be the easiest direction (calling fn info from HeaderBackend with a new command in crate sc-cli).

1

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.