// Copyright 2019-2022 Parity Technologies (UK) Ltd. // This file is dual-licensed as Apache-2.0 or GPL-3.0. // see LICENSE for license details. //! To run this example, a local polkadot node should be running. Example verified against polkadot polkadot 0.9.25-5174e9ae75b. //! //! E.g. //! ```bash //! curl "https://github.com/paritytech/polkadot/releases/download/v0.9.25/polkadot" --output /usr/local/bin/polkadot --location //! polkadot --dev --tmp //! ``` use subxt::{ OnlineClient, PolkadotConfig, }; #[subxt::subxt(runtime_metadata_path = "../artifacts/polkadot_metadata.scale")] pub mod polkadot {} #[tokio::main] async fn main() -> Result<(), Box> { tracing_subscriber::fmt::init(); let api = OnlineClient::::new().await?; let address = polkadot::storage().system().account_root(); let mut iter = api.storage().iter(address, 10, None).await?; while let Some((key, account)) = iter.next().await? { println!("{}: {}", hex::encode(key), account.data.free); } Ok(()) }