Skip to main content
Standard Ethereum JSON-RPC API

eth_getLogs

Returns logs matching a given filter object.

Parameters

  • filter: [required] Filter object:
    • fromBlock: [optional] Hexadecimal block number, or latest, earliest.
    • toBlock: [optional] Hexadecimal block number, or latest, earliest.
    • address: [optional] 20-byte contract address or array of addresses.
    • topics: [optional] Array of 32-byte topic values. Topics are order-dependent; each position can be a single value, an array of values (OR), or null (wildcard).
    • blockHash: [optional] 32-byte block hash. If set, fromBlock and toBlock are ignored.

Returns

Array of log objects. Each log includes address, topics, data, blockNumber, transactionHash, transactionIndex, blockHash, logIndex, and removed.

Example

This example retrieves ERC-20 Transfer events from the USDC contract across a range of blocks.

Request
curl https://rpc.linea.build \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_getLogs",
"params": [
{
"fromBlock": "0x1ce3100",
"toBlock": "0x1ce3110",
"address": "0x176211869ca2b568f2a7d4ee941e073a821ee1ff",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
]
}
],
"id": 1
}'
Example response
{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"address": "0x176211869ca2b568f2a7d4ee941e073a821ee1ff",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x000000000000000000000000...",
"0x000000000000000000000000..."
],
"data": "0x...",
"blockNumber": "0x1ce3105",
"transactionHash": "0x...",
"logIndex": "0x0",
"removed": false
}
]
}

Was this page helpful?