Get Specific Transaction Details by Hash

·

Retrieve detailed information about a blockchain transaction using its unique transaction hash (txHash). This API decomposes complex transactions into sub-transactions categorized by asset type:

Transaction Types

👉 Explore real-time transaction data


API Endpoint

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


Request Parameters

ParameterTypeRequiredDescription
chainIndexStringYesUnique identifier for the blockchain network
txHashStringYesThe transaction hash to query
itypeStringNoLayer type: 0=Outer mainnet, 1=Inner contract, 2=Token transfer

Response Parameters

ParameterTypeDescription
chainIndexStringBlockchain network identifier
heightStringBlock height containing the transaction
txTimeStringTransaction timestamp (UNIX milliseconds)
txhashStringTransaction hash
txStatusStringStatus: 1=Pending, 2=Success, 3=Failed
gasLimit/gasUsed/gasPriceStringGas metrics
txFeeStringTotal transaction fee

Detailed Components:


Example Usage

Request:

curl -X GET "https://web3.okx.com/api/v5/dex/post-transaction/transaction-detail-by-txhash?chainIndex=1&txHash=0xabc123..."

Successful Response:

{
  "chainIndex": "1",
  "height": "15234500",
  "txTime": "1672531200000",
  "txhash": "0xabc123...",
  "txStatus": "2",
  "tokenTransferDetails": [
    {
      "from": "0x123...",
      "to": "0x456...",
      "tokenContractAddress": "0x789...",
      "symbol": "OKT",
      "amount": "10.5"
    }
  ]
}

👉 Learn advanced API techniques


FAQ

Q1: What's the difference between outer and inner layer transfers?
A1: Outer layer transfers involve direct mainnet coin movements, while inner layer transfers occur within smart contract executions.

Q2: How do I handle failed transactions?
A2: Check txStatus=3 and verify gas parameters. Retry with adjusted gas limits if necessary.

Q3: Can I track token transfers across multiple chains?
A3: Yes, specify different chainIndex values for cross-chain queries.

Q4: Why are some addresses marked as contracts?
A4: This indicates interactions with smart contracts rather than regular wallets.

Q5: How recent is the transaction data?
A5: Data updates in real-time as blocks are confirmed on the blockchain.

Q6: What if my query returns no results?
A6: Verify the transaction hash and chain index, then check if the transaction is still pending.


Key Features

For developers building on decentralized exchanges, this API provides essential blockchain transparency. 🔍