Get Specific Transaction#
Retrieve details of a transaction based on txHash for 6 months. It decomposes a transaction and its internal transactions into sub-transactions based on asset type:
0: Outer layer mainnet coin transfer
1: Inner layer mainnet coin transfer in a contract
2: Token transfer
Note
It decomposes a transaction into sub-transactions based on asset type. For EVM transactions, different sub-transaction types include:
0: Outer layer mainnet coin transfer 1: Inner layer mainnet coin transfer in a contract 2: Token transferRequest URL#
GET https://web3.okx.com/api/v6/dex/post-transaction/transaction-detail-by-txhash
Request Parameters#
| Parameter | Type | Required | Description |
|---|---|---|---|
| chainIndex | String | Yes | Unique identifier for the chain |
| txHash | String | Yes | Transaction hash |
| itype | String | No | Layer type for transactions 0: Outer layer mainnet coin transfer 1: Inner layer mainnet coin transfer 2: Token transfer |
Response Parameters#
| Parameter | Type | Description |
|---|---|---|
| chainIndex | String | Unique identifier for the chain |
| height | String | Block height where the transaction occurred |
| txTime | String | Transaction time; Unix timestamp in milliseconds |
| txhash | String | Transaction hash |
| txStatus | String | Transaction status: 1: pending 2: success 3: fail |
| gasLimit | String | Gas limit |
| gasUsed | String | Gas used |
| gasPrice | String | Gas price |
| txFee | String | Transaction fee. |
| nonce | String | Nonce |
| amount | String | Transaction amount |
| symbol | String | Currency symbol for the transaction amount |
| methodId | String | Contract method ID |
| fromDetails | Array | Details of transaction inputs |
| >address | String | Sender/input address |
| >vinIndex | String | Index of the input in the current transaction |
| >preVoutIndex | String | Index of the output in the previous transaction |
| >txhash | String | Transaction hash, used with preVoutIndex to uniquely identify the UTXO |
| >isContract | Boolean | Whether the sender address is a contract (true: yes; false: no) |
| >amount | String | Transaction amount |
| toDetails | Array | Details of transaction outputs |
| >address | String | Receiver/output address |
| >voutIndex | String | Output index |
| >isContract | Boolean | Whether the receiver address is a contract (true: yes; false: no) |
| >amount | String | Transaction amount |
| internalTransactionDetails | Array | Internal transaction details |
| >from | String | Sender address for the internal transaction |
| >to | String | Receiver address for the internal transaction |
| >isFromContract | Boolean | Whether the sender address is a contract (true: yes; false: no) |
| >isToContract | Boolean | Whether the receiver address is a contract (true: yes; false: no) |
| >amount | String | Transaction amount |
| >txStatus | String | Transaction status |
| tokenTransferDetails | Array | Token transfer details |
| >from | String | Sender address for token transfer |
| >to | String | Receiver address for token transfer |
| >isFromContract | Boolean | Whether the sender address is a contract (true: yes; false: no) |
| >isToContract | Boolean | Whether the receiver address is a contract (true: yes; false: no) |
| >tokenContractAddress | String | Token contract address |
| >symbol | String | Token symbol |
| >amount | String | Token amount |
| l1OriginHash | String | Hash of the L1 transaction executed |
Request Example#
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'
Response Example#
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",
"txStatus": "success"
},
{
"from": "0xd297fa914353c44b2e33ebe05f21846f1048cfeb",
"to": "0x428ab2ba90eba0a4be7af34c9ac451ab061ac010",
"isFromContract": false,
"isToContract": false,
"amount": "0.00998",
"txStatus": "success"
},
{
"from": "0xd297fa914353c44b2e33ebe05f21846f1048cfeb",
"to": "0x428ab2ba90eba0a4be7af34c9ac451ab061ac010",
"isFromContract": false,
"isToContract": false,
"amount": "0.009977946366846017",
"txStatus": "success"
}
],
"tokenTransferDetails": []
}
]
}
