Powered By GitBook
eth_getLogs
Returns an array of all logs matching a given filter object. For more information about eth_getLogs check out our Deep Dive into eth_getLogs page.
NOTE: You can make eth_getLogs requests with up to a 2K block range and 150MB limit on the response size. You can also request any block range with a cap of 10K logs in the response.
If you need to pull logs frequently, we recommend using WebSockets to push new logs to you when they are available

Parameters

Object - The filter options:
    fromBlock: QUANTITY|TAG - (optional, default: "latest") Value:
      Integer block number
      "latest" for the last mined block
      "pending", "earliest" for not yet mined transactions.
    toBlock: QUANTITY|TAG - (optional, default: "latest") Value:
      Integer block number
      "latest" for the last mined block
      "pending", "earliest" for not yet mined transactions.
    address: DATA|Array, 20 Bytes - (optional) Contract address or a list of addresses from which logs should originate.
    topics: Array of DATA, - (optional) Array of 32 Bytes DATA topics.
      Topics are order-dependent. Each topic can also be an array of DATA with "or" options.
      Check out more details on how to format topics in eth_newFilter.
    blockHash: DATA, 32 Bytes - (optional) With the addition of EIP-234 (Geth >= v1.8.13 or Parity >= v2.1.0), blockHash is a new filter option which restricts the logs returned to the single block with the 32-byte hash blockHash. Using blockHash is equivalent to fromBlock = toBlock = the block number with hash blockHash. If blockHash is present in the filter criteria, then neither fromBlock nor toBlock are allowed.
1
params: [
2
{
3
"address": "0xb59f67a8bff5d8cd03f6ac17265c550ed8f33907",
4
"topics": [
5
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
6
],
7
"blockHash": "0x8243343df08b9751f5ca0c5f8c9c0460d8a9b6351066fae0acbd4d3e776de8bb"
8
}
9
]
Copied!

Returns

Example
Request
Curl
Postman
1
curl https://eth-mainnet.alchemyapi.io/v2/your-api-key \
2
-X POST \
3
-H "Content-Type: application/json" \
4
-d '{"jsonrpc":"2.0","method":"eth_getLogs","params":[{"address": "0xb59f67a8bff5d8cd03f6ac17265c550ed8f33907","topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"],"blockHash": "0x8243343df08b9751f5ca0c5f8c9c0460d8a9b6351066fae0acbd4d3e776de8bb"}],"id":0}'
Copied!
1
URL: https://eth-mainnet.alchemyapi.io/v2/your-api-key
2
RequestType: POST
3
Body:
4
{
5
"jsonrpc":"2.0",
6
"method":"eth_getLogs",
7
"params":[{"address": "0xb59f67a8bff5d8cd03f6ac17265c550ed8f33907","topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"],"blockHash": "0x8243343df08b9751f5ca0c5f8c9c0460d8a9b6351066fae0acbd4d3e776de8bb"}],
8
"id":0
9
}
Copied!
Result
1
{
2
"jsonrpc": "2.0",
3
"id": 0,
4
"result": [
5
{
6
"address": "0xb59f67a8bff5d8cd03f6ac17265c550ed8f33907",
7
"topics": [
8
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
9
"0x00000000000000000000000000b46c2526e227482e2ebb8f4c69e4674d262e75",
10
"0x00000000000000000000000054a2d42a40f51259dedd1978f6c118a0f0eff078"
11
],
12
"data": "0x000000000000000000000000000000000000000000000000000000012a05f200",
13
"blockNumber": "0x429d3b",
14
"transactionHash": "0xab059a62e22e230fe0f56d8555340a29b2e9532360368f810595453f6fdd213b",
15
"transactionIndex": "0xac",
16
"blockHash": "0x8243343df08b9751f5ca0c5f8c9c0460d8a9b6351066fae0acbd4d3e776de8bb",
17
"logIndex": "0x56",
18
"removed": false
19
}
20
]
21
}
Copied!
Last modified 17d ago
Copy link