starknet_getStorageAt
Get the value of the storage at the given address and key
Parameters
Parameter | Type | Description |
---|---|---|
contract_address | felt252 | Contract address |
key | felt252 | Storage key |
block_id | string | Block reference: "latest" , "l1_accepted" , block hash, or block number |
Request
{
"jsonrpc": "2.0",
"method": "starknet_getStorageAt",
"params": [
"0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
"0x1",
{
"block_hash": "0x05abbad1e5"
}
],
"id": 1
}
Returns
The value at the given key for the given contract. 0 if no value is found
Storage value (felt252)
Errors
Code | Message |
---|---|
20 | Contract not found |
24 | Block not found |
Examples
- cURL
- JavaScript
curl -X POST https://api-starknet-mainnet.n.dwellir.com/YOUR_API_KEY \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "starknet_getStorageAt",
"params": [
"0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
"0x1",
{
"block_hash": "0x05abbad1e5"
}
],
"id": 1
}'
import { RpcProvider } from 'starknet';
const provider = new RpcProvider({
nodeUrl: 'https://api-starknet-mainnet.n.dwellir.com/YOUR_API_KEY',
});
const payload = {
method: 'starknet_getStorageAt',
params: [
"0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
"0x1",
{
"block_hash": "0x05abbad1e5"
}
]
};
const result = await provider.fetchEndpoint(payload.method, payload.params);
console.log(result);