Saltar al contenido principal

cfx_getLogs

Returns logs matching the filter provided.

filter

blockHashes

topics

curl --request POST \
--url https://main.confluxrpc.com \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"id": 1,
"jsonrpc": "2.0",
"params": [{}],
"method": "cfx_getLogs"
}'

Params

filter required

Schema
type : object
  • address address
    oneOf
    type : string
    Pattern : ^(NET\d+|CFX|CFXTEST)(:TYPE\..*|):[ABCDEFGHJKMNPRSTUVWXYZ0123456789]{42}$
  • blockHashes blockHashes
    type : array
    • items[x] H256
      type : string
      Pattern : ^0x[0-9,a-f,A-F]{64}$
  • fromBlock fromBlock
    type : string
    Pattern : ^0x([1-9a-f][0-9a-f]{0,15}|0)$
  • fromEpoch fromEpoch
    oneOf
    type : string
    Pattern : ^0x([1-9a-f][0-9a-f]{0,15}|0)$
  • toBlock toBlock
    type : string
    Pattern : ^0x([1-9a-f][0-9a-f]{0,15}|0)$
  • toEpoch toEpoch
    oneOf
    type : string
    Pattern : ^0x([1-9a-f][0-9a-f]{0,15}|0)$
  • topics topics
    type : array
    • items[x] H256 XOR (H256,...)[]
      oneOf
      type : string
      Pattern : ^0x[0-9,a-f,A-F]{64}$

Result

Schema
type : array
  • items[x] object
    type : object
    • address address
      type : string
      Pattern : ^(NET\d+|CFX|CFXTEST)(:TYPE\..*|):[ABCDEFGHJKMNPRSTUVWXYZ0123456789]{42}$
    • blockHash blockHash
      type : string
      Pattern : ^0x[0-9,a-f,A-F]{64}$
    • data data
      type : string
      Pattern : ^0x[0-9a-f]*$
    • epochNumber epochNumber
      type : string
      Pattern : ^0x([1-9a-f][0-9a-f]{0,63}|0)$
    • logIndex logIndex
      type : string
      Pattern : ^0x([1-9a-f][0-9a-f]{0,63}|0)$
    • space space
      type : string
      Possible values : 
      • native
      • ethereum
    • topics topics
      type : array
      • items[x] H256
        type : string
        Pattern : ^0x[0-9,a-f,A-F]{64}$
    • transactionHash transactionHash
      type : string
      Pattern : ^0x[0-9,a-f,A-F]{64}$
    • transactionIndex transactionIndex
      type : string
      Pattern : ^0x([1-9a-f][0-9a-f]{0,63}|0)$
    • transactionLogIndex transactionLogIndex
      type : string
      Pattern : ^0x([1-9a-f][0-9a-f]{0,63}|0)$

Examples

Request

curl -X POST --data \
'{
"jsonrpc": "2.0",
"id": 1,
"method": "cfx_getLogs",
"params": [
{}
]
}' \
-H "Content-Type: application/json" \
localhost:12539

Response

{
"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)"
}