EIP-7201 Decoder

Decode namespaced storage from its root slot and source-defined struct layout.

EIP-7201 Decoder inspects namespaced storage. It pairs a root slot with the struct layout from source code, so you can inspect each variable's relative position, type, and mapping path.

Use the Decoder

The Decoder appears below Storage Layout.

AreaDescription
SuggestionsDetected root slot → struct pairs. Select one to add it to the layout below.
Base SlotSelect or enter the namespace's root slot.
Storage StructureSelect a namespace struct detected in the source code.
AddAdds the slot and struct pair to the storage layout below.

Example

This example uses a local namespaced layout. It does not send requests.

  1. Select root slot → example.token under Suggestions to add the layout below.
  2. After it is added, the suggestion shows Added and cannot be selected again. If there are no suggestions, select or enter a root slot under Base Slot, select a struct under Storage Structure, then select Add.
  3. Select the type for totalSupply or balances to inspect its position and type relative to the root slot.
  4. Mappings and dynamic arrays also need a key or index before you can locate the actual data position.

What is EIP-7201?

EIP-7201 defines a pattern for namespaced storage: a contract places related variables in a struct, then assigns that struct an independent root slot. Variables inside the struct still follow the normal Solidity storage rules.

Source code commonly marks a namespace on the struct:

/// @custom:storage-location erc7201:example.token


struct TokenStorage {


    uint256 totalSupply;


    mapping(address => uint256) balances;


}

erc7201 calculates the root slot from the namespace ID with keccak256(keccak256(id) - 1) & ~0xff. This gives different modules independent storage areas, reducing the risk of slot collisions during upgrades or module composition. See the full specification in ERC-7201.

It is different from a proxy: a proxy determines which code runs; EIP-7201 determines where a module's state is stored. They can be used together or separately.

Notes

  • A namespace does not use an ordinary slot 0 layout. Confirm its root slot before interpreting variables inside it.
  • The namespace ID should remain stable. Changing it points to a different storage area.
  • @custom:storage-location marks the layout; the contract must still read and write at that root slot itself.

Next steps