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": [
{}
]
}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": [
{}
]
}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.object — the filter options:
fromBlock (optional) — integer block number, or latest, earliest, pendingtoBlock (optional) — integer block number, or latest, earliest, pendingaddress (optional) — contract address or list of addresses from which logs should originatetopics (optional) — array of 32-byte data topicsblockhash (optional) — restricts logs to a single block with the given hashresult — array of log objects, or an empty array if nothing has changed:
removed — true when the log was removed due to chain reorganizationlogIndex — integer of the log index position in the blocktransactionIndex — integer of the transaction’s index positiontransactionHash — hash of the transaction that generated this logblockHash — hash of the block containing this logblockNumber — block number containing this logaddress — address from which this log originateddata — non-indexed arguments of the logtopics — array of indexed log argumentseth_getLogs code examplesconst { 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();
eth_getLogs is tracking specific events from smart contracts, such as token transfers, swaps, or any custom events defined in your contracts.Was this page helpful?