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
latestandpendingnonces 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
The address to query the transaction count for
Block number as hex, or tag: latest (confirmed nonce), pending (includes mempool txs), earliest
Response Body
Hexadecimal nonce on TRON nodes that expose the EVM-compatible transaction count method.
Error Responses
Code Examples
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
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
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
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 Code | Description | Solution |
|---|---|---|
-32601 | Method not found on the shared TRON JSON-RPC surface | Feature-detect the method and fall back to native TRON wallet flows on endpoints that do not expose it |
-32602 | Invalid params | Verify the address is a valid 20-byte hex string and the block parameter is valid |
-32005 | Rate limit exceeded | Back off and retry after reducing request frequency |
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;
}
}Related Methods
eth_sendRawTransaction— Send a signed transaction to the networketh_getBalance— Get the ETH balance of an addresseth_getTransactionByHash— Get transaction details by hasheth_getTransactionReceipt— Get the receipt of a confirmed transaction
eth_getStorageAt
Read the value from a storage slot at a given contract address on TRON. Essential for reading contract state directly, proxy implementation verification, and storage layout analysis.
eth_accounts
Returns a list of addresses owned by the client on TRON. Typically returns an empty array on public RPC endpoints.