Skip to main content

eth_getAccount

Returns account details (code hash, storage root, balance, nonce) for a given address at a specified block. This method uses 80 credits from your daily balance.

Parameters

  • address: [Required] The account address to query.
  • blockReference: [Required] Block number (hex quantity) or a tag (latest, pending, safe, finalized, earliest).

Returns

Account fields at the requested block:

  • codeHash: 32-byte hash of the account code.
  • storageRoot: Storage trie root for the account.
  • balance: Account balance in wei (hex quantity).
  • nonce: Transaction count for the account (hex quantity).

Example

Replace <YOUR-API-KEY> with an API key from your MetaMask Developer dashboard.

Request

curl https://megaeth-mainnet.infura.io/v3/<YOUR-API-KEY> \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_getAccount",
"params": [
"0xA887dCB9D5f39Ef79272801d05Abdf707CFBbD1d",
"latest"
],
"id": 1
}'

Response

{
"jsonrpc": "2.0",
"id": 1,
"result": {
"codeHash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
"storageRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
"balance": "0x0",
"nonce": "0x2c160f5"
}
}