Skip to main content

eth_getLogs

Returns an array of all logs matching a given filter object on Immutable.

Why Immutable? Build on the gaming-optimized zkEVM with 660+ games, 5.5M+ Passport signups, and $40M TVL with first EVM chain with enforceable royalties, Polygon zkEVM technology, $2B+ ecosystem funding, and Agglayer cross-chain liquidity.

Use Cases#

The eth_getLogs method is essential for:

  • Event indexing - Track contract events for Web3 gaming (Gods Unchained, RavenQuest), gaming NFTs with enforced royalties, and cross-chain game assets
  • Token transfers - Monitor ERC20/ERC721 transfers
  • DeFi analytics - Track swaps, liquidity events, and more
  • Notification systems - Alert on specific on-chain events

Parameters#

ParameterTypeRequiredDescription
fromBlockQUANTITY|TAGNoStarting block (default: "latest")
toBlockQUANTITY|TAGNoEnding block (default: "latest")
addressDATA|ArrayNoContract address(es) to filter
topicsArrayNoArray of topic filters
blockHashDATANoFilter single block by hash

Request#

{
"jsonrpc": "2.0",
"method": "eth_getLogs",
"params": [{
"fromBlock": "latest",
"toBlock": "latest",
"address": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
"topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]
}],
"id": 1
}

Returns#

Array of log objects:

FieldTypeDescription
addressDATAContract that emitted the log
topicsArrayArray of indexed topics
dataDATANon-indexed log data
blockNumberQUANTITYBlock number
transactionHashDATATransaction hash
logIndexQUANTITYLog index in block

Response#

{
"jsonrpc": "2.0",
"id": 1,
"result": [{
"address": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
"topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", "0x...", "0x..."],
"data": "0x...",
"blockNumber": "0x5BAD55",
"transactionHash": "0x...",
"logIndex": "0x0"
}]
}

Code Examples#

curl -X POST https://api-immutable-zkevm-mainnet.n.dwellir.com/YOUR_API_KEY \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_getLogs",
"params": [{
"fromBlock": "latest",
"toBlock": "latest",
"address": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
"topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]
}],
"id": 1
}'

Error Handling#

Error CodeMessageDescription
-32005Query returned more than 10000 resultsReduce block range
-32602Invalid paramsInvalid filter parameters