Query Ethereum state with eth_getBalance, eth_getCode, eth_getStorageAt, eth_getProof
This page is a placeholder. All examples on this page are currently AI-generated and are not correct. This documentation will be completed in the future with accurate, tested examples.
State methods query account balances, contract bytecode, storage, and Merkle proofs at specific block heights.
// Check if address is a contractconst code = await provider.eth_getCode(address, 'latest');if (code.isOk() && code.value !== '0x') { console.log('Address is a contract'); console.log('Bytecode:', code.value);} else { console.log('Address is an EOA');}
eth_getStorageAt
Get value from a contract storage slot.
const value = await provider.eth_getStorageAt( address, Quantity(0), 'latest');// Response<Hex>