ICP vs ckBTC ledgers

Can someone explain the current situation with the ICP and ckBTC ledgers? Do they have different candid interfaces? I know they both support ICRC-1, but it seems like the rest of the functionality could be different, such as ICP having query_blocks and ckBTC having get_transactions.

I think these are the current latest ledger dids:

ICP: ic/ledger.did at master · dfinity/ic · GitHub
ckBTC: ic/ledger.did at master · dfinity/ic · GitHub

My understanding is that the ICRC-1 standard has been developed for ICP at the top of the existing ICP ledger. That’s why the ICP ledger exposes both existing features (e.g. query_blocks) and ICRC-1 features (e.g. icrc1_xxxxx).

The ckBTC ledger, as the Snses ledger, uses another canister code that have been developed from scratch (I think) and which implements “only” the ICRC-1 features (e.g. icrc1_xxxxx).

Does this answer your question? If not, can forward it further to the team.

1 Like

That said, just noticed that get_transactions and get_blocks have been added to ICRC-1 candid files. So will forward your question.

1 Like

Hi @lastmjs,
Yes I can explain. What you are seeing is the result of two actions: consolidation of the did files into one per canister and the lack of ICRC-3, which is a standard way to access the transaction log.

The consolidation of did files happened with 3a207e. Before that we had several files per ledger. Specifically we had one file for the standard endpoints and one for the non-standard ones. The reason why we had to move away from having multiple files is that we can attach only one file to a canister and this file should have all the public endpoints. That’s why we had to consolidate them and that’s why you are seeing a single file with a mixture of standard and non-standard endpoint. This shouldn’t be a problem because the standard endpoints are prefixed with icrc*_.

About the standards themselves, both ledgers support ICRC-1 and will support ICRC-2 but only ckBTC ledger can support ICRC-3. ICRC-3 is still under development and because of this it cannot be supported yet. Still, the ckBTC ledger needs a way to access the the transaction log right now and cannot wait for ICRC-3. Therefore:

  1. The ICP ledger has a custom endpoint called query_blocks which returns its blocks. This endpoint is unique to the ICP ledger and it exists only because of account identifiers which are not compatible with ICRC-1
  2. The ckBTC ledger needs a way to fetch blocks and transactions while we are waiting for ICRC-3. Therefore two endpoints called get_blocks and get_transactions have been added. These two endpoints are shaped around the proposal for ICRC-3 (but may very well end up being incompatible with it).

I hope this clarifies the changes to the repository. Happy to clarify more if needed.

1 Like