Skip to main content
POST
/
eth_getLogs
curl --request POST \
  --url https://monad-testnet.core.chainstack.com/9c5b265f20b3ea5df4f54f70eb74b800/ \
  --header 'Content-Type: application/json' \
  --data '{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "eth_getLogs",
  "params": [
    {
      "fromBlock": "latest",
      "toBlock": "latest"
    }
  ]
}'
{
  "jsonrpc": "<string>",
  "id": 123,
  "result": [
    {}
  ]
}
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-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.
Get you own node endpoint todayStart for free and get your app to production levels immediately. No credit card required.You can sign up with your GitHub, X, Google, or Microsoft account.

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:
    • removedtrue 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

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();

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.

Body

application/json
id
integer
default:1
jsonrpc
string
default:2.0
method
string
default:eth_getLogs
params
object[]

Response

200 - application/json

An array of log objects.

jsonrpc
string
id
integer
result
object[]