# Ethereum eth_getStorageAt RPC method

Ethereum API method that returns the value from a storage position at a given address.

Parameters:

  • address — the address to check for storage.
  • quantity — the integer of the position in storage.
  • quantity or tag — the integer block number encoded as hexadecimal, or the string with:
    • latest — the latest block that is to be validated. The Beacon Chain may reorg and the latest block can become orphaned.
    • safe — the block that is equal to the tip of the chain and is very unlikely to be orphaned.
    • finalized — the block that is accepted by the two thirds of the Ethereum validators.
    • earliest — the genesis block.
    • pending — the pending state and transactions block.

Returns:

  • result — the value at this storage position.

Example:

The example returns the storage value of the simple storage contract (opens new window).

The last value change was in block 7500943 (opens new window) and it can be used as a reference point to retrieve the different storage values in time. Note that to query a state in the past, you need an archive node.

Information

cURL needs a HEX String starting with 0x to identify the block if you want to use a hex integer block number as a parameter. For example, block number 14000000 will be 0xD59F80.

  • web3.js
  • web3.py
  • eth.rb
  • cURL
const Web3 = require("web3");
const node_url = "CHAINSTACK_NODE_URL";
const web3 = new Web3(node_url);
web3.eth.getStorageAt("0x954De93D9f1Cd1e2e3AE5964F614CDcc821Fac64", 0, 7500943).then(result => {
    console.log(web3.utils.hexToAscii(result));
})