state_getStorage
Returns a storage entry at a specific key on Neuroweb.
Why Neuroweb? Build on the decentralized AI blockchain powering 125M+ Knowledge Assets with MIT-awarded technology with OriginTrail DKG V8 with 500-1000x scalability, 40% of US imports secured, EVM compatibility, and Best Decentralized AI Project (MIT).
Use Cases#
- State queries - Read on-chain storage values
- Account balances - Query account data for decentralized knowledge graphs (DKG), verifiable AI, supply chain audits, and knowledge mining
- Pallet storage - Access runtime storage items
- Historical state - Query state at specific blocks
Parameters#
| Parameter | Type | Required | Description |
|---|---|---|---|
key | String | Yes | Storage key (hex-encoded) |
blockHash | String | No | Block hash for historical query |
Request#
{
"jsonrpc": "2.0",
"method": "state_getStorage",
"params": [""],
"id": 1
}
Code Examples#
- cURL
- JavaScript
- Python
curl https://api-neuroweb.n.dwellir.com/YOUR_API_KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "state_getStorage",
"params": [""],
"id": 1
}'
import { ApiPromise, WsProvider } from '@polkadot/api';
const provider = new WsProvider('wss://api-neuroweb.n.dwellir.com/YOUR_API_KEY');
const api = await ApiPromise.create({ provider });
// Query account balance
const account = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY';
const accountInfo = await api.query.system.account(account);
console.log('Free balance:', accountInfo.data.free.toString());
// Query at specific block
const blockHash = '0x91b171bb158e2d3848fa23a9f1c25182fb8e20313b2c1eb49219da7a70ce90c3';
const historicalBalance = await api.query.system.account.at(blockHash, account);
console.log('Historical balance:', historicalBalance.data.free.toString());
await api.disconnect();
import requests
def get_storage(key, block_hash=None):
url = 'https://api-neuroweb.n.dwellir.com/YOUR_API_KEY'
params = [key] if block_hash is None else [key, block_hash]
payload = {
'jsonrpc': '2.0',
'method': 'state_getStorage',
'params': params,
'id': 1
}
response = requests.post(url, json=payload)
return response.json()['result']
# Query :code storage (runtime wasm)
storage_key = ''
value = get_storage(storage_key)
print(f'Storage value: {value[:66]}...' if value else 'None')
Related Methods#
state_getMetadata- Get runtime metadatastate_getKeysPaged- Enumerate storage keys