Is it possible to make batched storage calls to the runtime using subxt or is it only possible to make repeated individual calls against the state?

Say there are 3 storage variables I would like to query using subxt. I can do each of these individually:

let storage_addresses = vec![alice, bob, charlie]
    .map(|dest| subxt::dynamic::storage(
            // Something that encodes to an AccountId32 is what we need for the map key here:

let accounts = storage_addresses.iter().map(|a|
        .fetch_or_default(&a, None)

I'm curious if there is a smarter way to batch all these calls at once?

  • Have you tried using batch to batch the calls? Here is an example of using the dynamic api with multisig that may be helpful as it uses a nested inner call just like batch does.
    – Bruno
    Commented Dec 8, 2022 at 17:09
  • Sorry for necroing. Regarding dynamic batch call: How would the call field be properly constructed? Say I have a call: Vec<DynamicTxPayload>, how would you derive the Value, e.g. subxt::dynamic::tx("Utility", "batch", vec![("call", do_something_with_calls)]? Commented Dec 9, 2022 at 11:16

1 Answer 1


The options that I'm aware of are:

  1. to do what you've done (whether you use static or dynamic storage lookups).
  2. Use the "lower level" RPC method (api.rpc().query_storage_at(..) to query multiple entries at once (but you get bytes back and need to decode them manually), or
  3. Use api.storage().iter(some_address) to iterate over all accounts (but you get nice types back here).

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.