Skip to main content

eth_getLogs

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

Why Avalanche? Build on the fastest smart contract platform with sub-second finality and customizable L1 subnets with sub-second finality, Evergreen subnets for institutions, and partnerships with Franklin Templeton, VanEck, and Bergen County.

Use Cases#

The eth_getLogs method is essential for:

  • Event indexing - Track contract events for institutional RWA tokenization ($18B+ transfer volume), gaming subnets, and enterprise blockchains
  • 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": "0x09383137c1eee3e1a8bc781228e4199f6b4a9bbf",
"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": "0x09383137c1eee3e1a8bc781228e4199f6b4a9bbf",
"topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", "0x...", "0x..."],
"data": "0x...",
"blockNumber": "0x5BAD55",
"transactionHash": "0x...",
"logIndex": "0x0"
}]
}

Code Examples#

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

Error Handling#

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