eth_getStorageAt - Base

Example code for the eth_getStorageAt JSON-RPC method. Complete guide on how to use eth_getStorageAt JSON-RPC in GetBlock Web3 documentation.

The eth_getStorageAt method returns the value from a storage position at a given address. This is useful for reading raw contract storage slots, which is essential for analyzing contract state and proxy implementations.

Parameters

Parameter
Type
Required
Description

address

string

Yes

20-byte address of the contract

position

string

Yes

Storage position (hex)

blockParameter

string

Yes

Block number in hex, or "latest", "earliest", "pending"

Request

curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "eth_getStorageAt",
    "params": ["0x4200000000000000000000000000000000000006", "0x0", "latest"],
    "id": "getblock.io"
}'

Response

Response Parameters

Parameter
Type
Description

jsonrpc

string

JSON-RPC protocol version ("2.0")

id

string

Request identifier matching the request

result

string

32-byte value at the storage position (hex)

Use Cases

  • Proxy Detection: Read implementation address from proxy contracts

  • Contract Analysis: Inspect raw contract state

  • Token Analysis: Read token supply and holder data

  • Governance: Check voting power and delegation

  • Security Auditing: Verify contract storage layout

Error Handling

Error Code
Message
Description

-32602

Invalid params

Invalid address or position format

-32603

Internal error

Node internal failure

Web3 Integration

Last updated

Was this helpful?