state_getKeysPaged
Returns storage keys with pagination on Asset Hub.
Use Cases#
- Storage iteration - Enumerate storage map entries
- Data export - Bulk export chain data for native stablecoin transfers (USDC, USDT), DOT staking and governance, and cross-chain asset management via XCM
- Account enumeration - List all accounts
Parameters#
| Parameter | Type | Required | Description |
|---|---|---|---|
prefix | String | Yes | Storage key prefix |
count | Number | Yes | Maximum keys to return |
startKey | String | No | Key to start after |
blockHash | String | No | Block hash for historical query |
Request#
{
"jsonrpc": "2.0",
"method": "state_getKeysPaged",
"params": ["0x...", 100],
"id": 1
}
Code Examples#
- cURL
- JavaScript
curl https://api-asset-hub-polkadot.n.dwellir.com/<YOUR_API_KEY>/YOUR_API_KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "state_getKeysPaged",
"params": ["0x26aa394eea5630e07c48ae0c9558cef7", 100],
"id": 1
}'
import { ApiPromise, WsProvider } from '@polkadot/api';
const provider = new WsProvider('wss://api-asset-hub-polkadot.n.dwellir.com/YOUR_API_KEY');
const api = await ApiPromise.create({ provider });
// Get all accounts (paginated)
const keys = await api.rpc.state.getKeysPaged(
api.query.system.account.keyPrefix(),
100
);
console.log('Found accounts:', keys.length);
await api.disconnect();
Related Methods#
state_getStorage- Get storage valuestate_queryStorageAt- Batch storage query