Query_blocks from the ledger canister returning an empty vec

Why is query_blocks on the ledger canister returning an empty array on the blocks field?. What am I missing? Running the ledger locally that function is working as it should, but the live one is returning an empty vec.

The ledger canister Id I am using is this one: ryjl3-tyaaa-aaaaa-aaaba-cai

This one is working though: qhbym-qaaaa-aaaaa-aaafq-cai, do I have to use them together?

The ledger canister (i.e. ryjl3-tyaaa-aaaaa-aaaba-cai) periodically pushes the blocks it stores on archive canisters, and at any point it only stores at most 2000 of the most recent blocks. (Currently there’s two such archives; qhbym-qaaaa-aaaaa-aaafq-cai is the first of them. )

When you run query_blocks against the ledger, it returns the blocks locally available (if any). The list of blocks you get is empty because the blocks you asked for are not in the ledger anymore.
However, the reply to query_blocks also includes the callbacks you need to make to retrieve the missing ones. NB: you don’t need to know a priori which are the archive canisters and what blocks they store: this info is already included in the callbacks.

1 Like

Understood, thank you. Also, from blocks, what should I use to verify the transactions on the dashboard? Like if I put the parent_hash like 7e44cbe7a989a1760d35c72a759041f9f2ec4a3f66bf522bf6761993115221b3. I’m just getting: Transactions can take up to 10 minutes to appear on the ICP Dashboard. Please try again later., even on some very old parent hashes.

Or maybe I shouldn’t be using parent_hash for this? If so, what should I use?

Thanks