Get Logs By Block And Address#
Query the transaction event logs by block height and address, only returns nearly 1000 results.
Request Path#
GET
https://web3.okx.com/api/v5/xlayer/log/by-block-and-addressRequest Parameters#
| Parameter | Type | Required | Description |
|---|---|---|---|
| chainShortName | String | Yes | The abbreviated name of the blockchain network, e.g, XLAYER |
| startBlockHeight | String | Yes | The start block height for the search |
| endBlockHeight | String | Yes | The end block height for the search |
| address | String | Yes | The smart contract address that triggered the event log |
Response Parameters#
| Parameter | Type | Description |
|---|---|---|
| height | String | Block height |
| address | String | The smart contract address that triggered the event log |
| topics | Array | The topics of the event log |
| data | String | The non-indexed parameter of the event |
| blockHash | String | Block hash |
| methodId | String | Method ID |
| transactionTime | String | The Unix timestamp of the transaction time, in milliseconds format, e.g., 1597026383085 |
| logIndex | String | The location index of the event log in the block |
| txId | String | Transaction hash |
Request Example#
shell
curl --location --request GET 'https://web3.okx.com/api/v5/xlayer/log/by-block-and-address?chainShortName=xlayer&startBlockHeight=31276750&endBlockHeight=31276774&address=0x1e4a5963abfd975d8c9021ce480b42188849d41d' \
--header 'OK-ACCESS-KEY: 37c541a1-****-****-****-10fe7a038418' \
--header 'OK-ACCESS-SIGN: leaV********3uw=' \
--header 'OK-ACCESS-PASSPHRASE: 1****6' \
--header 'OK-ACCESS-TIMESTAMP: 2023-10-18T12:21:41.274Z'
Response Example#
json
{
"code": "0",
"msg": "",
"data": [
{
"height": "31276755",
"address": "0x1e4a5963abfd975d8c9021ce480b42188849d41d",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x00000000000000000000000047e0ae1ec92e0f991b2e8ebdfffa4fee951b88ec",
"0x000000000000000000000000c71f9e1de80eb505c0cb3bbf90ae6593130e5d25"
],
"data": "0x00000000000000000000000000000000000000000000000000000000001e8480",
"methodId": "0x9871efa4",
"blockHash": "0xcee678998e2adee0aaad139f0cc2e355773641e56631a924d4ea65043179cc5e",
"transactionTime": "1755569518000",
"logIndex": "1",
"txId": "0x154f79639fa6592cb0b56819143e1a31a08a9f71516a7fc2ebc7309c5588e4e8"
}
]
}
