eth_getStorageAt - Celo

This method returns the value from a storage position at a given address on the Celo network. This is useful for reading raw contract storage, including private variables that aren't exposed through public functions.

Parameters

ParameterTypeRequiredDescription
addressstringYesContract address
positionstringYesStorage position as hex
blockNumberstringYesBlock number in hex, or "latest", "earliest", "pending"

Request Example

cURL

bashcurl -X POST https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/ \
-H "Content-Type: application/json" \
-d '{
  "jsonrpc": "2.0",
  "id": "getblock.io",
  "method": "eth_getStorageAt",
  "params": [
    "0x765DE816845861e75A25fCA122bb6898B8B1282a",
    "0x0",
    "latest"
  ]
}'

JavaScript (Axios)

javascriptconst axios = require('axios');

const url = 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/';

const payload = {
  jsonrpc: '2.0',
  id: 'getblock.io',
  method: 'eth_getStorageAt',
  params: [
    '0x765DE816845861e75A25fCA122bb6898B8B1282a',
    '0x0',
    'latest'
  ]
};

axios.post(url, payload, {
  headers: { 'Content-Type': 'application/json' }
})
.then(response => console.log(response.data))
.catch(error => console.error(error));

Python

pythonimport requests
import json

url = "https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/"

payload = {
    "jsonrpc": "2.0",
    "id": "getblock.io",
    "method": "eth_getStorageAt",
    "params": [
        "0x765DE816845861e75A25fCA122bb6898B8B1282a",
        "0x0",
        "latest"
    ]
}

response = requests.post(url, headers={"Content-Type": "application/json"}, json=payload)
print(response.json())

Response Example

Response JSON

json{
  "jsonrpc": "2.0",
  "id": "getblock.io",
  "result": "0x0000000000000000000000000000000000000000000000000000000000000001"
}

Response Definition

FieldTypeDescription
resultstringStorage value as 32-byte hex string

Use Cases

  • Read contract storage directly
  • Access private variables
  • Analyze proxy contract state
  • Debug contract behavior

Error Handling

Error CodeDescription
-32602Invalid params - malformed address or position
-32603Internal error - node processing issues

SDK Integration

Ethers.js

javascriptconst { ethers } = require('ethers');

const provider = new ethers.JsonRpcProvider('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/');

const storage = await provider.getStorage('0x765DE816845861e75A25fCA122bb6898B8B1282a', 0);
console.log(storage);

ContractKit

javascriptconst { newKit } = require('@celo/contractkit');

const kit = newKit('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/');

const storage = await kit.web3.eth.getStorageAt('0x765DE816845861e75A25fCA122bb6898B8B1282a', 0);
console.log(storage);