How to get the block hash by slot number

I would like to validate a block using cncli command:

$ cncli validate --hash 0c4b73

But I dont know the block hash, only the slot number where the block is supposed to created - so how can I get the block hash from that info?

Thanks!

Just look it up, e.g., on https://adastat.net/blocks, https://cardanoscan.io/blocks, or with an API like https://api.koios.rest/#get-/blocks or https://blockfrost.dev/api/specific-block?

thanks - any chance using the same tool - i.e. cncli?

No command that I see in https://github.com/cardano-community/cncli/blob/develop/USAGE.md. But maybe you can find something in the SQLite database cncli.db and extract it yourself.

Thanks - but then what is the process of validating block creation? How do you do that?

??? You just use one of the ways to get the hash for a the block you are interested in and can then use cncli again to get what it is grabbing from its database.

On the other hand, the information on the explorers and APIs already contains most of what cncli gives you.

I guess every SPO do some kind of automatic validation - so there should be a common way to do that.

Why do you think so? It is the task of the node software to validate blocks. SPOs just manage to run the software on some servers.

1 Like

A lot of SPOs seem to monitor their assigned, produced, and adopted blocks by:
https://cardano-community.github.io/guild-operators/Scripts/gliveview/

Or just by looking at the logs of their nodes or their pool statistics on some blockchain explorers.

Given that “Why don’t I get blocks?” questions often come with a considerable delay, there also seem to be quite a lot who do not monitor that closely at all.

It is not strictly necessary, but if you are not sure if you set everything up correctly, you should probably look closer for a few assigned blocks.

Well, I have never seen IOGs software to produce invalid blocks; at least on mainnet with their tested and released software.

However, the node software validates incoming blocks and rejects them if not valid; furthermore, it also disconnects from the peer delivering the bad block and blacklists it for some time. In other words: peers producing bad blocks are eliminated from the network.

That might be a misunderstanding:
“This command validates that a block hash or partial block hash is on-chain.” https://github.com/cardano-community/cncli/blob/develop/USAGE.md#validate-command

The result is “ok”, “orphaned”, or “error” with some additional info.

As far as I understand it, it’s not at all about validating the block in the sense of recomputing its hash and stuff, but about validating if the scheduled block for their pool has been minted successfully.