klay_getLogs

Returns an array of all logs matching a given filter object.

The execution of this API can be limited by two node configurations to manage resources of Klaytn node safely.

Parameters

Object - The filter options:

NameTypeDescription

fromBlock

QUANTITY | TAG

(optional, default: "latest") Integer or hexadecimal block number, or the string "earliest", "latest" or "pending"

toBlock

QUANTITY | TAG

(optional, default: "latest") Integer or hexadecimal block number, or the string "earliest", "latest" or "pending"

address

20-byte DATA | Array

(optional) Contract address or a list of addresses from which logs should originate.

topics

Array of DATA

(optional) Array of 32-byte DATA topics. Topics are order-dependent. Each topic can also be an array of DATA with β€œor” options.

blockHash

32-byte DATA

(optional) A filter option that 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 in the filter criteria, then neither fromBlock nor toBlock are allowed.

The block range of klay_getLogs is limited to 1024. Requests with blocks over this range will get an error.

Return Value

See klay_getFilterChanges

Example

// Request
curl -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"klay_getLogs","params":[{"fromBlock":"0x1","toBlock":"latest"