Read a Solidity mapping entry directly from node storage

A public getter may be absent from a legacy contract. For a known Solidity layout, the mapping key and its declared slot determine where the value lives.

Calculate the slot for one address

Suppose the verified layout places mapping(address => uint256) credit at slot 3. Left-pad the 20-byte address to 32 bytes and encode the integer 3 as another 32-byte word. Hash their 64-byte concatenation with Keccak-256.

slot = keccak256(abi.encode(account, uint256(3)))

Use the hash as the slot in eth_getStorageAt on the contract at the chosen block. Decode the word as uint256. Reading slot 3 itself will not return the mapping’s entries.

Match the layout to the deployed code

Obtain layout information for the implementation active at that block. With a delegatecall proxy, read storage at the proxy address. Nested mappings require another hashing step, and mapping keys of string or bytes type follow different encoding rules. docs.soliditylang.org Solidity storage layout