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 contracttopic0:(string)OPTIONAL - Topic hash to retrieve logs withtopic1:(string)OPTIONAL - Topic hash to retrieve logs withtopic2:(string)OPTIONAL - Topic hash to retrieve logs withtopic3:(string)OPTIONAL - Topic hash to retrieve logs withpageSize:(integer)OPTIONAL - Number of records to be retrieved on one pagepageKey:(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 returnednextPageKey:<string>- Key to get the next page of results, if more results are availablelogs:<array>- The array of Log objectsblockHash:<string>- The hash of the block containing the logsblockNumber:<integer>- The height of the block containing the logsblockTimestamp:<string>- The timestamp of the block containing the logstransactionHash:<string>- Log transaction hashtransactionIndex:<integer>- Log transaction numbercontractAddress:<string>- The address of the contract generating the logtopic0:(string)- Topic to describe the log event, usually the first topic is the signature of the event nametopic1:(string)- Topic to describe the log eventtopic2:(string)- Topic to describe the log eventtopic3:(string)- Topic to describe the log eventdata:<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"
},
```