storage_at

Returns one raw 32-byte storage word for a contract and BYTES32 slot in live, pinned, or retained execution state. Without a CLIENT, it builds a reusable READ and does not access state.

Example

Local

1
SELECT storage_at('0x0000000000000000000000000000000000000001'::ADDRESS, '0x0000000000000000000000000000000000000000000000000000000000000000'::BYTES32);
Notebook ready in readonly mode.

API reference

Exact signatures with descriptions, requirements, inputs, returns, and examples.

storage_at(CLIENT, ADDRESS, BYTES32) # Immediate Read · RPC required

Reads the BYTES32 key in the CLIENT's current state context; only a live CLIENT necessarily resolves latest.

Inputs

Name Type Use
client CLIENT

Readable EVM state represented by a live, pinned, or execution CLIENT.

required positional
address ADDRESS

Contract address whose storage should be read.

required positional
slot BYTES32

Exact 32-byte BYTES32 storage key. For mappings, pass the Solidity keccak-derived key as BYTES32.

required positional

Returns

Name Type
value BYTES32

Raw 32-byte storage word. Returns the storage word as BYTES32. Historical reads may require an archive-capable RPC provider.

Guidance

Storage slot encoding

The SQL binder accepts BYTES32 for the storage key.

For Solidity mappings, compute keccak256(key . slot) using Solidity's layout and pass the resulting 32-byte key.

The same BYTES32 representation is used by simulation storage assumptions and READ builders.

  • Use the block_number overload for reproducible historical evidence.
  • Relation-sized attached pinned reads may share an adaptive hash-pinned proof or storage-call batch; every request keeps the durable blockHash and requireCanonical selector.
  • Older slots may require an archive node.

Additional overloads

storage_at(CLIENT, ADDRESS, BYTES32, BIGINT) # Immediate Read · RPC required

Reads a BYTES32 storage key at an explicit block height; older heights may require archive hydration.

Inputs

Name Type Use
client CLIENT

Readable EVM state represented by a live, pinned, or execution CLIENT.

required positional
address ADDRESS

Contract address whose storage should be read.

required positional
slot BYTES32

Exact 32-byte BYTES32 storage key. For mappings, pass the Solidity keccak-derived key as BYTES32.

required positional
block_number BIGINT

Optional historical block height.

required positional

Returns

Name Type
value BYTES32

Raw 32-byte storage word. Returns the storage word as BYTES32. Historical reads may require an archive-capable RPC provider.

Overload examples

Named parameters · RPC required

1
-- Track slot changes across blocks
2
SELECT storage_at(
3
$client,
4
'0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'::address, -- Ethereum mainnet WETH
5
'0x0000000000000000000000000000000000000000000000000000000000000000'::BYTES32,
6
21000000 -- Ethereum mainnet block_number
7
) AS value;
storage_at(ADDRESS, BYTES32) # Read Builder · RPC required

Builds a reusable storage READ for one BYTES32 slot; no client is resolved and no state is accessed.

Inputs

Name Type Use
address ADDRESS

Contract address whose storage should be observed.

required positional
slot BYTES32

Exact BYTES32 storage key, including a Solidity-derived mapping key when needed.

required positional

Returns

Name Type
read READ

Storage READ. Returns a canonical READ specification for a later raw storage-word observation.

Examples

Named parameters · RPC required

1
-- Read storage slot 0
2
SELECT storage_at(
3
$client,
4
'0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'::address, -- Ethereum mainnet WETH
5
'0x0000000000000000000000000000000000000000000000000000000000000000'::BYTES32
6
) AS value;
Notebook ready in readonly mode.

Related functions

Category and tags

Category
Chain reads
Tag
RPC
Tag
Simulate