⚠️Blast API (blastapi.io) ends Oct 31. Migrate to Dwellir and skip Alchemy's expensive compute units.
Switch Today →
Skip to main content

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

ParameterTypeRequiredDescription
storageKeystringYesHex-encoded storage key
blockHashstringNoBlock hash to query state at. If omitted, uses latest block

Request Example

{ "jsonrpc": "2.0", "method": "state_getStorage", "params": ["0x26aa394eea5630e07c48ae0c9558cef7b99d880ec681799c0cf30e8886371da9"], "id": 1 }

Code Examples

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());