curl --request POST \
--url https://base-mainnet.core.chainstack.com/2fc1de7f08c0465f6a28e3c355e0cb14 \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc": "2.0",
"method": "eth_getLogs",
"id": 1,
"params": [
{
"fromBlock": "latest",
"address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
]
}
]
}'
{
"jsonrpc": "<string>",
"id": 123,
"result": [
{
"removed": true,
"logIndex": "<string>",
"transactionIndex": "<string>",
"transactionHash": "<string>",
"blockHash": "<string>",
"blockNumber": "<string>",
"address": "<string>",
"data": "<string>",
"topics": [
"<string>"
]
}
]
}
curl --request POST \
--url https://base-mainnet.core.chainstack.com/2fc1de7f08c0465f6a28e3c355e0cb14 \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc": "2.0",
"method": "eth_getLogs",
"id": 1,
"params": [
{
"fromBlock": "latest",
"address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
]
}
]
}'
{
"jsonrpc": "<string>",
"id": 123,
"result": [
{
"removed": true,
"logIndex": "<string>",
"transactionIndex": "<string>",
"transactionHash": "<string>",
"blockHash": "<string>",
"blockNumber": "<string>",
"address": "<string>",
"data": "<string>",
"topics": [
"<string>"
]
}
]
}
eth_getLogs
retrieves logs matching specific criteria, such as block range, address, and topics. This method is crucial for applications that need to fetch log data for analysis, display, or monitoring smart contract events.
The example track USDC token transfers.
filterObject
— an object containing filter options:
fromBlock
— the starting block to search for logs. In this example, it’s set to "latest"
.address
— the contract address to fetch logs from.topics
— an array of topics to match against the logs.result
— an array of log objects. Each log object contains details such as whether the log was removed (due to a chain reorganization), log index, transaction index, transaction hash, block hash, block number, address from which the log originated, data contained in the log, and topics associated with the log.eth_getLogs
method is essential for:
Logs matching the criteria
The response is of type object
.
Was this page helpful?