Wallet API
Query Transaction Details by TxHash

Query Transaction Details by TxHash#

Retrieve details for a specific transaction based on the txHash.

Note
The Wallet API breaks down a transaction and its internal transactions into sub-transactions, and provides different sub-transaction types based on the asset type changes:
0: Outer main chain coin transfer
1: Inner contract main chain coin transfer
2: Token transfer

Request Path#

GET https://www.okx.com/api/v5/wallet/post-transaction/transaction-detail-by-txhash

Request Parameters#

ParameterTypeRequiredDescription
chainIndexStringYesUnique identifier for the chain
txHashStringYesTransaction hash
iTypeStringNoEVM transaction layer type
0: Outer main chain coin transfer
1: Inner contract main chain coin transfer
2: Token transfer

Response Parameters#

ParameterTypeDescription
chainIndexStringUnique identifier for the chain
heightStringBlock height at which the transaction occurred
txTimeStringTransaction time in milliseconds since Unix epoch
txhashStringTransaction hash
txStatusStringTransaction status:
1: Pending
2: Success
3: Fail
gasLimitStringGas limit
gasUsedStringGas used
gasPriceStringGas price
nonceStringNonce
amountStringTransaction amount
symbolStringCurrency symbol for the transaction amount
methodIdStringContract method ID
fromDetailsArrayTransaction input details
>addressStringSender/input address
>vinIndexStringSequence number of the current transaction input
>preVoutIndexStringSequence number in the previous output
>txhashStringTransaction hash, uniquely identifies the UTXO with prevoutIndex
>isContractBooleanWhether the sending address is a contract address (true/false)
>amountStringTransaction amount
toDetailsArrayTransaction output details
>addressStringReceiver/output address
>voutIndexStringOutput sequence number
>isContractBooleanWhether the receiving address is a contract address (true/false)
>amountStringTransaction amount
internalTransactionDetailsArrayInternal transaction details
>fromStringSender address
>toStringReceiver address
>isFromContractBooleanWhether the sender address is a contract address (true/false)
>isToContractBooleanWhether the receiver address is a contract address (true/false)
>amountStringTransaction amount
>txStatusStringTransaction status
tokenTransferDetailsArrayToken transfer details
>fromStringSender address
>toStringReceiver address
>isFromContractBooleanWhether the sender address is a contract address (true/false)
>isToContractBooleanWhether the receiver address is a contract address (true/false)
>tokenContractAddressStringToken contract address
>symbolStringToken symbol
>amountStringToken amount
l1OriginHashStringL1 execution transaction hash

Request Example#

shell
curl --location --request GET 'https://www.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'

Response Example#

200

Example with ETH

{
    "code": "0",
    "msg": "success",
    "data": [
        {
            "chainIndex": "42161",
            "height": "245222398",
            "txTime": "1724253417000",
            "txhash": "0x9ab8ccccc9f778ea91ce4c0f15517672c4bd06d166e830da41ba552e744d29a5",
            "gasLimit": "2000000",
            "gasUsed": "2000000",
            "gasPrice": "10000000",
            "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": []
        }
    ]
}

For BTC example:

{
    "code": "0",
    "msg": "success",
    "data": [
        {
            "chainIndex": "0",
            "height": "858056",
            "txTime": "1724403746000",
            "txhash": "0538eec298699ff4b7cc07163c7216c48fe40caed492a3c655382bf0ae63db1a",
            "gasLimit": "",
            "gasUsed": "",
            "gasPrice": "",
            "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": []
        }
    ]
}