查询特定 Tx#
根据 txHash 查询某个交易的详情。
注意
钱包 API 将一笔交易和其中的内部交易都分解成子交易,并根据变动的资产类型给出了不同的子交易类型:
 
 
 
0: 外层主链币转移 1: 合约内层主链币转移 2: token转移请求路径#
GET https://web3.okx.com/api/v5/wallet/post-transaction/transaction-detail-by-txhash
请求参数#
| Parameter | Type | Required | Description | 
|---|---|---|---|
| chainIndex | String | Yes | 链唯一标识 | 
| txHash | String | Yes | 交易哈希 | 
| iType | String | No | EVM 交易的层级类型 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 | 交易手续费 | 
| nonce | String | nonce | 
| 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/v5/wallet/post-transaction/transaction-detail-by-txhash?txHash=0x9ab8ccccc9f778ea91ce4c0f15517672c4bd06d166e830da41ba552e744d29a5&chainIndex=42161' \
--header 'Content-Type: application/json' \
--header 'OK-ACCESS-PROJECT: 86af********d1bc' \
--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
以 ETH 为例
{
    "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": []
        }
    ]
}
以 BTC 为例
{
    "code": "0",
    "msg": "success",
    "data": [
        {
            "chainIndex": "0",
            "height": "858056",
            "txTime": "1724403746000",
            "txhash": "0538eec298699ff4b7cc07163c7216c48fe40caed492a3c655382bf0ae63db1a",
            "gasLimit": "",
            "gasUsed": "",
            "gasPrice": "",
            "txFee": "",
            "nonce": "",
            "symbol": "BTC",
            "amount": "",
            "txStatus": "success",
            "methodId": "",
            "l1OriginHash": "",
            "fromDetails": [
                {
                    "address": "bc1py4kmmdsae08zd6jlfdkcr9gzagxrs3z5elw2hjyc5u883a8ah7ps98s0mn",
                    "vinIndex": "0",
                    "preVoutIndex": "1",
                    "txHash": "b7b1460db2e7fff53cb1da10ad5351bd9a684668f21968a6b292dfe019605c4c",
                    "isContract": false,
                    "amount": "0.00001296"
                }
            ],
            "toDetails": [
                {
                    "address": "bc1p7pgnqe87red4cvd7ml6rh9pl9ufpr522k2y3dpeyrvfc6g2g3r3s3ae9dr",
                    "voutIndex": "0",
                    "isContract": false,
                    "amount": "0.00000546"
                }
            ],
            "internalTransactionDetails": [],
            "tokenTransferDetails": []
        }
    ]
}
