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
0: Outer layer mainnet coin transfer1: Inner layer mainnet coin transfer within a contract2: Token transfer
👉 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
| Parameter | Type | Required | Description |
|---|---|---|---|
chainIndex | String | Yes | Unique identifier for the blockchain network |
txHash | String | Yes | The transaction hash to query |
itype | String | No | Layer type: 0=Outer mainnet, 1=Inner contract, 2=Token transfer |
Response Parameters
| Parameter | Type | Description |
|---|---|---|
chainIndex | String | Blockchain network identifier |
height | String | Block height containing the transaction |
txTime | String | Transaction timestamp (UNIX milliseconds) |
txhash | String | Transaction hash |
txStatus | String | Status: 1=Pending, 2=Success, 3=Failed |
gasLimit/gasUsed/gasPrice | String | Gas metrics |
txFee | String | Total transaction fee |
Detailed Components:
- Input/Output Addresses: With contract flags and amounts
- Internal Transactions: Sender/receiver addresses and statuses
- Token Transfers: Contract addresses and token symbols
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
- Multi-layer analysis of complex transactions
- Comprehensive gas metrics for cost optimization
- Token transfer visibility including contract interactions
For developers building on decentralized exchanges, this API provides essential blockchain transparency. 🔍