TRON energy and USDT TRC-20 fee calculator — @tronless/tron-energy-calculator

npm: @tronless/tron-energy-calculator · GitHub · MIT · Node.js ≥ 20

npm CI node license

A USDT TRC-20 transfer from an address with no energy costs 6.4285 TRX on TRON mainnet today: 64,285 energy at 100 SUN per unit, with the 345 bytes of bandwidth covered by the free daily allowance. This package computes that number from live chain parameters instead of a hardcoded guess, and shows what changes when the recipient is new, when you already have energy, or when you rent it.

Part of TronLess Tools — free, MIT-licensed TRON developer tools by TronLess, the TRON energy rental service.

Why

Install

npm i @tronless/tron-energy-calculator

Quick start (CLI)

# the default question: what does a USDT transfer cost?
npx @tronless/tron-energy-calculator usdt

# USDT TRC-20 transfer (recipient already holds USDT)
# Energy:     64285 needed, 0 covered, 64285 burned → 6.4285 TRX
# Bandwidth:  345 bytes, covered → 0 TRX
# TOTAL:      6.4285 TRX   (worst case with zero resources: 6.7735 TRX)

# recipient has never held USDT — a new storage slot, about twice the energy
npx @tronless/tron-energy-calculator usdt --new-recipient        # 13.0285 TRX

# you already have 60,000 energy delegated
npx @tronless/tron-energy-calculator usdt --available-energy 60000  # 0.4285 TRX

# read today's real prices from the chain
npx @tronless/tron-energy-calculator usdt --live

# rent vs burn for a payout service
npx @tronless/tron-energy-calculator compare --per-day 100 --rent-price 2.3 --trx-usd 0.30
# Burn TRX:     6.4285 TRX per transfer → 19285.5 TRX per period (~$5785.65)
# Rent energy:  2.3 TRX per transfer → 6900 TRX per period (~$2070)
# Saved:        12385.5 TRX (64%) ≈ $3715.65

# how much TRX would I have to stake instead? (needs the network)
npx @tronless/tron-energy-calculator stake --energy-per-day 65000

# plain TRX transfer to a brand-new address
npx @tronless/tron-energy-calculator trx --new-recipient          # 1 TRX activation

Usage (JavaScript)

import { estimateUsdtTransfer, estimateFee, fetchChainParams, compareRentVsBurn } from '@tronless/tron-energy-calculator';

// offline, with the defaults shipped in the package
const quick = estimateUsdtTransfer();
quick.total.trx;        // '6.4285'
quick.energy.required;  // 64285

// with today's real prices
const params = await fetchChainParams();          // one HTTP call
const live = estimateUsdtTransfer({ params, availableEnergy: 30_000 });
live.energy.burned;     // 34285
live.total.trx;         // '3.4285'

// anything else: your own measured energy usage
estimateFee({ energy: 30_000, bandwidth: 400, availableBandwidth: 0, memo: true, params });

// business case
compareRentVsBurn({ transfersPerDay: 50, rentPricePerTransferTrx: 2.5, trxPriceUsd: 0.3 });
// { burn:{…}, rent:{…}, saved:{ perPeriodTrx, perPeriodUsd, percent } }

How a TRON fee is actually built

Component Rule Price today
Energy charged only for units you cannot cover from stake or delegation 100 SUN per unit (getEnergyFee)
Bandwidth all or nothing — if free + staked bandwidth does not cover the whole transaction, the entire size is charged 1,000 SUN per byte (getTransactionFee)
Free bandwidth every address gets a daily allowance 600 bytes (getFreeNetLimit)
Memo any data field on the transaction 1 TRX (getMemoFee)
Account activation sending TRX to a never-used address 1 TRX, plus 0.1 TRX if bandwidth is also burned

A TRC-20 transfer is about 345 bytes, a plain TRX transfer about 268 — both fit inside the free 600 bytes once per day, which is why bandwidth usually costs nothing and energy is the whole bill.

Built-in presets

Preset Energy Bandwidth Burned cost at 100 SUN
USDT_TRANSFER (recipient holds USDT) 64,285 345 6.4285 TRX
USDT_TRANSFER_NEW_HOLDER 130,285 345 13.0285 TRX
TRC20_TRANSFER_GENERIC 30,000 345 3 TRX
TRC20_APPROVE 25,000 345 2.5 TRX
TRX_TRANSFER 0 268 0 TRX

The USDT figures come from a real mainnet receipt, including the 49,635 units of energy_penalty_total that the dynamic energy model adds on a contract as busy as USDT. Generic TRC-20 numbers are order-of-magnitude estimates — measure your own contract with @tronless/tron-tx-inspector and pass the result.

API

Function Description
estimateFee(input) Core estimator: energy, bandwidth, availableEnergy, availableBandwidth, memo, activatesAccount, params
estimateUsdtTransfer(options) USDT preset, with recipientHoldsUsdt
estimateTrxTransfer(options) TRX transfer, with recipientIsNew and memo
fetchChainParams(options) Live getchainparameters plus network staking weights
paramsFromChain(response) Pure mapper, for cached parameters
compareRentVsBurn(options) Rent vs burn over N transfers a day, optionally in USD
trxToStakeForEnergy(energyPerDay, params) TRX to stake for a given daily energy (needs live weights)
DEFAULT_PARAMS, PRESETS Offline defaults and usage presets

Every result carries both sun and trx, plus a worstCase figure for an address with no resources at all.

When this does not work

FAQ

How much energy does a USDT TRC-20 transfer need?

About 64,285 units when the recipient already holds USDT, and roughly double — around 130,000 — when they have never held it, because the contract has to create a new storage slot. At 100 SUN per unit that is 6.4285 TRX versus about 13 TRX if you have no energy and burn TRX instead.

Why is my first transfer to a new wallet twice as expensive?

Writing a balance entry that does not exist yet costs more than updating one that does. That is a property of the token contract's storage, not a fee TRON adds, and it applies to most TRC-20 tokens. Pass --new-recipient to see the number.

What is the difference between energy and bandwidth?

Bandwidth pays for the size of the transaction in bytes; energy pays for executing smart contract code. A plain TRX transfer only uses bandwidth and is usually free thanks to the 600-byte daily allowance. Any TRC-20 transfer is a contract call and needs energy, which is where the cost comes from.

Is renting energy cheaper than staking TRX?

Usually, unless your volume is constant and large. Around 9.6 energy per staked TRX per day means roughly 6,800 TRX locked to cover one USDT transfer a day, and unstaking takes 14 days. Renting the same energy costs about 2–3 TRX per transfer with no capital locked — run compare with your own numbers, or see how TronLess prices it.

Where do the numbers come from?

getEnergyFee, getTransactionFee, getFreeNetLimit, getMemoFee and the account-creation fees come straight from wallet/getchainparameters when you pass --live. Energy usage figures come from real mainnet receipts, which the test suite pins.

Related tools

License

MIT © TronLess

Need energy for USDT transfers? TronLess rents TRON energy to wallets, exchanges and bots — how it works · API · Telegram bot.