cfx_getLogs
Returns logs matching the filter provided.
Params
(1)1. filter (required)
address
blockHashes
array[string] or null
fromBlock
string or null
Match pattern:
^0x([1-9a-f][0-9a-f]{0,15}|0)$
fromEpoch
toBlock
string or null
Match pattern:
^0x([1-9a-f][0-9a-f]{0,15}|0)$
toEpoch
topics
Result
(cfx_getLogs_result)array of:
address
stringMatch pattern:
^(NET\d+|CFX|CFXTEST)(:TYPE\..*|):[ABCDEFGHJKMNPRSTUVWXYZ0123456789]{42}$
blockHash
string or null
Match pattern:
^0x[0-9,a-f,A-F]{64}$
data
stringMatch pattern:
^0x[0-9a-f]*$
epochNumber
string or null
Match pattern:
^0x([1-9a-f][0-9a-f]{0,63}|0)$
logIndex
string or null
Match pattern:
^0x([1-9a-f][0-9a-f]{0,63}|0)$
space
Allowed values:
nativeethereum
topics
array[string]transactionHash
string or null
Match pattern:
^0x[0-9,a-f,A-F]{64}$
transactionIndex
string or null
Match pattern:
^0x([1-9a-f][0-9a-f]{0,63}|0)$
transactionLogIndex
string or null
Match pattern:
^0x([1-9a-f][0-9a-f]{0,63}|0)$
Examples
Request
curl -X POST --data \
'{
"method": "cfx_getLogs",
"params": [
{}
],
"jsonrpc": "2.0",
"id": 1
}' \
-H "Content-Type: application/json" \
localhost:12539
Result
{
"code": -32016,
"message": "Error processing request: Filter error: The gap between from_epoch and to_epoch is larger than max_gap (from: 70500000, to: 70587153, max_gap: 1000)"
}