> ## Documentation Index
> Fetch the complete documentation index at: https://docs.base.org/llms.txt
> Use this file to discover all available pages before exploring further.

# eth_getLogs

> Returns logs matching a filter. Use pending to query logs from pre-confirmed transactions.

Returns an array of all logs matching a given filter object. Particularly useful for indexing on-chain events.

<Warning>
  Queries spanning large block ranges or high-activity contracts can time out or be rejected. Keep `fromBlock`-to-`toBlock` ranges under 2,000 blocks for reliable results. Node providers may enforce their own limits.
</Warning>

<Tip>
  **Flashblocks:** Set `"fromBlock": "pending"` and `"toBlock": "pending"` to query logs from pre-confirmed transactions, updated every \~200ms. For a real-time stream, consider the [`pendingLogs`](/base-chain/api-reference/flashblocks-api/pendingLogs) WebSocket subscription instead.
</Tip>

## Parameters

<ParamField body="filter" type="object" required>
  The filter options. At least one criterion should be provided.

  <Expandable title="Filter fields">
    <ParamField body="fromBlock" type="string">
      Start of the block range. Block number in hex or a block tag. Use `"pending"` to include pre-confirmed logs. Defaults to `"latest"`.
    </ParamField>

    <ParamField body="toBlock" type="string">
      End of the block range. Block number in hex or a block tag. Defaults to `"latest"`.
    </ParamField>

    <ParamField body="address" type="string | array">
      A contract address or array of addresses to filter by. Optional.
    </ParamField>

    <ParamField body="topics" type="array">
      Array of 32-byte topic filters. Each position can be `null` (match any), a single topic hex string, or an array of hex strings (match any in the array). Position 0 is typically the `keccak256` hash of the event signature. Optional.
    </ParamField>

    <ParamField body="blockHash" type="string">
      Restricts logs to the block with this hash. If provided, `fromBlock` and `toBlock` are ignored. Optional.
    </ParamField>
  </Expandable>
</ParamField>

## Returns

<ResponseField name="result" type="array">
  Array of log objects matching the filter.

  <Expandable title="Log object fields">
    <ResponseField name="address" type="string">20-byte address of the contract that emitted the log.</ResponseField>
    <ResponseField name="topics" type="array">Array of 0–4 indexed 32-byte topics. Topic 0 is typically the event signature hash.</ResponseField>
    <ResponseField name="data" type="string">ABI-encoded non-indexed event parameters.</ResponseField>
    <ResponseField name="blockNumber" type="string">Block number in which this log was emitted (hex).</ResponseField>
    <ResponseField name="blockTimestamp" type="string">Unix timestamp of the block containing this log as a hex string. Base L2 extension to the standard Ethereum log schema.</ResponseField>
    <ResponseField name="transactionHash" type="string">32-byte hash of the transaction that emitted this log.</ResponseField>
    <ResponseField name="transactionIndex" type="string">Index of the transaction in the block (hex).</ResponseField>
    <ResponseField name="blockHash" type="string">32-byte hash of the block.</ResponseField>
    <ResponseField name="logIndex" type="string">Log's index position within the block (hex).</ResponseField>
    <ResponseField name="removed" type="boolean">`true` if the log was removed due to a chain reorganization.</ResponseField>
  </Expandable>
</ResponseField>

## Example

<CodeGroup>
  ```bash Standard (block range) theme={null}
  curl https://mainnet.base.org \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{
      "jsonrpc": "2.0",
      "method": "eth_getLogs",
      "params": [{
        "fromBlock": "0x12ced00",
        "toBlock": "0x12ced28",
        "address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
        "topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]
      }],
      "id": 1
    }'
  ```

  ```bash Flashblocks (pending, ~200ms) theme={null}
  curl https://mainnet.base.org \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{
      "jsonrpc": "2.0",
      "method": "eth_getLogs",
      "params": [{
        "fromBlock": "pending",
        "toBlock": "pending",
        "address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
        "topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]
      }],
      "id": 1
    }'
  ```

  ```json Response theme={null}
  {
    "jsonrpc": "2.0",
    "id": 1,
    "result": [
      {
        "address": "0x4200000000000000000000000000000000000006",
        "blockHash": "0x89f4c9e23a2f706f0afa9ca8f770c4b7dcbcb73ba7e9b1c29c4a8c1b90c31d24",
        "blockNumber": "0x2c31b0a",
        "blockTimestamp": "0x6a1092f7",
        "data": "0x00000000000000000000000000000000000000000000000080134424aad49d08",
        "logIndex": "0x0",
        "removed": false,
        "topics": [
          "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
          "0x000000000000000000000000b2cc224c1c9fee385f8ad6a55b4d94e92359dc59",
          "0x00000000000000000000000051c72848c68a965f66fa7a88855f9f7784502a7f"
        ],
        "transactionHash": "0x2ca798df9d399b886fb3735414e8d35a20fec080e48eb5e2e75c0f6ec349a725",
        "transactionIndex": "0x1"
      }
    ]
  }
  ```
</CodeGroup>
