Getting the init archive settings of a ledger canister

Hi,

Is there a way to get the archive settings of my icrc ledger canister? I dont have the the deploy script i used anymore so I’m curious if there is another way to get the settings that i used during deployment?

1 Like

Hi @frederico02 ,

Unfortunately, this is currently not possible. We do have an internal ticket to address this - I’ll bring it up in our next team meeting and see how to best proceed.

3 Likes

What happens if not values for the archive options are set on the launch of a ledger. What are the default settings?

What happens if not values for the archive options are set on the launch of a ledger.

The archive options can be changed by specifying the ChangeArchiveOptions field in the UpgradeArgs in a ledger upgrade.

What are the default settings?

I expanded a bit on the archive options in the documentation. In particular, I linked to the default settings, and also some more useful recommended settings that are used, e.g., for SNS ledgers. The ck-token ledger and SNS ledgers should all have some reasonable values set. For independently-deployed ICRC ledgers based on the DFINITY Rust implementation, what you could do to check the archiving is the following:

  • Query the archives() endpoint of the ledger (this is for the ckBTC ledger - replace the canister ID with that of your ledger)
    • If one or more archives exists, then archiving is configured correctly (if there are loads of archives, then perhaps node_max_memory_size_bytes is too small, but I haven’t seen cases of that in the wild).
    • If no archives exists, check the number of blocks in the ledger by querying the get_blocks endpoint, with start = 0 and length = 1. If there are lots of blocks in the ledger (chain_length is e.g., more than 2_000), then there may be an issue with the archive options.

The lowest-risk way to set the archiving options would be to upgrade the ledger to same WASM it is currently running, and only setting the ChangeArchiveOptions in the UpgradeArgs. For more info on how to upgrade your ledger, and if you don’t know what WASM your ledger is currently running, refer to the instructions in the ICRC Ledger Suite Upgrade forum post.

1 Like

Thanks for the detailed response @mathiasb. We are going to set the archive options for our ledger with the next upgrade. We currently have around 70k transactions in our ledger. Do you see any risk regarding memory if we set the archive options to the same level as the default SNS ledgers (see below) and all excess transactions are archived at once?

trigger_threshold: 2000,
num_blocks_to_archive: 1000,
// 1 GB, which gives us 3 GB space when upgrading
node_max_memory_size_bytes: Some(1024 * 1024 * 1024),
// 128kb
max_message_size_bytes: Some(128 * 1024),
controller_id: // to be set
more_controller_ids: None,
// TODO: allow users to set this value
// 10 Trillion cycles
cycles_for_archive_creation: Some(10_000_000_000_000),
max_transactions_per_response: None,

Hi @Dustin, the archive options you propose look good, although I would actually suggest setting max_message_size_bytes to Some(1024 * 1024) (1 MB), which is the default (you could also set it to None, in which case the default would anyway be used).

I would also set trigger_threshold: 2000 and num_blocks_to_archive: 1000 as you proposed - this means that the ledger would actually archive 1000 blocks each time it receives a new transaction (rather than archiving all excess transactions at once), until the number of blocks in the ledger drops below the trigger_threshold.