获取特定交易#
根据 txHash 查询6个月内的某个交易的详情。
注意
 将一笔交易和其中的内部交易都分解成子交易,并根据变动的资产类型给出了不同的子交易类型:
 
 
 
0: 外层主链币转移 1: 合约内层主链币转移 2: token转移请求路径#
GET https://web3.okx.com/api/v6/dex/post-transaction/transaction-detail-by-txhash
请求参数#
| Parameter | Type | Required | Description | 
|---|---|---|---|
| chainIndex | String | 是 | 链唯一标识。(如 1代表Ethereum。更多可查看这里。) | 
| txHash | String | 是 | 交易哈希 | 
| itype | String | 否 | 交易的层级类型 0:外层主链币转移1:合约内层主链币转移2:token转移 | 
响应参数#
| Parameter | Type | Description | 
|---|---|---|
| chainIndex | String | 链的唯一标识 | 
| height | String | 交易发生的区块高度 | 
| txTime | String | 交易时间;Unix时间戳的毫秒数格式 | 
| txhash | String | 交易哈希 | 
| txStatus | String | 交易状态 1:pending 确认中2:success:成功3:fail:失败 | 
| gasLimit | String | gas限额 | 
| gasUsed | String | gas消耗 | 
| gasPrice | String | gas价格 | 
| txFee | String | 交易手续费 | 
| 否nce | String | 否nce | 
| amount | String | 交易数量 | 
| symbol | String | 交易数量对应的币种简称 | 
| methodId | String | 合约调用函数 | 
| fromDetails | Array | 交易输入详情 | 
| >address | String | 发送/输入地址 | 
| >vinIndex | String | 位于当前交易输入的序号 | 
| >preVoutIndex | String | 位于上一笔输出里的序号 | 
| >txhash | String | 交易哈希,和 prevoutIndex 一起唯一确认输入的 UTXO | 
| > isContract | Boolean | 发送地址是否是合约地址 true:是 ;false:否 | 
| > amount | String | 交易数量 | 
| toDetails | Array | 交易输出详情 | 
| >address | String | 接收/输出地址 | 
| >voutIndex | String | 输出的序号 | 
| > isContract | Boolean | 接收地址是否是合约地址 true:是 ;false:否 | 
| > amount | String | 交易数量 | 
| internalTransactionDetails | Array | 内部交易详情 | 
| > from | String | 交易发送方的地址 | 
| > to | String | 交易接受方的地址 | 
| > isFromContract | Boolean | from地址是否是合约地址 | 
| > isToContract | Boolean | to地址是否是合约地址 | 
| > amount | String | 交易数量 | 
| >txStatus | String | 交易状态 | 
| tokenTransferDetails | Array | 代币交易详情 | 
| > from | String | 交易发送方的地址 | 
| > to | String | 交易接受方的地址 | 
| > isFromContract | Boolean | from地址是否是合约地址 | 
| > isToContract | Boolean | to地址是否是合约地址 | 
| > tokenContractAddress | String | 代币合约地址 | 
| > symbol | String | 交易代币的简称 | 
| > amount | String | 交易数量 | 
| l1OriginHash | String | L1执行的交易哈希 | 
请求示例#
shell
curl --location --request GET 'https://web3.okx.com/api/v6/dex/post-transaction/transaction-detail-by-txhash?txHash=0x9ab8ccccc9f778ea91ce4c0f15517672c4bd06d166e830da41ba552e744d29a5&chainIndex=42161' \
--header 'Content-Type: application/json' \
--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'
响应示例#
200
{
    "code": "0",
    "msg": "success",
    "data": [
        {
            "chainIndex": "42161",
            "height": "245222398",
            "txTime": "1724253417000",
            "txhash": "0x9ab8ccccc9f778ea91ce4c0f15517672c4bd06d166e830da41ba552e744d29a5",
            "gasLimit": "2000000",
            "gasUsed": "2000000",
            "gasPrice": "10000000",
            "txFee": "",
            "nonce": "0",
            "symbol": "ETH",
            "amount": "0",
            "txStatus": "success",
            "methodId": "0xc9f95d32",
            "l1OriginHash": "0xa6a87ba2f18cc32bbae8f3b2253a29a9617ed1eb0940d80443f6e3bf9873dbad",
            "fromDetails": [
                {
                    "address": "0xd297fa914353c44b2e33ebe05f21846f1048cfeb",
                    "vinIndex": "",
                    "preVoutIndex": "",
                    "txHash": "",
                    "isContract": false,
                    "amount": ""
                }
            ],
            "toDetails": [
                {
                    "address": "0x000000000000000000000000000000000000006e",
                    "voutIndex": "",
                    "isContract": false,
                    "amount": ""
                }
            ],
            "internalTransactionDetails": [
                {
                    "from": "0x0000000000000000000000000000000000000000",
                    "to": "0xd297fa914353c44b2e33ebe05f21846f1048cfeb",
                    "isFromContract": false,
                    "isToContract": false,
                    "amount": "0.02",
                    "state": "success"
                },
                {
                    "from": "0xd297fa914353c44b2e33ebe05f21846f1048cfeb",
                    "to": "0x428ab2ba90eba0a4be7af34c9ac451ab061ac010",
                    "isFromContract": false,
                    "isToContract": false,
                    "amount": "0.00998",
                    "state": "success"
                },
                {
                    "from": "0xd297fa914353c44b2e33ebe05f21846f1048cfeb",
                    "to": "0x428ab2ba90eba0a4be7af34c9ac451ab061ac010",
                    "isFromContract": false,
                    "isToContract": false,
                    "amount": "0.009977946366846017",
                    "state": "success"
                }
            ],
            "tokenTransferDetails": []
        }
    ]
}
