Wallet API
Transaction Details by Transaction Hash

Transaction Details by Transaction Hash#

Retrieve details of a transaction based on its txHash.

Note
Wallet API decomposes each transaction and its internal transactions into sub-transactions, providing different sub-transaction types based on the type of assets changed:
0: Outer chain coin transfer
1: Inner chain coin transfer within contract
2: Token transfer

Request Path#

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

Request Parameters#

ParameterTypeRequiredDescription
chainIndexStringYesUnique identifier for the chain
txHashStringYesTransaction hash
iTypeStringNoSub-transaction type:
0: Outer chain coin transfer
1: Inner chain coin transfer
2: Token transfer
logIndexStringNoIndex value. When subscribing to webhook, logIndex is attached to sub-transactions in transaction history

Response Parameters#

ParameterTypeDescription
chainIndexStringUnique identifier for the chain
orderIdStringUnique order identifier
blockHashStringBlock hash
blockHeightStringBlock height
blockTimeStringBlock time
txHashStringTransaction hash
feeUsdValueStringFee in USD. Shown as estimated amount when pending, updated to actual cost after confirmation
feesStringFees in wei for EVM transactions, sats for UTXO transactions. Shown as estimated amount when pending, updated to actual cost after confirmation
gasLimtStringGas limit. Not applicable for UTXO
gasPriceStringGas price in wei. Not applicable for UTXO
gasUsedStringAmount of gas used, not applicable for UTXO
txTimeStringTransaction time in timestamp format
txTypeStringTransaction type :
1: Receive token
2: Send token
3: Contract interaction
4: Authorization
50:BRC20_MINT
51:BRC20_INSCRIBE
52:BRC20_TRADE
53:BRC20_SEND
54:BRC20_RECEIVE
60:BRC20_DEPLOY
txStatusStringTransaction status:
1: Queued
2: Successful
3: Failed
evmDetailsArrayDetails of EVM chain sub-transactions
>fromAddrStringSource address
>toAddrStringDestination address
>txAmountStringAmount of main chain coin transferred
>iTypeStringSub-transaction type:
0: Outer chain coin transfer
1: Inner chain coin transfer
2: Token transfer
>tokenAddressStringContract address
>contractCallBooleanContract call
>logIndexStringLog index
>nonceStringNonce
>statusStringSub-transaction status:
1: Queued
2: Successful
3: Failed
utxoDetailObjectDetails of UTXO sub-transactions
>vinArrayInput
>>addrStringAddress
>>numberStringSequence number
>>txHashStringTransaction hash
>>amountStringAmount
>>voutIndexStringOutput
>voutIndexArrayOutput
>>addrStringAddress
>>addrInVinBooleanWhether this output address is also in vin
>>numberStringSequence number
>>amountStringAmount

Request Example#

shell
curl --location --request GET 'https://www.okx.com/api/v5/waas/wallet/post-transaction/transaction-detail-by-txhash?txHash=0x3jjdx99hkljbxk138791001&chainIndex=111&iType=0&index=1' \
--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",
    "data":[ 
        {
            "chainIndex": "3",  
            "orderId": "String", 
            "txHash": "String", 
            "blockHash" : "0x3ee63382b883fc40e35da6023fb341dd01cd2ec011f992bb54cf312f517740c9",
            "blockHeight" : "19235519",
            "blockTime" : "1708026551000",
            "txHash": "String", 
            "feeUsdValue" : "138.846919",
            "fees" : "49102595635945621",
            "gasLimit" : "2000000",
            "gasPrice" : "87504603347",
            "gasUsed" : "561143",
            "txType": "0",  
            "txTime": "0", 
            "txStatus": "0",
            "evmDetails": [
               {
                  "iType" : "0",  
                  "txAmount": "0",
                  "tokenAddress":""
                  "contractCall" : true,
                  "fromAddr" : "0x3ee63382b883fc40e35da6023fb341dd01cd2ec011f992bb54cf312f517740c9",
                  "toAddr" : "0x3ee63382b883fc40e35da6023fb341dd01cd2ec011f992bb54cf312f517740c9",
                  "logIndex" : "-1",
                  "status" : "SUCCESS"
               }
             ] 
       }
     ],
    "msg": "success"
}

Example with BTC

{
    "code": "0",
    "data":[ 
        {
            "chainIndex": "3",  
            "orderId": "String", 
            "txHash": "String", 
            "blockHash" : "0x3ee63382b883fc40e35da6023fb341dd01cd2ec011f992bb54cf312f517740c9",
            "blockHeight" : "19235519",
            "blockTime" : "1708026551000",
            "txHash": "String", 
            "feeUsdValue" : "138.846919",
            "fees" : "49102595635945621",
            "gasLimit" : "2000000",
            "gasPrice" : "87504603347",
            "gasUsed" : "561143",
            "txType": "0",  
            "txTime": "0", 
            "txStatus": "0",
            "utxoDetail":{
                "vin" : [
                    {
                      "addr" : "bc1p077evnzjv9w697a523jxvhyyt0aptmgunkk2a8wsppy3mty7gj7q9j6azc",
                      "number" : "0",
                      "txHash" : "3aead5cb471bf2d30b6c2bc9961a579a91ad0a7562800356e6c29f9c5b05a964",
                      "amount" : "2990241",
                      "voutIndex" : "1"
                    }
                ],
                "voutIndex" : [
                    {
                      "addr":"",
                      "addrInVin" : false,
                      "number" : "0",
                      "amount" : "0"
                    },
                    {
                      "addr" : "bc1p6eu0hkl3jy449wrm52exssure7a8083dcsfkydh02c4vyrs2y83shdcmsy",
                      "addrInVin" : false,
                      "number" : "1",
                      "amount" : "330"
                    }
                ]
            }
       }
    ],
    "msg": "success"
}