eth_getFilterChanges - Ethereum

A data collecting method that shows a logs array appeared since last data collection

How to Use the eth_getFilterChanges Method

Parameters

QUANTITY - an id of the filter.

What you receive

Array which contains log objects. In case if nothing has changed since the last poll you’ll receive an empty one.

  • If filters were created via eth_newBlockFilter the outcome is block hashes (DATA, 32 Bytes), such as ["0x3454645634534..."].

  • If filters were created via eth_newPendingTransactionFilter the outcome is transaction hashes (DATA, 32 Bytes), e.g. ["0x6345343454645..."].

  • If filters were created via eth_newFilter logs will be presented as objects with parameters stated below:

    • removed: TAG - true in case of the log removal, because of a chain reorganization. false if it's an existing actual log.

    • logIndex: QUANTITY - the log index position presented as an integer. returns null in case of a pending log.

    • transactionIndex: QUANTITY - the transactions index position log was created from, has an integer form. null in case of a pending log.

    • transactionHash: DATA, 32 Bytes - transactions’ hash that has created this log. returns null in case of a pending log.

    • blockHash: DATA, 32 Bytes - the block’s hash where this log was located. returns null in case of a pending log.

    • blockNumber: QUANTITY - the block’s number where this log was located. returns null in case of a pending log.

    • address: DATA, 20 Bytes - the log’s origination address.

    • data: DATA - a param with the log’s non-indexed arguments.

    • topics: Array of DATA - contains from 0 to 4 32 Bytes DATA with indexed log arguments. (In solidity: The first topic is the hash of the signature of the event (such as Deposit(address,bytes32,uint256)), unless the event declaration is with the anonymous specifier.)

Sample

Here is a typical appliance example.

Call

curl https://eth-mainnet.rpcfast.com/?api_key=<key> \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"eth_getFilterChanges","params":["0xd1bdcf5b6141c7ec379531c851cb91d3"],"id":1}'

Outcome

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [{
    "logIndex": "0x1", // 1
    "blockNumber":"0x1b4", // 436
    "blockHash": "0x8216c5785ac562ff41e2dcfdf5785ac562ff41e2dcfdf829c5a142f1fccd7d",
    "transactionHash":  "0xdf829c5a142f1fccd7d8216c5785ac562ff41e2dcfdf5785ac562ff41e2dcf",
    "transactionIndex": "0x0", // 0
    "address": "0x16c5785ac562ff41e2dcfdf829c5a142f1fccd7d",
    "data":"0x0000000000000000000000000000000000000000000000000000000000000000",
    "topics": ["0x59ebeb90bc63057b6515673c3ecf9438e5058bca0f92585014eced636878c9a5"]
    },{
      ...
    }]
}

Last updated