Docs
Supported ChainsTRONEthereum JSON-RPC APIAccount Methods

eth_getTransactionCount - TRON RPC Method

Get the number of transactions sent from an address (nonce) on TRON. Essential for nonce management, transaction signing, and detecting stuck transactions.

Returns the number of transactions sent from an address on TRON, commonly known as the nonce. The nonce is required for every outbound transaction to ensure correct ordering and prevent replay attacks.

Why TRON? Build on the TVM-compatible Layer 1 for TRC-20 payments, wallet APIs, and low-cost smart contract execution with TVM compatibility paired with native TRON wallet APIs, DPoS block production, and low-cost transaction flows.

When to Use This Method

eth_getTransactionCount is essential for TRON developers building payment rails, exchanges, and consumer crypto applications:

  • Transaction Signing — Get the correct nonce before building and signing a new transaction on TRON
  • Nonce Gap Detection — Compare latest and pending nonces to identify stuck or dropped transactions in the mempool
  • Account Activity Analysis — Track the total number of outgoing transactions from any address on TRC-20 transfers, wallet operations, and EVM-compatible smart contract integrations
  • Batch Transaction Sequencing — Assign sequential nonces when submitting multiple transactions from the same address

Current Shared Endpoint Behavior

Dwellir's shared TRON JSON-RPC endpoint currently returns -32601 for eth_getTransactionCount. Keep this page as a compatibility reference for TRON clients that expose the EVM nonce surface, but feature-detect the method before you depend on it in production code.

If you are building against the shared public endpoint, plan around the native TRON wallet APIs for transaction construction instead of assuming Ethereum-style nonce reads are available everywhere.

Request Parameters

Request
addressDATA (20 bytes)

The address to query the transaction count for

blockParameterQUANTITY|TAG

Block number as hex, or tag: latest (confirmed nonce), pending (includes mempool txs), earliest

Response Body

Response
resultQUANTITY

Hexadecimal nonce on TRON nodes that expose the EVM-compatible transaction count method.

Error Responses

Errors
Error Response-32601

Code Examples

Bash
curl -X POST https://api-tron-mainnet.n.dwellir.com/YOUR_API_KEY/jsonrpc \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "eth_getTransactionCount",
    "params": [
      "0xc7885b2334355ba766f54a3ad14d5a5339934bb3",
      "latest"
    ],
    "id": 1
  }'

Common Use Cases

1. Feature-detect nonce support during startup

JavaScript
async function supportsTronNonceReads(provider, address) {
  try {
    await provider.send('eth_getTransactionCount', [address, 'latest']);
    return true;
  } catch (error) {
    return !String(error.message).includes('does not exist');
  }
}

2. Fallback to the native TRON wallet flow

JavaScript
async function prepareTronSubmission({ provider, address }) {
  const hasNonceSurface = await supportsTronNonceReads(provider, address);

  if (!hasNonceSurface) {
    return {
      mode: 'tron-wallet-api',
      note: 'Use wallet/createtransaction or wallet/triggersmartcontract on this endpoint.',
    };
  }

  return {
    mode: 'evm-compatible',
    nonce: await provider.send('eth_getTransactionCount', [address, 'latest']),
  };
}

3. Keep compatibility logic explicit

Python
def classify_tron_nonce_support(payload: dict) -> str:
    if payload.get('error', {}).get('code') == -32601:
        return 'shared-endpoint-without-eth_getTransactionCount'

    return 'endpoint-exposes-evm-nonce-surface'

Error Handling

Error CodeDescriptionSolution
-32601Method not found on the shared TRON JSON-RPC surfaceFeature-detect the method and fall back to native TRON wallet flows on endpoints that do not expose it
-32602Invalid paramsVerify the address is a valid 20-byte hex string and the block parameter is valid
-32005Rate limit exceededBack off and retry after reducing request frequency
JavaScript
async function classifyTronNonceError(provider, address) {
  try {
    return await provider.send('eth_getTransactionCount', [address, 'latest']);
  } catch (error) {
    if (String(error.message).includes('does not exist')) {
      return null;
    }

    throw error;
  }
}