批量获取交易详情#
根据交易哈希批量查询交易基础明细,单次最多传入 20 个交易哈希(逗号分隔,重复哈希自动去重),结果以平铺数组返回,不分页。本接口仅支持 EVM 系公链。
支持的链:见获取交易 API 支持的链(apiName:transaction-multi)。
请求地址#
GET
https://web3.okx.com/api/v6/explorer/transaction/transaction-multi请求参数#
| 参数名 | 类型 | 是否必填 | 描述 |
|---|---|---|---|
| chainIndex | String | 是 | 链唯一标识,如 ETH 为 1、BTC 为 0;支持范围见获取交易 API 支持的链 |
| txId | String | 是 | 交易哈希,多笔交易用逗号分隔,最多 20 笔;重复哈希自动去重 |
响应参数#
| 参数名 | 类型 | 描述 |
|---|---|---|
| txId | String | 交易哈希 |
| methodId | String | 方法 ID;非合约调用时为空串 |
| blockHash | String | 区块哈希 |
| height | String | 交易发生的区块高度 |
| transactionTime | String | 交易时间;Unix 毫秒时间戳 |
| from | String | 发送方地址 |
| to | String | 接收方地址 |
| isFromContract | Boolean | From 地址是否是合约地址 |
| isToContract | Boolean | To 地址是否是合约地址 |
| amount | String | 交易数量 |
| symbol | String | 交易数量对应的币种 |
| nonce | String | 发起者地址发起的第几笔交易 |
| txFee | String | 手续费 |
| gasPrice | String | gas 价格 |
| gasLimit | String | gas 限额 |
| gasUsed | String | gas 消耗 |
| state | String | 交易状态:success 成功;fail 失败;pending 等待确认 |
| transactionType | String | 交易类型 |
请求示例#
shell
curl --location --request GET 'https://web3.okx.com/api/v6/explorer/transaction/transaction-multi?chainIndex=1&txId=0x1e4996d90e77ee87f6a1a2a071603ee5d55d6dd7b272209b741ff276f4a1c34c,0x8e2fbf59e7ffbc0d5cbb2a6e903824adecc9d2a5b78539e0bce9db32adfd85c9' \
--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'
响应示例#
json
{
"code": "0",
"msg": "",
"data": [
{
"txId": "0x1e4996d90e77ee87f6a1a2a071603ee5d55d6dd7b272209b741ff276f4a1c34c",
"methodId": "0xa9059cbb",
"blockHash": "0x7c1f0d95cbc7c4c018daae6cf3cf4ffef4dee62dfc9444838f4c5122a4899c9f",
"height": "18126486",
"transactionTime": "1694991899000",
"from": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"to": "0xdac17f958d2ee523a2206206994597c13d831ec7",
"isFromContract": false,
"isToContract": true,
"amount": "0",
"symbol": "ETH",
"nonce": "1057",
"txFee": "0.001222264816491852",
"gasPrice": "26510970622",
"gasLimit": "63209",
"gasUsed": "46106",
"state": "success",
"transactionType": "2"
},
{
"txId": "0x8e2fbf59e7ffbc0d5cbb2a6e903824adecc9d2a5b78539e0bce9db32adfd85c9",
"methodId": "",
"blockHash": "0x2b6cbc4bb2b6f52e7a2c11d4a9762dcefb985dbd6448bd41ce00cf50c02fca92",
"height": "18126501",
"transactionTime": "1694992079000",
"from": "0xd8da6bf26964af9d7eed9e03e53415d37aa96045",
"to": "0x282edab8a933bc1c02649fe3ea2842ecb8e26183",
"isFromContract": false,
"isToContract": false,
"amount": "0.5",
"symbol": "ETH",
"nonce": "1058",
"txFee": "0.000549084273462",
"gasPrice": "26147822546",
"gasLimit": "21000",
"gasUsed": "21000",
"state": "success",
"transactionType": "2"
}
]
}
