Market API

Get Specific Transaction#

Retrieve details of a transaction based on txHash. 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 transfer

Request URL#

GET https://web3.okx.com/api/v5/dex/post-transaction/transaction-detail-by-txhash

Request Parameters#

ParameterTypeRequiredDescription
chainIndexStringYesUnique identifier for the chain
txHashStringYesTransaction hash
itypeStringNoLayer type for transactions
0: Outer layer mainnet coin transfer
1: Inner layer mainnet coin transfer
2: Token transfer

Response Parameters#

ParameterTypeDescription
chainIndexStringUnique identifier for the chain
heightStringBlock height where the transaction occurred
txTimeStringTransaction time; Unix timestamp in milliseconds
txhashStringTransaction hash
txStatusStringTransaction status:
1: pending
2: success
3: fail
gasLimitStringGas limit
gasUsedStringGas used
gasPriceStringGas price
txFeeStringTransaction fee.
nonceStringNonce
amountStringTransaction amount
symbolStringCurrency symbol for the transaction amount
methodIdStringContract method ID
fromDetailsArrayDetails of transaction inputs
>addressStringSender/input address
>vinIndexStringIndex of the input in the current transaction
>preVoutIndexStringIndex of the output in the previous transaction
>txhashStringTransaction hash, used with preVoutIndex to uniquely identify the UTXO
>isContractBooleanWhether the sender address is a contract (true: yes; false: no)
>amountStringTransaction amount
toDetailsArrayDetails of transaction outputs
>addressStringReceiver/output address
>voutIndexStringOutput index
>isContractBooleanWhether the receiver address is a contract (true: yes; false: no)
>amountStringTransaction amount
internalTransactionDetailsArrayInternal transaction details
>fromStringSender address for the internal transaction
>toStringReceiver address for the internal transaction
>isFromContractBooleanWhether the sender address is a contract (true: yes; false: no)
>isToContractBooleanWhether the receiver address is a contract (true: yes; false: no)
>amountStringTransaction amount
>txStatusStringTransaction status
tokenTransferDetailsArrayToken transfer details
>fromStringSender address for token transfer
>toStringReceiver address for token transfer
>isFromContractBooleanWhether the sender address is a contract (true: yes; false: no)
>isToContractBooleanWhether the receiver address is a contract (true: yes; false: no)
>tokenContractAddressStringToken contract address
>symbolStringToken symbol
>amountStringToken amount
l1OriginHashStringHash of the L1 transaction executed

Request Example#

shell
curl --location --request GET 'https://web3.okx.com/api/v5/dex/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
{
    "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": []
        }
    ]
}