Skip to main content

eth_getLogs

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

Why zkSync? Build on Matter Labs' flagship zkEVM powering the Elastic Network of interoperable hyperchains with ZK Stack modular framework, hyperchain interoperability, native account abstraction, and $1.9B in tokenized real-world assets.

Use Cases#

The eth_getLogs method is essential for:

  • Event indexing - Track contract events for RWA tokenization ($1.9B, 25% market share), hyperchain deployment via ZK Stack, and cross-chain DeFi
  • 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-zksync-era-mainnet-full.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