Skip to main content

App Integration

If your application sends TRON transactions, you can add automatic energy with a single config change — replace the default node URL with your Energy-Free Node URL. No SDK changes, no new dependencies, no extra API calls.

Your existing code stays exactly the same. The node handles energy behind the scenes.

tronweb.js (JavaScript / Node.js)​

One change: set fullHost to your Energy-Free Node URL.

const TronWeb = require('tronweb');

const tronWeb = new TronWeb({
fullHost: process.env.TRON_NODE_URL, // https://node.tronagg.ai/YOUR_SECRET_KEY
});

tronWeb.setPrivateKey(process.env.TRON_PRIVATE_KEY);

// Send USDT — energy is purchased automatically before broadcast
const tx = await tronWeb.transactionBuilder.triggerSmartContract(
'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t', // USDT contract
'transfer(address,uint256)',
{},
[
{ type: 'address', value: 'RECIPIENT_ADDRESS' },
{ type: 'uint256', value: 1000000 }, // 1 USDT (6 decimals)
],
tronWeb.defaultAddress.hex
);

const signedTx = await tronWeb.trx.sign(tx.transaction);
const result = await tronWeb.trx.sendRawTransaction(signedTx);
console.log('Transaction ID:', result.txid);

If you have an existing tronweb.js project, the migration is literally replacing the fullHost value. Every triggerSmartContract, sendRawTransaction, and contract call you already have will automatically get energy.

tronpy (Python)​

One change: set the fullnode config to your Energy-Free Node URL.

from tronpy import Tron
from tronpy.keys import PrivateKey
import os

client = Tron(network='mainnet')
client.conf['fullnode'] = os.environ['TRON_NODE_URL'] # https://node.tronagg.ai/YOUR_SECRET_KEY

priv_key = PrivateKey(bytes.fromhex(os.environ['TRON_PRIVATE_KEY']))

# Send USDT — energy is purchased automatically before broadcast
contract = client.get_contract('TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t') # USDT
txn = (
contract.functions.transfer('RECIPIENT_ADDRESS', 1_000_000)
.with_owner('YOUR_ADDRESS')
.fee_limit(100_000_000)
.build()
.sign(priv_key)
)
result = txn.broadcast().wait()
print('Transaction ID:', result['id'])

Other languages / raw HTTP API​

The Energy-Free Node is a standard TRON full node. Any HTTP client that speaks the TRON HTTP API can use it — just swap the base URL:

# Before (default node)
https://api.trongrid.io

# After (Energy-Free Node)
https://node.tronagg.ai/YOUR_SECRET_KEY

All standard TRON API endpoints work:

EndpointDescription
POST /wallet/createtransactionCreate a TRX transfer
POST /wallet/triggersmartcontractCall a smart contract (TRC20 transfers)
POST /wallet/broadcasttransactionBroadcast a signed transaction
GET /wallet/getaccountGet account info
GET /wallet/getnowblockGet latest block

The energy purchase happens transparently when you call broadcasttransaction with a TRC20 transfer.

Best practices​

Keep the URL out of source code​

Your node URL is tied to your TRONAgg balance. Treat it like a database password.

// Good — from environment
const tronWeb = new TronWeb({
fullHost: process.env.TRON_NODE_URL,
});

// Bad — hardcoded
const tronWeb = new TronWeb({
fullHost: 'https://node.tronagg.ai/abc123secret',
});
  • Store in environment variables or a secrets manager
  • Never commit to version control
  • Use separate URLs for development and production if needed

Use address whitelisting​

If your app sends from a fixed set of addresses, enable address whitelisting in the dashboard. This ensures that only your known addresses can trigger energy purchases — even if someone obtains your node URL.

Monitor your balance​

If your TRONAgg balance hits zero, the node still broadcasts your transactions — just without energy. TRX gets burned from your wallet at the full network rate. Keep an eye on the dashboard to avoid this.

Graceful degradation

The Energy-Free Node never blocks your transactions. Insufficient balance means your transaction goes through without energy — not that it fails. But you'll pay the higher burn rate (~6.5 TRX instead of ~2 TRX), so keep your balance funded.

Next steps​

  • Security — How the node protects your transactions and keys
  • FAQ — Pricing details, supported tokens, troubleshooting
  • Dashboard — Enable your node and monitor usage