Returns an array of all logs that match the given filter object.
Starting with GreatVoyage-v4.8.2, each log also contains blockTimestamp, the block's Unix timestamp in seconds returned as a hexadecimal string following the JSON-RPC QUANTITY rules. By default, a node limits the queried block span to 5000; this limit is configured by node.jsonrpc.maxBlockRange, while hosted gateways may use different limits.
Parameters
-
Object- The filter options, which include the following fields:Field Type Description fromBlockQUANTITY|TAG(optional, default: "latest") The block number from which to start searching. Supportslatest,earliest, andfinalized; does not supportpendingorsafe.toBlockQUANTITY|TAG(optional, default: "latest") The block number at which to stop searching. Supports the same tags asfromBlock.addressDATA|Array, 20 Bytes(optional) A contract address or a list of addresses from which logs should originate. topicsDATA[](optional) An array of 32-byte DATA topics. Topics are order-dependent. Each topic may also be an array of DATA representing "or" options. blockHashDATA, 32 Bytes(optional) Restricts the logs returned to a single block identified by this 32-byte hash. Using blockHashis equivalent to settingfromBlockandtoBlockto the block number of the referenced block. IfblockHashis provided,fromBlockandtoBlockmust not be included.
The address array contains at most 1000 entries by default. topics contains at most four positions, and each position contains at most 1000 OR candidates by default. Exceeding the corresponding maxAddressSize or maxSubTopics setting returns JSON-RPC error -32602.
Example
Request
curl -X POST 'https://api.shasta.trongrid.io/jsonrpc' --data '{"jsonrpc":"2.0","method":"eth_getLogs","params":[{"address":["cc2e32f2388f0096fae9b055acffd76d4b3e5532","E518C608A37E2A262050E10BE0C9D03C7A0877F3"],"fromBlock":"0x989680","toBlock":"0x9959d0","topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",null,["0x0000000000000000000000001806c11be0f9b9af9e626a58904f3e5827b67be7","0x0000000000000000000000003c8fb6d064ceffc0f045f7b4aee6b3a4cefb4758"]]}],"id":1}'Response
{
"jsonrpc": "2.0",
"id": 1,
"result": []
}