Skip to main content

state_getStorage

Description#

Returns the SCALE-encoded value stored under a given storage key. Combine with metadata to decode results into structured data.

Parameters#

PositionTypeDescription
0stringStorage key in hex (e.g., 0x26aa… for System.Account)
1 (optional)stringBlock hash to query

Request Example#

This sample queries System.Account for ZEyDXf6563rc78ibEtYQAkHTSKLzMES1m2BrPNdLcma57Tg.

{
"jsonrpc": "2.0",
"method": "state_getStorage",
"params": [
"0x26aa394eea5630e07c48ae0c9558cef7b99d880ec681799c0cf30e8886371da9e3a5c81a65b0e6ba8e72e48e58704482922ee694ea772dc63a575845fa57a0c5ea93dfdc2a93ec631d9e426962f1e311"
],
"id": 42
}

Response Example#

{
"jsonrpc": "2.0",
"id": 42,
"result": "0x0000000001000000010000000000000032b41eb5b90885078a550301000000000000000000000000000000000000000000000081da1cc2709a1dba000000000000000000000000000000000000000080"
}

Decode the result with the AccountInfo type to access fields such as data.free and data.reserved.

Code Examples#

substrate = SubstrateInterface(url="wss://api-astar.n.dwellir.com/YOUR_API_KEY", ss58_format=5)
account_info = substrate.query('System', 'Account', params=['ZEyDXf6563rc78ibEtYQAkHTSKLzMES1m2BrPNdLcma57Tg'])
print(account_info.value['data'])