Docs

wallet/gettransactionbyid - Get TRON Transactio...

Retrieve detailed TRON transaction information by transaction ID including status, fees, contracts executed, and block confirmation via Dwellir RPC.

Instant Transaction Tracking

Dwellir's TRON endpoints retrieve transaction details in under 50ms with comprehensive status information. Track payments, confirmations, and smart contract executions in real-time.

Track your transactions

Retrieves detailed information about a specific transaction using its transaction ID (hash). Essential for tracking transaction status, confirmations, and execution results.

When to Use This Method

wallet/gettransactionbyid is essential for:

  • Transaction Confirmation - Check if transaction was successful and confirmed
  • Payment Tracking - Monitor payment status in real-time
  • Error Debugging - Analyze failed transactions and error messages
  • Fee Analysis - Review bandwidth and energy consumption
  • Smart Contract Results - Get contract execution results and logs

Implementation Examples

Response Examples

Successful TRX Transfer

JSON
{
  "ret": [
    {
      "contractRet": "SUCCESS",
      "fee": 1100
    }
  ],
  "signature": [
    "c8f8f8e8d8c8b8a898887878686858484838281807060504030201..."
  ],
  "txID": "2668be54c278d702eebde274a58cfae3ea50c72c76a885df48c6d456d7ec38b5",
  "raw_data": {
    "contract": [
      {
        "parameter": {
          "value": {
            "amount": 1000000,
            "owner_address": "TJmmqjb1DK9TTZbQXzRQ2AuA94z4gKAPFh",
            "to_address": "TRX6Q82wMqWNbCCmJPLz9mR8AZwqvUU2pN"
          },
          "type_url": "type.googleapis.com/protocol.TransferContract"
        },
        "type": "TransferContract"
      }
    ],
    "ref_block_bytes": "4a7b",
    "ref_block_hash": "e15e44aa73bd9e15",
    "expiration": 1734567890000,
    "timestamp": 1734567830000
  },
  "blockNumber": 52895819,
  "blockTimeStamp": 1734567893000
}

Failed Smart Contract Call

JSON
{
  "ret": [
    {
      "contractRet": "REVERT",
      "fee": 5000
    }
  ],
  "signature": ["..."],
  "txID": "a1b2c3d4e5f6789012345678901234567890123456789012345678901234567890",
  "raw_data": {
    "contract": [
      {
        "parameter": {
          "value": {
            "data": "a9059cbb0000000000000000000000004142b5e01c8c59a25d78acdbec2bfc7e89e5e86300000000000000000000000000000000000000000000000000000000000f4240",
            "owner_address": "TJmmqjb1DK9TTZbQXzRQ2AuA94z4gKAPFh",
            "contract_address": "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t"
          },
          "type_url": "type.googleapis.com/protocol.TriggerSmartContract"
        },
        "type": "TriggerSmartContract"
      }
    ],
    "ref_block_bytes": "4a7b",
    "ref_block_hash": "e15e44aa73bd9e15",
    "expiration": 1734567890000,
    "timestamp": 1734567830000
  },
  "blockNumber": 52895820,
  "blockTimeStamp": 1734567896000
}

Transaction Not Found

JSON
{}

Common Use Cases

1. E-commerce Payment Tracking

JavaScript
class EcommercePaymentTracker {
  constructor(apiKey) {
    this.analyzer = new TronTransactionAnalyzer(apiKey);
    this.paymentDatabase = new Map(); // Replace with real database
  }
  
  async trackOrderPayment(orderId, txId, expectedAmount, expectedRecipient) {
    try {
      // Store payment attempt
      this.paymentDatabase.set(orderId, {
        txId,
        expectedAmount,
        expectedRecipient,
        status: 'tracking',
        createdAt: Date.now()
      });
      
      // Track transaction
      const result = await this.analyzer.trackTransactionStatus(txId, 300000); // 5 min timeout
      
      if (result.trackingStatus === 'confirmed' && result.successful) {
        // Verify payment details
        const verification = await this.verifyOrderPayment(orderId, result);
        
        if (verification.verified) {
          await this.fulfillOrder(orderId);
          return { success: true, message: 'Payment confirmed and order fulfilled' };
        } else {
          await this.flagPaymentIssue(orderId, verification.reason);
          return { success: false, message: verification.reason };
        }
      } else {
        await this.handlePaymentFailure(orderId, result);
        return { success: false, message: 'Payment failed or timeout' };
      }
      
    } catch (error) {
      console.error(`Payment tracking error for order ${orderId}:`, error);
      throw error;
    }
  }
  
  async verifyOrderPayment(orderId, transactionResult) {
    const payment = this.paymentDatabase.get(orderId);
    const contract = transactionResult.contractDetails;
    
    if (contract.type !== 'TRX Transfer') {
      return { verified: false, reason: 'Not a TRX transfer' };
    }
    
    const amountMatch = contract.amount === payment.expectedAmount;
    const recipientMatch = contract.to === payment.expectedRecipient;
    
    return {
      verified: amountMatch && recipientMatch,
      reason: !amountMatch ? 'Payment amount mismatch' :
              !recipientMatch ? 'Payment recipient mismatch' :
              'Payment verified successfully'
    };
  }
  
  async fulfillOrder(orderId) {
    console.log(`✅ Fulfilling order ${orderId}`);
    // Implement order fulfillment logic
  }
  
  async flagPaymentIssue(orderId, reason) {
    console.log(`⚠️ Payment issue for order ${orderId}: ${reason}`);
    // Implement payment issue handling
  }
  
  async handlePaymentFailure(orderId, result) {
    console.log(`❌ Payment failed for order ${orderId}: ${result.message}`);
    // Implement payment failure handling
  }
}

2. Smart Contract Execution Monitor

JavaScript
class SmartContractMonitor {
  constructor(apiKey) {
    this.analyzer = new TronTransactionAnalyzer(apiKey);
    this.contractAddresses = new Set();
  }
  
  addContract(address) {
    this.contractAddresses.add(address);
  }
  
  async monitorContractTransaction(txId) {
    try {
      const details = await this.analyzer.getTransactionDetails(txId);
      
      if (!details.found) {
        return { status: 'not_found', message: 'Transaction not found' };
      }
      
      if (details.contractDetails?.type !== 'Smart Contract Call') {
        return { status: 'not_contract', message: 'Not a smart contract transaction' };
      }
      
      const contractAddress = details.contractDetails.contract;
      
      if (!this.contractAddresses.has(contractAddress)) {
        return { status: 'not_monitored', message: 'Contract not in monitoring list' };
      }
      
      return {
        status: 'monitored',
        successful: details.successful,
        contractAddress,
        caller: details.contractDetails.caller,
        energyUsed: details.energyUsed,
        fee: details.fee,
        blockNumber: details.blockNumber,
        executionResult: details.status
      };
      
    } catch (error) {
      return { status: 'error', message: error.message };
    }
  }
}

Need help? Contact our support team or check the TRON documentation.