Get Logs By Address And Topic#
Query the transaction event logs by address and topic0, only returns nearly 1000 results.
Request Path#
GET
https://web3.okx.com/api/v5/xlayer/log/by-address-and-topicRequest Parameters#
| Parameter | Type | Required | Description |
|---|---|---|---|
| chainShortName | String | Yes | The abbreviated name of the blockchain network, e.g, XLAYER |
| address | String | Yes | The smart contract address that triggered the event log |
| topic0 | String | Yes | The topic0 of 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-address-and-topic?chainShortName=xlayer&address=0x69c236e021f5775b0d0328ded5eac708e3b869df&topic0=0x1bb43f2da90e35f7b0cf38521ca95a49e68eb42fac49924930a5bd73cdf7576c' \
--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": "31128669",
"address": "0x69c236e021f5775b0d0328ded5eac708e3b869df",
"topics": [
"0x1bb43f2da90e35f7b0cf38521ca95a49e68eb42fac49924930a5bd73cdf7576c"
],
"data": "0x000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000e538905cf8410324e03a5a23c1c177a474d59b2b0000000000000000000000007bed4ac3a43fab89e3f8ab7710ed8d0f44d72a53000000000000000000000000000000000000000000000000016345785d8a0000000000000000000000000000000000000000000000000000016345785d8a0000",
"methodId": "0x01617fab",
"blockHash": "0x4dd5ef469cc2a28be3a39b2ace1711bc747ac3487ab9d05dc53bfff03dc470a7",
"transactionTime": "1755489505000",
"logIndex": "4",
"txId": "0xd1f0fd77b4aa0493a0ab85b199b79644aeeb8f47ef05ec72a44310695c8d07eb"
}
]
}
