Returns an array of all logs matching a given filter object.
Request
curl 'https://rpc.web3api.io?x-api-key=YOUR-API-KEY' \
-X POST \
-H 'x-amberdata-blockchain-id: ethereum-mainnet' \
-d '{"jsonrpc":"2.0","id":1,"method":"eth_getLogs","params":[{"blockHash":"0x7c5a35e9cb3e8ae0e221ab470abae9d446c3a5626ce6689fc777dcffcab52c70","topics":["0x241ea03ca20251805084d27d4440371c34a0b85ff108f6bb5611248f73818b80"]}]}'
Field | Description |
---|---|
fromBlock | The integer block number, or "latest" for the last mined block or "pending", "earliest" for not yet mined transactions. |
fromBlock | The integer block number, or "latest" for the last mined block or "pending", "earliest" for not yet mined transactions. |
address | The contract address or a list of addresses from which logs should originate. |
topics | The Array of 32 Bytes topics.Topics are order-dependent. Each topic can also be an array of DATA with "or" options. |
blockhash | 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. |
Response
{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"address": "0x1a94fce7ef36bc90959e206ba569a12afbc91ca1",
"topics": [
"0x241ea03ca20251805084d27d4440371c34a0b85ff108f6bb5611248f73818b80"
],
"data": "0x00000000000000...",
"blockNumber": "0x5c29fb",
"transactionHash": "0x3dc91b98249fa9f2c5c37486a2427a3a7825be240c1c84961dfb3063d9c04d50",
"transactionIndex": "0x1d",
"blockHash": "0x7c5a35e9cb3e8ae0e221ab470abae9d446c3a5626ce6689fc777dcffcab52c70",
"logIndex": "0x1d",
"removed": false
},
...
]
}
Field | Description |
---|---|
result | The Array of log objects, or an empty array if nothing has changed since last poll. |
address | The address from which this log originated. |
topics | The Array of 0 to 4 32 Bytes of indexed log arguments. (In solidity: The first topic is the hash of the signature of the event (e.g. |
data | The non-indexed arguments of the log. |
blockNumber | The block number where this log was in. null when its pending. null when its pending log. |
transactionIndex | The integer of the transactions index position log was created from. null when its pending log. |
blockHash | The hash of the block where this log was in. null when its pending. null when its pending log. |
logIndex | The integer of the log index position in the block. null when its pending log. |
removed | true when the log was removed, due to a chain reorganization. false if its a valid log. |