eth_storage_slot
Compute a storage slot: a mapping/array entry, or a well-known layout's root.
Instructions
Compute a storage slot: a mapping/array entry, or a well-known layout's root.
layout: {"kind": …} — the first two describe a layout you declared, the rest
are the standard constant slots, which need no "slot" of their own:
mapping -> needs "slot" and key; "key_type" (default uint256). For
nested mappings pass key (and "key_type") as lists.
dynamic_array -> needs "slot" and index; optional "element_size" (slots).
eip1967 -> the proxy slots, keccak256(label) - 1. Optional "name":
implementation (default), admin, beacon, or rollback.
eip1822 -> UUPS proxiableUUID, keccak256("PROXIABLE") — no -1.
erc7201 -> namespaced storage root for "namespace",
keccak256(abi.encode(keccak256(ns) - 1)) & ~0xff. An
erc7201: annotation prefix on the namespace is stripped.
diamond -> EIP-2535 diamond storage, plain keccak256("namespace").
Returns {slot, slot_hex}: the slot as a decimal string and a 0x 32-byte word,
plus formula (and name/namespace) for the constant layouts. Every
constant is derived by keccak here, not pasted from the EIP. The results
compose: feed a namespaced root back in as another layout's "slot" to reach
a mapping or array declared inside that struct, and use index to step to a
later member of it.
Example: eth_storage_slot({"kind":"eip1967"}) -> slot_hex="0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc".
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | No | Mapping key (required for kind=mapping); pass a list of keys outer-to-inner for nested mappings. Ignored otherwise. | |
| index | No | Element index (required for kind=dynamic_array); int/decimal/0x-hex. For erc7201/diamond it is the optional slot offset of a member within the struct that starts at the root. Ignored otherwise. | |
| layout | Yes | Layout object: {"kind": ..., ...}. Declared layouts take a "slot" (int/decimal/0x-hex): "mapping" (+ optional "key_type", default "uint256", or a list for nested mappings) and "dynamic_array" (+ optional "element_size" in slots, default 1). Well-known constant layouts take no slot: "eip1967" (+ "name": implementation|admin|beacon|rollback), "eip1822" (aka uups), "erc7201" and "diamond" (+ a "namespace" string). A stringified JSON object is accepted. |