Skip to main content

getLogs

Parameters

  • fromBlock : (string) OPTIONAL - Starting block for logs retrieval (default latest)
  • toBlock : (string) OPTIONAL - Ending block for logs retrieval (default latest)
  • blockHash : (string) - Block hash for retrieving all logs within a single block (equivalent to fromBlock = toBlock)
  • contractAddress :(string) OPTIONAL - The address of the log events sender contract
  • topic0 : (string) OPTIONAL - Topic hash to retrieve logs with
  • topic1 : (string) OPTIONAL - Topic hash to retrieve logs with
  • topic2 : (string) OPTIONAL - Topic hash to retrieve logs with
  • topic3 : (string) OPTIONAL - Topic hash to retrieve logs with
  • pageSize : (integer) OPTIONAL - Number of records to be retrieved on one page
  • pageKey : (string) OPTIONAL - Key used to get the next page of results. Must be set to the value of nextPageKey returned in the previous response

Returns

  • count: <integer> - The number of the logs returned
  • nextPageKey : <string> - Key to get the next page of results, if more results are available
  • logs: <array> - The array of Log objects
    • blockHash : <string> - The hash of the block containing the logs
    • blockNumber : <integer> - The height of the block containing the logs
    • blockTimestamp : <string> - The timestamp of the block containing the logs
    • transactionHash: <string>- Log transaction hash
    • transactionIndex: <integer> - Log transaction number
    • contractAddress : <string> - The address of the contract generating the log
    • topic0 : (string) - Topic to describe the log event, usually the first topic is the signature of the event name
    • topic1 : (string) - Topic to describe the log event
    • topic2 : (string) - Topic to describe the log event
    • topic3 : (string) - Topic to describe the log event
    • data: <string> - Additional data of the log event

Example Request and Result for getLogs

Request

curl --location 'https://eth-mainnet.blastapi.io/<project-id>/builder/getLogs?blockHash=0x248aac16904eb52e25ff4a594acbea314a216d5fc0968facb0c10366503aaab2'

Result

{
"count": 198,
"logs": [
{
"blockHash": "0x248aac16904eb52e25ff4a594acbea314a216d5fc0968facb0c10366503aaab2",
"blockNumber": 18375873,
"blockTimestamp": "2023-10-18T07:51:59.000Z",
"transactionHash": "0x2c40ee001352cfb73a2047c0ec71f016a1bd02e7fa2ed35adeaee46ca0c7719e",
"transactionIndex": 0,
"logIndex": 0,
"contractAddress": "0xf482d79ae6e8725c199213fc909d6bc30df62815",
"topic0": "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"topic1": "0x000000000000000000000000e65f60ae20998b6cb2d2a6edb2e551843e7bb816",
"topic2": "0x000000000000000000000000c99d5ae8a7c36325294c2424928bd776ab63f8b7",
"data": "0x000000000000000000000000000000000000000000000000007e5196c1911e00"
},
{
"blockHash": "0x248aac16904eb52e25ff4a594acbea314a216d5fc0968facb0c10366503aaab2",
"blockNumber": 18375873,
"blockTimestamp": "2023-10-18T07:51:59.000Z",
"transactionHash": "0x9befb89d0180358d300180c24530d9a16382ef770ec3eddab641e878d71d64e6",
"transactionIndex": 1,
"logIndex": 1,
"contractAddress": "0x9b1f3625980e6acb153da8b06235923845ecca01",
"topic0": "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"topic1": "0x000000000000000000000000e29a909a294896c167adc29a05681ff987a1d145",
"topic2": "0x000000000000000000000000ca53029a981a807c78c7cde496c5b52ef4532445",
"data": "0x00000000000000000000000000000000000000000000000000000003866a1100"
},
```