state_getStorage
Description
Retrieves a storage value from the Acala state at a given key. Storage keys are constructed from pallet name, storage item name, and optional parameters. The returned value is SCALE-encoded and needs decoding based on the storage type.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
storageKey | string | Yes | Hex-encoded storage key |
blockHash | string | No | Block hash to query state at. If omitted, uses latest block |
Request Example
{ "jsonrpc": "2.0", "method": "state_getStorage", "params": ["0x26aa394eea5630e07c48ae0c9558cef7b99d880ec681799c0cf30e8886371da9"], "id": 1 }
Code Examples
- TypeScript (@polkadot/api)
- Python
import { ApiPromise, WsProvider } from '@polkadot/api';
const api = await ApiPromise.create({ provider: new WsProvider('wss://api-acala.n.dwellir.com/YOUR_API_KEY') });
// High-level query
const account = await api.query.system.account('23M5ttkmR6KcnvsNJdmYTpLo9xfc54g8uCk55buDfiJPon69');
console.log('Account:', account.toHuman());
// Raw storage query
const storageKey = api.query.system.account.key('23M5ttkmR6KcnvsNJdmYTpLo9xfc54g8uCk55buDfiJPon69');
const rawValue = await api.rpc.state.getStorage(storageKey);
console.log('Raw storage:', rawValue.toHex());
from substrateinterface import SubstrateInterface
substrate = SubstrateInterface(url="wss://api-acala.n.dwellir.com/YOUR_API_KEY")
info = substrate.query('System', 'Account', params=['23M5ttkmR6KcnvsNJdmYTpLo9xfc54g8uCk55buDfiJPon69'])
print(info.value)