ERC-7201
A standard for namespaced storage that places a group of contract state variables at a slot derived from a unique string identifier, so different code sharing the same storage cannot collide.
ERC-7201 defines where a contract keeps its state when more than one piece of code may share the same storage. Instead of letting variables fall into sequential slots starting at slot 0, the contract groups them in a struct and stores that struct at a root slot computed from a namespace id:
1keccak256(abi.encode(uint256(keccak256("example.main")) - 1)) & ~bytes32(uint256(0xff))
The namespace is documented on the struct with a NatSpec annotation, @custom:storage-location erc7201:<id>, so tools can check the layout. Subtracting 1 means the slot has no known hash preimage, and clearing the last byte aligns the location to a 256-slot boundary.
The pattern matters wherever code changes but storage stays. In upgradeable proxies, it lets an implementation and its base contracts keep their state apart. Under EIP-7702 it matters even more: an account can re-delegate to entirely different code, and the new delegate inherits every slot the old one wrote. A delegate that keeps an owner or guardian in slot 0 may read a value it never set, a storage collision. A delegate that keeps its state in its own ERC-7201 namespace starts from slots no other delegate wrote.
Related Terms
Storage Collision
Critical vulnerability in proxy contracts where proxy and implementation use the same storage slot for different variables, causing state corruption.
Storage Slot
32-byte memory location in EVM persistent storage where contract state variables are stored, with access costs significantly higher than memory.
EIP-7702
Ethereum protocol upgrade activated in the Pectra hard fork (May 7, 2025) that lets an externally owned account temporarily delegate its execution to a smart contract via a signed authorization tuple, without changing the EOA's address or private key.
Delegation Designator
The 23-byte code, 0xef0100 followed by a contract address, that an EIP-7702 authorization writes to an externally owned account so the EVM runs that contract's code at the account's address.
Proxy Pattern
Smart contract design separating storage and logic, enabling upgrades by changing implementation while preserving state.
Need expert guidance on ERC-7201?
Our team at Zealynx has deep expertise in blockchain security and DeFi protocols. Whether you need an audit or consultation, we're here to help.
Get a Quote