Docs
Docs
Home
Getting Started
Agent Tooling
CLI
Supported Chains
Acala
Aptos
Arbitrum
Arc
Asset Hub
Astar
Avalanche
Base
Berachain
Bifrost
Binance Smart Chain
Bittensor
Blast
Boba Network
Bridge Hub
Celo
Centrifuge
Chiliz
Cronos
Enjin
Ethereum
Etherlink
Flow EVM Gateway
Gnosis
Hydration
Hyperliquid
Immutable
Ink
IoTeX
Kusama
Linea
LISK
Manta Atlantic
Manta Pacific
Mantle
MegaETH
Monad
Movement
Neuroweb
opBNB
Optimism
Plasma
Polkadot
Polygon
Pulsechain
Robinhood
Ronin
Scroll
Sonic
Starknet
Taiko
Tempo
Sui
TRON
Unichain
Viction
World Chain
XDC Network
XX Network
Zetachain
zkSync Era
Zora
Supported ChainsTRONTRON HTTP API

wallet/broadcasttransaction - Broadcast TRON Tr...

Broadcast signed TRON transactions to the network with instant confirmation and detailed result tracking via Dwellir's high-performance endpoints.

TRON RPC endpoint: endpoint URLs, plans and pricing.

Instant Transaction Broadcasting

Dwellir's TRON endpoints broadcast transactions to the network in under 100ms with real-time confirmation tracking. Get instant feedback on transaction success and network inclusion.

Start broadcasting now

Broadcasts a signed transaction to the TRON network for execution. This is the final step after creating and signing a transaction.

When to Use This Method

wallet/broadcasttransaction is essential for:

  • Transaction Execution - Submit signed transactions to the network
  • Payment Processing - Complete payment transactions in real-time
  • Smart Contract Calls - Execute signed contract interactions
  • Multi-Signature Operations - Broadcast fully-signed multi-sig transactions
  • Batch Processing - Submit multiple transactions efficiently
JSON-RPC request
{
  "txID": "94eea63bb6774c8fc4f4c9d1b62c1e8c2f7c8c2e4d3a2b1c0d9e8f7a6b5c4d3e2f1",
  "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
  },
  "signature": ["c8f8f8e8d8c8b8a898887878686858484838281807060504030201"]
}

Implementation Examples

Response Examples

Successful Broadcast

JSON
{
  "result": true,
  "txid": "94eea63bb6774c8fc4f4c9d1b62c1e8c2f7c8c2e4d3a2b1c0d9e8f7a6b5c4d3e2f1"
}

Failed Broadcast (Insufficient Energy)

JSON
{
  "result": false,
  "code": "CONTRACT_VALIDATE_ERROR",
  "message": "account does not have enough energy"
}

Network Error

JSON
{
  "result": false,
  "code": "SERVER_BUSY",
  "message": "Server is busy, please try again later"
}

Common Use Cases

1. Payment Gateway Completion

JavaScript
class PaymentProcessor {
  constructor(apiKey) {
    this.apiKey = apiKey;
    this.broadcaster = new TronBroadcaster(apiKey);
  }
  
  async processPayment(paymentRequest) {
    try {
      const { signedTransaction, paymentId, amount, customer } = paymentRequest;
      
      console.log(`Processing payment ${paymentId} for ${amount} TRX`);
      
      // Broadcast with monitoring
      const result = await this.broadcaster.broadcast_with_monitoring(
        signedTransaction,
        {
          maxRetries: 5,
          waitForConfirmation: true,
          confirmationTimeout: 60000
        }
      );
      
      if (result.result && result.confirmation?.confirmed) {
        // Payment successful
        await this.updatePaymentStatus(paymentId, 'completed', result.txid);
        await this.notifyCustomer(customer, 'payment_success', result.txid);
        
        return {
          status: 'completed',
          txId: result.txid,
          blockNumber: result.confirmation.blockNumber,
          fee: result.confirmation.fee
        };
      } else {
        throw new Error('Payment confirmation failed');
      }
      
    } catch (error) {
      await this.updatePaymentStatus(paymentId, 'failed', null, error.message);
      await this.notifyCustomer(customer, 'payment_failed', error.message);
      throw error;
    }
  }
  
  async updatePaymentStatus(paymentId, status, txId = null, error = null) {
    // Update payment in database
    console.log(`Payment ${paymentId} status: ${status}`);
  }
  
  async notifyCustomer(customer, event, data) {
    // Send notification to customer
    console.log(`Notifying ${customer}: ${event} - ${data}`);
  }
}

2. Multi-Signature Transaction Execution

JavaScript
async function executeMultiSigTransaction(multiSigTransaction, requiredSignatures) {
  try {
    // Verify we have enough signatures
    if (multiSigTransaction.signature.length < requiredSignatures) {
      throw new Error(`Insufficient signatures: ${multiSigTransaction.signature.length}/${requiredSignatures}`);
    }
    
    console.log(`Executing multi-sig transaction with ${multiSigTransaction.signature.length} signatures`);
    
    const result = await broadcastWithMonitoring(multiSigTransaction, {
      maxRetries: 3,
      waitForConfirmation: true
    });
    
    return {
      executed: true,
      txId: result.txid,
      signatures: multiSigTransaction.signature.length,
      confirmation: result.confirmation
    };
    
  } catch (error) {
    console.error('Multi-sig execution failed:', error);
    return {
      executed: false,
      error: error.message,
      signatures: multiSigTransaction.signature?.length || 0
    };
  }
}

3. Automated Trading Bot

JavaScript
class TronTradingBot {
  constructor(apiKey, strategy) {
    this.apiKey = apiKey;
    this.strategy = strategy;
    this.broadcaster = new TronBroadcaster(apiKey);
    this.pendingTrades = new Map();
  }
  
  async executeTrade(tradeSignal) {
    try {
      const { action, amount, price, signedTransaction } = tradeSignal;
      
      console.log(`Executing ${action} trade: ${amount} TRX at ${price}`);
      
      // Broadcast trade transaction
      const result = await this.broadcaster.broadcast_with_monitoring(
        signedTransaction,
        { 
          maxRetries: 2,
          waitForConfirmation: false // Don't wait for DEX trades
        }
      );
      
      if (result.result) {
        // Track pending trade
        this.pendingTrades.set(result.txid, {
          action,
          amount,
          price,
          timestamp: Date.now(),
          status: 'pending'
        });
        
        // Monitor in background
        this.monitorTradeConfirmation(result.txid);
        
        return {
          success: true,
          tradeId: result.txid,
          action,
          amount,
          price
        };
      } else {
        throw new Error(`Trade broadcast failed: ${result.message}`);
      }
      
    } catch (error) {
      console.error('Trade execution failed:', error);
      return {
        success: false,
        error: error.message,
        action: tradeSignal.action
      };
    }
  }
  
  async monitorTradeConfirmation(txId) {
    // Background monitoring
    setTimeout(async () => {
      try {
        const confirmation = await this.broadcaster.wait_for_confirmation(txId, 30000);
        const trade = this.pendingTrades.get(txId);
        
        if (confirmation.confirmed && trade) {
          trade.status = 'confirmed';
          trade.blockNumber = confirmation.blockNumber;
          console.log(`Trade ${txId} confirmed in block ${confirmation.blockNumber}`);
          
          // Update strategy
          this.strategy.onTradeConfirmed(trade);
        }
      } catch (error) {
        console.error(`Trade monitoring failed for ${txId}:`, error);
      }
    }, 1000);
  }
}

4. Subscription Payment Processing

JavaScript
class SubscriptionManager {
  constructor(apiKey) {
    this.broadcaster = new TronBroadcaster(apiKey);
    this.subscriptions = new Map();
  }
  
  async processSubscriptionPayment(subscriptionId, signedTransaction) {
    try {
      const subscription = this.subscriptions.get(subscriptionId);
      if (!subscription) {
        throw new Error('Subscription not found');
      }
      
      console.log(`Processing subscription payment for ${subscriptionId}`);
      
      const result = await this.broadcaster.broadcast_with_monitoring(
        signedTransaction,
        {
          maxRetries: 3,
          waitForConfirmation: true,
          confirmationTimeout: 45000
        }
      );
      
      if (result.result && result.confirmation?.confirmed) {
        // Update subscription status
        subscription.status = 'active';
        subscription.lastPayment = Date.now();
        subscription.nextBilling = Date.now() + (30 * 24 * 60 * 60 * 1000); // 30 days
        subscription.txId = result.txid;
        
        await this.activateSubscription(subscriptionId);
        await this.scheduleNextBilling(subscriptionId);
        
        return {
          success: true,
          subscriptionId,
          txId: result.txid,
          nextBilling: subscription.nextBilling
        };
      } else {
        throw new Error('Payment confirmation failed');
      }
      
    } catch (error) {
      console.error(`Subscription payment failed for ${subscriptionId}:`, error);
      
      // Update subscription status
      const subscription = this.subscriptions.get(subscriptionId);
      if (subscription) {
        subscription.status = 'payment_failed';
        subscription.lastError = error.message;
      }
      
      throw error;
    }
  }
  
  async activateSubscription(subscriptionId) {
    console.log(`Activating subscription ${subscriptionId}`);
    // Activate user's subscription features
  }
  
  async scheduleNextBilling(subscriptionId) {
    const subscription = this.subscriptions.get(subscriptionId);
    if (subscription) {
      console.log(`Next billing for ${subscriptionId}: ${new Date(subscription.nextBilling)}`);
      // Schedule next payment reminder
    }
  }
}

Performance Tips

  1. Parallel Processing - Broadcast multiple transactions concurrently with rate limiting
  2. Retry Strategy - Implement exponential backoff for failed broadcasts
  3. Confirmation Polling - Use efficient polling intervals for transaction confirmation
  4. Error Recovery - Handle different error types with appropriate recovery strategies
JavaScript
// Performance-optimized batch broadcaster
class OptimizedBroadcaster {
  constructor(apiKey, options = {}) {
    this.apiKey = apiKey;
    this.maxConcurrency = options.maxConcurrency || 10;
    this.rateLimitPerSecond = options.rateLimitPerSecond || 20;
    this.queue = [];
    this.processing = false;
  }
  
  async addToBroadcastQueue(signedTransaction, priority = 'normal') {
    return new Promise((resolve, reject) => {
      this.queue.push({
        transaction: signedTransaction,
        priority,
        resolve,
        reject,
        timestamp: Date.now()
      });
      
      this.processQueue();
    });
  }
  
  async processQueue() {
    if (this.processing) return;
    this.processing = true;
    
    // Sort by priority
    this.queue.sort((a, b) => {
      const priorities = { high: 3, normal: 2, low: 1 };
      return priorities[b.priority] - priorities[a.priority];
    });
    
    while (this.queue.length > 0) {
      const batch = this.queue.splice(0, this.maxConcurrency);
      
      const promises = batch.map(async (item, index) => {
        // Stagger requests to respect rate limits
        await new Promise(resolve => 
          setTimeout(resolve, (index * 1000) / this.rateLimitPerSecond)
        );
        
        try {
          const result = await broadcastWithMonitoring(item.transaction);
          item.resolve(result);
        } catch (error) {
          item.reject(error);
        }
      });
      
      await Promise.allSettled(promises);
    }
    
    this.processing = false;
  }
}

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

wallet/createtransaction

Create TRX transfer transactions on TRON network with optimized bandwidth usage and fee estimation via Dwellir's high-performance RPC endpoints.

wallet/broadcasthex

Broadcast a signed TRON transaction in hexadecimal format to the network via Dwellir's high-performance RPC endpoint.

On this page

When to Use This MethodImplementation ExamplesResponse ExamplesSuccessful BroadcastFailed Broadcast (Insufficient Energy)Network ErrorCommon Use Cases1. Payment Gateway Completion2. Multi-Signature Transaction Execution3. Automated Trading Bot4. Subscription Payment ProcessingPerformance Tips