Logs

The Event Log API was designed to provide an alternative to the native eth_getLogs.

Below are the list of supported filter parameters:

  • fromBlock, toBlock, address

  • topic0, topic1, topic2, topic3 (32 Bytes per topic)

  • topic0_1_opr (and|or between topic0 & topic1), topic1_2_opr (and|or between topic1 & topic2), topic2_3_opr (and|or between topic2 & topic3), topic0_2_opr (and|or between topic0 & topic2), topic0_3_opr (and|or between topic0 & topic3), topic1_3_opr (and|or between topic1 & topic3)

  • FromBlock & ToBlock accepts the blocknumber (integer, NOT hex) or 'latest' (earliest & pending is NOT supported yet)

  • Topic Operator (opr) choices are either 'and' or 'or' and are restricted to the above choices only

  • FromBlock & ToBlock parameters are required

  • An address and/or topic(X) parameters are required, when multiple topic(X) parameters are used the topicX_X_opr (and|or operator) is also required

For performance & security considerations, only the first 1000 results are return. So please narrow down the filter parameters.

Sample Log API Queries

Get Event Logs from block number 22775666 to 22776666 Block, where log address = 0x0000000000000000000000000000000000001010 and topic[0] = 0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63

https://api.bttcscan.com/api
   ?module=logs
   &action=getLogs
   &fromBlock=22775666
   &toBlock=22776666
   &address=0x0000000000000000000000000000000000001010
   &topic0=0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63
   &apikey=YourApiKeyToken

Get Event Logs from block number 22736744 to block 22737744, where log address = 0x0000000000000000000000000000000000001010, topic[0] = 0xebff2602b3f468259e1e99f613fed6691f3a6526effe6ef3e768ba7ae7a36c4f'AND' topic[1] = 0x000000000000000000000000032017411f4663b317fe77c257d28d5cd1b26e3d

https://api.bttcscan.com/api
   ?module=logs
   &action=getLogs
   &fromBlock=22736744
   &toBlock=22737744
   &address=0x0000000000000000000000000000000000001010
   &topic0=0xebff2602b3f468259e1e99f613fed6691f3a6526effe6ef3e768ba7ae7a36c4f
   &topic0_1_opr=and
   &topic1=0x000000000000000000000000032017411f4663b317fe77c257d28d5cd1b26e3d
   &apikey=YourApiKeyToken

Last updated