Returns an array of all logs matching filter with given id.
The execution of this API can be limited by two node configurations to manage resources of Klaytn node safely.
- The number of maximum returned results in a single query (Default: 10,000).
- The execution duration limit of a single query (Default: 10 seconds).
Supported on Klaytn (mainnet) only.
Parameters
Request
Name | Type | Description |
---|---|---|
QUANTITY | string | The filter id |
Result
Array
- Array of log objects, or an empty array if nothing has changed since last poll.
- For filters created with klay_newBlockFilter, the return are block hashes (32-byte DATA),
e.g.,["0x3454645634534..."]
. - For filters created with klay_newPendingTransactionFilter, the return are transaction
hashes (32-byte DATA), e.g.,["0x6345343454645..."]
. - For filters created with klay_newFilter, logs are objects with following parameters:
Name | Type | Description |
---|---|---|
removed | TAG | true when the log was removed, due to a chain reorganization. false if it is a valid log. |
logIndex | QUANTITY | Integer of the log index position in the block. null when it is a pending log. |
transactionIndex | QUANTITY | Integer of the transactions index position log was created from. null when pending. |
transactionHash | 32-byte DATA | Hash of the transactions this log was created from. null when pending. |
blockHash | 32-byte DATA | Hash of the block where this log was in. null when pending. |
blockNumber | QUANTITY | The block number where this log was in. null when pending. |
address | 20-byte DATA | Address from which this log originated. |
data | DATA | Contains the non-indexed arguments of the log. |
topics | Array of DATA | Array of 0 to 4 32-byte DATA of indexed log arguments. (In Solidity: The first topic is the hash of the signature of the event (e.g., Deposit(address,bytes32,uint256) ), except you declared the event with the anonymous specifier.). |
API Endpoint
The format of a Klaytn API endpoint is
https://open-platform.nodereal.io/{{apiKey}}/klaytn/
Here is an example:
https://open-platform.nodereal.io/4c0a1c23661a4e26bcbcwed461e34ea9/klaytn/
Example
// Request
curl https://open-platform.nodereal.io/{{apiKey}}/klaytn/ \
-X POST \
-H "Content-Type: application/json" \
--data '{"jsonrpc":"2.0","method":"klay_getFilterLogs","params":["0xd32fd16b6906e67f6e2b65dcf48fc272"],"id":1}'
// Result
{
"jsonrpc":"2.0",
"id":1,
"result":[{
"address":"0x87ac99835e67168d4f9a40580f8f5c33550ba88b",
"topics":["0xd596fdad182d29130ce218f4c1590c4b5ede105bee36690727baa6592bd2bfc8"],
"data":"0x0000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000007b",
"blockNumber":"0x54",
"transactionHash":"0xcd4703cd62bd930d4652999bce8dcb75b7ade49d922fa42dc11e568c52a5fa6f",
"transactionIndex":"0x0",
"blockHash":"0x9a49f30f1d1876ff3913bd0aa58f328822e7a369cb13e0640b82234f26e781bb",
"logIndex":"0x0",
"removed":false
}]
}