EVM
eth_getLogs
Summary: Get logs
This request passes a set of search conditions and returns an array of all logs matching those.
Parameters
filter
object
Returns
eth_getLogsResponse
oneOf
Customize request
Parameter
Value
RequestCURL
CURL
curl https://linea-mainnet.infura.io/v3/<YOUR-API-KEY> \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_getLogs",
"params": [{"fromBlock":"0x4fde9d","toBlock":"0x4fde9d","address":"0xe5d7c2a44ffddf6b295a15c148167daaaf5cf34f","topics":[]}],
"id": 1
}'
Example response
{
"id": 1,
"jsonrpc": "2.0",
"result": [
{
"address": "0xe5d7c2a44ffddf6b295a15c148167daaaf5cf34f",
"blockHash": "0xd459570b5d2994a81ec1875b058f665b7f9c006172a8bd2860de87aee9569ac8",
"blockNumber": "0x4fde9d",
"data": "0x0000000000000000000000000000000000000000000000000b6139a7cbd20000",
"logIndex": "0x0",
"removed": false,
"topics": [
"0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c",
"0x00000000000000000000000000381fd3e1ca2a3758bb86983836c645ca0c1f4a"
],
"transactionHash": "0x962e545e8ac3caef02f251d175cb0519c14db387559bb5804e988e175b3bc6c4",
"transactionIndex": "0x1"
},
{
"address": "0xe5d7c2a44ffddf6b295a15c148167daaaf5cf34f",
"blockHash": "0xd459570b5d2994a81ec1875b058f665b7f9c006172a8bd2860de87aee9569ac8",
"blockNumber": "0x4fde9d",
"data": "0x000000000000000000000000000000000000000000000000001057acf5f78000",
"logIndex": "0x18",
"removed": false,
"topics": [
"0xe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c",
"0x000000000000000000000000fe6508f0015c778bdcc1fb5465ba5ebe224c9912"
],
"transactionHash": "0x1edcdbf205d33cb1f7f88eb58324f20aa32ad7af494ead208d7bc90762c304ea",
"transactionIndex": "0xa"
},
{
"address": "0xe5d7c2a44ffddf6b295a15c148167daaaf5cf34f",
"blockHash": "0xd459570b5d2994a81ec1875b058f665b7f9c006172a8bd2860de87aee9569ac8",
"blockNumber": "0x4fde9d",
"data": "0x000000000000000000000000000000000000000000000000001057acf5f78000",
"logIndex": "0x1a",
"removed": false,
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x000000000000000000000000fe6508f0015c778bdcc1fb5465ba5ebe224c9912",
"0x000000000000000000000000586733678b9ac9da43dd7cb83bbb41d23677dfc3"
],
"transactionHash": "0x1edcdbf205d33cb1f7f88eb58324f20aa32ad7af494ead208d7bc90762c304ea",
"transactionIndex": "0xa"
},
{
"address": "0xe5d7c2a44ffddf6b295a15c148167daaaf5cf34f",
"blockHash": "0xd459570b5d2994a81ec1875b058f665b7f9c006172a8bd2860de87aee9569ac8",
"blockNumber": "0x4fde9d",
"data": "0x00000000000000000000000000000000000000000000000000138a64211903b7",
"logIndex": "0x2a",
"removed": false,
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x000000000000000000000000e24b4a292ba102a9b7b7f9de20718d7ba45ddb29",
"0x000000000000000000000000d804ba88371a3f00ddaca03cbc2b6c47f38105fc"
],
"transactionHash": "0x3613dbdec4df03cd1efc903773ffad8703c8a6f902384299dc22e32bf3223fab",
"transactionIndex": "0x10"
}
]
}
Constraints
The following constraints apply:
To prevent queries from consuming too many resources, eth_getLogs
requests are currently limited by three constraints:
- A maximum of 5,000 parameters can be included in a single request.
- A maximum of 10,000 results can be returned by a single query.
- Query duration must not exceed 10 seconds.
If a query returns too many results or exceeds the max query duration, one of the following errors is returned:
{
"jsonrpc": "2.0",
"id": 1,
"error": {
"code": -32005,
"message": "query returned more than 10000 results"
}
}
or
{
"jsonrpc": "2.0",
"id": 1,
"error": {
"code": -32005,
"message": "query timeout exceeded"
}
}
If this happens:
- Limit your query to a smaller number of blocks using
fromBlock
andtoBlock
. - If querying for commonly used
topics
, consider limiting to a single smart contractaddress
.