Fantom
Fantom
eth_getStorageAt
The eth_getStorageAt method returns the value stored at a specific storage position for a given smart contract address. This low-level method allows direct access to the contract's state variables and is crucial for contract analysis and debugging.
Use Cases
- Smart contract debugging and analysis
- Token balance verification
- Protocol governance inspection
- Proxy implementation verification
- Contract state auditing
- Storage layout validation
- DAO proposal status checking
- Contract upgrade verification
Method Details
This method provides raw access to any storage slot in a contract's storage.
Response Example
Understanding Solidity Storage Layout
Solidity's storage layout follows specific rules:
- State Variables: Stored sequentially starting from slot 0
- Mappings: The slot itself contains no data, but serves as a seed for computing positions
- Dynamic Arrays: The slot contains the array length, data starts at
keccak256(slot)
- Packed Variables: Multiple variables smaller than 32 bytes are packed together
Common Storage Slots
- ERC20 Total Supply: Often stored at slot 0 or 2
- ERC20 Balances Mapping: Often at slot 1 or 3
- ERC20 Allowances Mapping: Often at slot 2 or 4
- Proxy Implementation Address: For EIP-1967 proxies at
0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc
Storage Inspection Tools
For complex contracts, consider using dedicated tools:
- Slither: Static analyzer that can generate storage layouts
- Tenderly: Visual debugger with storage inspection
- Hardhat: Console debugging with storage access
- Etherscan: Sometimes provides verified contract storage layouts
See also
- eth_getCode - Get the bytecode deployed at a specific address
- eth_getProof - Retrieve cryptographic proofs for account and storage values
Parameters
The address of the smart contract
The integer of the storage position (hex string)
Block number in hex format or block tag