eth_getStorageAt - Somnia
Example code for the eth_getStorageAt JSON-RPC method. Complete guide on how to use eth_getStorageAt JSON-RPC in GetBlock Web3 documentation.
This method returns the value from a storage position at a given address on the Somnia network. This is useful for reading raw contract storage, analyzing state, and debugging smart contracts.
Parameters
address
string
Yes
Contract address
position
string
Yes
Storage slot position (hex)
blockNumber
string
Yes
Block number in hex, or "latest"
Request Example
curl -X POST https://go.getblock.io/<ACCESS-TOKEN>/ \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": "getblock.io",
"method": "eth_getStorageAt",
"params": [
"0xContractAddress",
"0x0",
"latest"
]
}'const axios = require('axios');
const url = 'https://go.getblock.io/<ACCESS-TOKEN>/';
const payload = {
jsonrpc: '2.0',
id: 'getblock.io',
method: 'eth_getStorageAt',
params: ['0xContractAddress', '0x0', 'latest']
};
axios.post(url, payload, {
headers: { 'Content-Type': 'application/json' }
})
.then(response => console.log(response.data))
.catch(error => console.error(error));Response Example
Response Parameters
result
string
32-byte storage value at position
Use Cases
Read contract storage directly
Debug storage layout
Verify state variables
Analyze proxy contracts
Security auditing
Error Handling
-32602
Invalid params - malformed address or position
-32603
Internal error - node processing issues
SDK Integration
Last updated
Was this helpful?