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

Parameter
Type
Required
Description

address

string

Yes

Contract address

position

string

Yes

Storage slot position (hex)

blockNumber

string

Yes

Block number in hex, or "latest"

Request Example

cURL
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"
  ]
}'

Response Example

Response Parameters

Parameter
Type
Description

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

Error Code
Description

-32602

Invalid params - malformed address or position

-32603

Internal error - node processing issues

SDK Integration

Last updated

Was this helpful?