eth_getStorageAt
JSON-RPC method returns the value stored at a specific storage position in a smart contract. This method provides direct access to contract storage, enabling contract state inspection, debugging, and advanced contract analysis.
Get your own node endpoint todayStart for free and get your app to production levels immediately. No credit card required.You can sign up with your GitHub, X, Google, or Microsoft account.
Parameters
The method takes three parameters:- Address - The contract address to read storage from
- Storage position - The storage slot position to read
- Block parameter - The block at which to read the storage
Parameter details
address
(string, required) — The 20-byte contract addressposition
(string, required) — The storage position as a hexadecimal stringblock
(string, required) — Block identifier:"latest"
(only the latest block is supported on Hyperliquid)
Response
The method returns the 32-byte value stored at the specified position as a hexadecimal string.Response structure
Storage value:result
— The 32-byte storage value as a hexadecimal string with0x
prefix
Data interpretation
Storage format:- Always returns 32 bytes (64 hex characters +
0x
prefix) - Values are zero-padded to 32 bytes
0x0000000000000000000000000000000000000000000000000000000000000000
indicates empty/zero storage- Actual data may be packed or encoded depending on variable type
Storage layout
Solidity storage rules
Basic types:uint256
,int256
,bytes32
— Occupy full 32-byte slotuint128
,uint64
, etc. — Packed into slots when possibleaddress
— 20 bytes, often packed with other databool
— 1 byte, packed with other data
- Arrays — Length at base slot, elements at calculated positions
- Mappings — Values at
keccak256(key, slot)
positions - Structs — Members packed sequentially starting from base slot
Storage slot calculation
Simple variables:Contract state inspection
Variable reading
Direct variable access:- Read public variables directly from their storage slots
- Decode packed variables using appropriate offsets
- Handle different data types and encodings
- Verify variable values against expected ranges
- Compare storage values with expected contract state
- Verify contract initialization and configuration
- Check for state corruption or unexpected changes
- Validate contract upgrade states
Current state analysis
State inspection:- Read current contract storage values
- Analyze current contract state and configuration
- Verify current variable values and settings
- Inspect current contract initialization state
Usage example
Basic implementation
Hyperliquid-specific considerations
Block limitations
Latest block only:- Only the
"latest"
block parameter is supported - Historical storage queries are not available in the default implementation
- All storage reads are performed against the current state
- For historical analysis, consider using archive node implementations
Storage analysis
Current state inspection:- Read contract storage values at current block
- Analyze current contract configuration and state
- Verify current variable values and settings
- Debug current contract behavior and issues
- Storage values are always 32 bytes (64 hex characters + “0x”)
- Values are zero-padded to 32 bytes
- Different data types require different decoding approaches
- Packed variables share storage slots for gas efficiency
Example request
This an example call with wrapped HYPE (wHYPE) on the Hyperliquid mainnet deployed at 0x5555555555555555555555555555555555555555.Shell
Use cases
Theeth_getStorageAt
method is essential for applications that need to:
- Contract debugging: Inspect current contract state during development and testing
- State verification: Verify current contract variables and configuration
- Security analysis: Analyze current contract storage for security vulnerabilities
- Contract auditing: Examine current contract state for audit and compliance
- Development tools: Build contract inspection and debugging tools
- Reverse engineering: Analyze unknown contracts by examining current storage
- Testing frameworks: Verify current contract state in automated tests
- Block explorers: Display current contract storage information
- Integration services: Provide current contract state data to external systems
On Hyperliquid,
eth_getStorageAt
only supports the latest block. Storage positions are calculated based on Solidity’s storage layout rules. Complex types like arrays and mappings require specific calculations to determine the correct storage positions.Body
application/json