eth_getLogs

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"]}]}'
FieldDescription
fromBlockThe integer block number, or "latest" for the last mined block or "pending", "earliest" for not yet mined transactions.
fromBlockThe integer block number, or "latest" for the last mined block or "pending", "earliest" for not yet mined transactions.
addressThe contract address or a list of addresses from which logs should originate.
topicsThe Array of 32 Bytes topics.Topics are order-dependent. Each topic can also be an array of DATA with "or" options.
blockhashWith 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
        },
        ...
    ]
}
FieldDescription
resultThe Array of log objects, or an empty array if nothing has changed since last poll.
addressThe address from which this log originated.
topicsThe 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.
dataThe non-indexed arguments of the log.
blockNumberThe block number where this log was in. null when its pending. null when its pending log.
transactionIndexThe integer of the transactions index position log was created from. null when its pending log.
blockHashThe hash of the block where this log was in. null when its pending. null when its pending log.
logIndexThe integer of the log index position in the block. null when its pending log.
removedtrue when the log was removed, due to a chain reorganization. false if its a valid log.