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

# eth_getLogs | Monad

> Monad API method that returns an array of all logs matching a given filter object. This is essential for tracking events emitted by smart contracts.

Monad API method that returns an array of all logs matching a given filter object. This is essential for tracking events emitted by smart contracts.

<Warning>
  **Monad-specific behavior**: `eth_getLogs` has a maximum block range (typically 1000 blocks). Because Monad blocks are much larger than Ethereum blocks, use small block ranges (1-10 blocks) for optimal performance. Requests with longer ranges can take a long time or time out.
</Warning>

## Parameters

* `object` — the filter options:
  * `fromBlock` (optional) — integer block number, or `latest`, `earliest`, `pending`
  * `toBlock` (optional) — integer block number, or `latest`, `earliest`, `pending`
  * `address` (optional) — contract address or list of addresses from which logs should originate
  * `topics` (optional) — array of 32-byte data topics
  * `blockhash` (optional) — restricts logs to a single block with the given hash

## Response

* `result` — array of log objects, or an empty array if nothing has changed:
  * `removed` — `true` when the log was removed due to chain reorganization
  * `logIndex` — integer of the log index position in the block
  * `transactionIndex` — integer of the transaction's index position
  * `transactionHash` — hash of the transaction that generated this log
  * `blockHash` — hash of the block containing this log
  * `blockNumber` — block number containing this log
  * `address` — address from which this log originated
  * `data` — non-indexed arguments of the log
  * `topics` — array of indexed log arguments

## `eth_getLogs` code examples

<CodeGroup>
  ```javascript ethers.js theme={"system"}
  const { ethers } = require("ethers");

  const provider = new ethers.JsonRpcProvider("CHAINSTACK_NODE_URL");

  async function getLogs() {
    const logs = await provider.getLogs({
      fromBlock: "latest",
      toBlock: "latest",
      address: "0x..." // Optional: filter by contract address
    });
    console.log(logs);
  }

  getLogs();
  ```

  ```python web3.py theme={"system"}
  from web3 import Web3

  node_url = "CHAINSTACK_NODE_URL"

  web3 = Web3(Web3.HTTPProvider(node_url))

  logs = web3.eth.get_logs({
      'fromBlock': 'latest',
      'toBlock': 'latest',
      'address': '0x...' # Optional: filter by contract address
  })

  for log in logs:
      print(log)
  ```
</CodeGroup>

## Use case

A practical use case for `eth_getLogs` is tracking specific events from smart contracts, such as token transfers, swaps, or any custom events defined in your contracts.


## OpenAPI

````yaml openapi/monad_node_api/logs_and_events/eth_getLogs.json POST /
openapi: 3.0.0
info:
  title: Monad Node API
  version: 1.0.0
  description: This is an API for interacting with a Monad node.
servers:
  - url: https://monad-testnet.core.chainstack.com/9c5b265f20b3ea5df4f54f70eb74b800
security: []
paths:
  /:
    post:
      tags:
        - Logs & events
      summary: eth_getLogs
      operationId: eth_getLogs
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                id:
                  type: integer
                  default: 1
                jsonrpc:
                  type: string
                  default: '2.0'
                method:
                  type: string
                  default: eth_getLogs
                params:
                  type: array
                  items:
                    type: object
                    properties:
                      fromBlock:
                        type: string
                      toBlock:
                        type: string
                      address:
                        type: string
                      topics:
                        type: array
                        items:
                          type: string
                  default:
                    - fromBlock: latest
                      toBlock: latest
      responses:
        '200':
          description: An array of log objects.
          content:
            application/json:
              schema:
                type: object
                properties:
                  jsonrpc:
                    type: string
                  id:
                    type: integer
                  result:
                    type: array
                    items:
                      type: object

````