net_version - TRON RPC Method
Get the current network ID on TRON. Useful for endpoint identification and multi-network routing.
Returns the current network ID on TRON as a decimal string. The network ID identifies which network the node is connected to.
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
net_version is essential for TRON developers building payment rails, exchanges, and consumer crypto applications:
- Endpoint Identification — Confirm your application is connected to the expected TRON network
- Multi-Chain App Routing — Dynamically detect which network an RPC endpoint serves and route logic accordingly
- Connection Validation — Perform a quick sanity check during node or provider initialization
Current Network ID
TRON mainnet currently returns 0x2b6653dc from both net_version and eth_chainId on Dwellir's shared JSON-RPC endpoint. Treat that value as the canonical identity check when you are validating routing, signing, or environment selection in production code.
Request Parameters
This method accepts no parameters.
Response Body
Hex-encoded TRON network identifier. Dwellir's shared mainnet endpoint currently returns 0x2b6653dc.
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": "net_version",
"params": [],
"id": 1
}'Common Use Cases
1. Gate startup on the expected TRON network ID
async function assertTronMainnet(provider) {
const networkId = await provider.send('net_version', []);
if (networkId !== '0x2b6653dc') {
throw new Error(`Unexpected TRON network ID: ${networkId}`);
}
return networkId;
}2. Cross-check net_version and eth_chainId
async function readTronIdentity(provider) {
const [networkId, chainId] = await Promise.all([
provider.send('net_version', []),
provider.send('eth_chainId', []),
]);
console.log({ networkId, chainId });
if (networkId !== chainId) {
throw new Error(`TRON identity mismatch: ${networkId} vs ${chainId}`);
}
return { networkId, chainId };
}3. Route environment-specific config
TRON_NETWORKS = {
'0x2b6653dc': 'tron-mainnet',
}
def resolve_tron_environment(network_id: str) -> str:
if network_id not in TRON_NETWORKS:
raise ValueError(f'Unsupported TRON network id: {network_id}')
return TRON_NETWORKS[network_id]Error Handling
| Error Code | Description | Solution |
|---|---|---|
| -32601 | Method not found | The node may have the net namespace disabled — check node startup flags |
| -32603 | Internal error | Node may be starting up — retry after delay |
| -32005 | Rate limit exceeded | Reduce polling frequency or implement backoff |
Related Methods
eth_chainId— Get the EIP-155 chain ID (preferred for transaction signing)net_listening— Check whether the client reports peer-listening statenet_peerCount— Get number of connected peerseth_syncing— Check node sync progress
eth_syncing
Check the sync status of your TRON node. Returns sync progress or false when fully synced — essential for node health monitoring and dApp reliability.
net_listening
Check the legacy net_listening compatibility method on TRON. Public endpoints may return a boolean or an unsupported-method response depending on the client.