For the complete documentation index, see llms.txt. This page is also available as Markdown.

eth_getStorageAt - Ethereum

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

This method returns the value at a specific storage slot of a contract at a given block, hex-encoded. Storage slots are 32-byte keys that map to 32-byte values in the contract's state trie. Reading arbitrary slots lets applications inspect contract state directly without a public getter — useful for proxy inspection, storage-layout debugging, and reading private fields.

Parameters

Parameter
Type
Required
Description

address

string

Yes

Contract address (hex-encoded with 0x prefix)

storageSlot

string

Yes

Storage slot key (hex-encoded 32-byte value)

blockParameter

string

Yes

Block number in hex, or latest, earliest, pending, finalized, safe

Request

curl --location --request POST 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "eth_getStorageAt",
    "params": [
        "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
        "0x0000000000000000000000000000000000000000000000000000000000000000",
        "latest"
    ],
    "id": "getblock.io"
}'
example.js
const axios = require('axios');

const response = await axios.post('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/', {
    jsonrpc: '2.0',
    method: 'eth_getStorageAt',
    params: [
        "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
        "0x0000000000000000000000000000000000000000000000000000000000000000",
        "latest"
    ],
    id: 'getblock.io'
}, {
    headers: { 'Content-Type': 'application/json' }
});

console.log(response.data.result);

Response

Response Parameters

Parameter
Type
Description

jsonrpc

string

JSON-RPC protocol version ("2.0")

id

string

Request identifier matching the request

result

string

Hex-encoded 32-byte value at the requested slot (zero-padded if the underlying type is smaller)

Use Cases

  • Proxy Implementation Detection: Read the EIP-1967 implementation slot (0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc) to identify the current logic contract behind a proxy

  • Storage-Layout Debugging: Inspect specific state variables during development when public getters are unavailable

  • Private Field Reading: Read private state variables whose slots are known from the contract's storage layout

  • Cross-Chain Storage Proofs: Combined with eth_getProof, verify storage values via Merkle proofs on other chains

Error Handling

Error Code
Message
Description

-32602

Invalid params

Address or storage slot is malformed, or block parameter is invalid

-32603

Internal error

Node failed to look up storage at the requested block

Web3 Integration

Last updated

Was this helpful?