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)

Some parameters to take note of 📝

  • 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 1092029 to 'latest' , where log address = 0x55d8b3c663f35552c067399089f3dd54d6a1c584and topic[0] = 0x23b9387f81fca646aac1dc4487ede045c65f5f7445482906565f01e05afdb3a8

https://api-moonbase.moonscan.io/api
   ?module=logs
   &action=getLogs
   &fromBlock=1092029
   &toBlock=latest
   &address=0x55d8b3c663f35552c067399089f3dd54d6a1c584
   &topic0=0x23b9387f81fca646aac1dc4487ede045c65f5f7445482906565f01e05afdb3a8
   &apikey=YourApiKeyToken

Try this endpoint in your browser 🔗

Get Event Logs from block number 1092029 to 'latest' , where log address = 0x1bfa3b5e9be2c5298b7de11b5acb08c37683f4efand topic[0] = 0x8b1f889addbfa41db5227bae3b091bd5c8b9a9122f874dfe54ba2f75aabe1f4c'AND' topic[1] = 0x0000000000000000000000000000000000000000000000000000000000000001

https://api-moonbase.moonscan.io/api
   ?module=logs
   &action=getLogs
   &fromBlock=1089604
   &toBlock=latest
   &address=0x1bfa3b5e9be2c5298b7de11b5acb08c37683f4ef
   &topic0=0x8b1f889addbfa41db5227bae3b091bd5c8b9a9122f874dfe54ba2f75aabe1f4c
   &topic0_1_opr=and
   &topic1=0x0000000000000000000000000000000000000000000000000000000000000001
   &apikey=YourApiKeyToken

Try this endpoint in your browser 🔗

Last updated