Written by Pablo Gómez
Founder & CEO at Metlabs · Reviewed on October 11, 2026
ERC-7201, officially titled Namespaced Storage Layout, was created on 20 June 2023 and has Final status. Its formula computes each namespace's root slot as keccak256(keccak256(id) minus 1) with the last byte zeroed. In Solidity it reads as keccak256(abi.encode(uint256(keccak256(bytes(id))) minus 1)) and a mask that zeroes the last byte. Each step has a reason: subtracting 1 after the first keccak makes the hash preimage unknown, the second keccak avoids clashing with the slots Solidity generates for dynamic variables, and zeroing the last byte leaves 256 contiguous free slots for the struct to grow.
Each group of variables goes into a struct anchored at that root slot, annotated with the NatSpec tag custom:storage-location erc7201 followed by the namespace identifier. The specification's canonical example uses the identifier foobar anchored at erc7201 of foobar.
In upgradeable proxies the biggest risk is storage collision between versions or between modules. Assigning each logical component its own deterministic, documented namespace removes that risk and eases upgrades and modular design. It is complementary to patterns like UUPS and the transparent proxy, defined by ERC-1822 and EIP-1967. OpenZeppelin's upgradeable library adopted this pattern, with several of its authors on the team, and its use is typical in modular ERC-7579 smart accounts and in diamond and module architectures where several components share the same storage space.
Namespace separation reduces collision risks when the scheme is respected. It does not remove incompatible struct changes or upgrade-logic errors.
Also known as
- ERC7201
- Namespaced Storage Layout





