tron-resource
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseTRON Resource Management (Energy & Bandwidth)
TRON资源管理(Energy & Bandwidth)
6 commands for resource query, energy estimation, bandwidth estimation, energy price, energy rental marketplace, and cost optimization.
用于资源查询、Energy估算、Bandwidth估算、Energy价格查询、能源租赁市场信息获取以及成本优化的6个命令。
TRON Resource Model — Essential Knowledge
TRON资源模型——必备知识
Unlike Ethereum's gas model, TRON uses TWO separate resources:
与Ethereum的Gas模型不同,TRON采用两种独立的资源机制:
Bandwidth
Bandwidth
- Consumed by ALL transactions (proportional to transaction size in bytes)
- Every account gets 600 free Bandwidth daily (resets at 00:00 UTC)
- A basic TRX transfer uses ~267 Bandwidth (covered by free allowance)
- If insufficient: TRX is burned at a rate of ~1000 SUN per Bandwidth point
- 所有交易都会消耗Bandwidth(与交易的字节大小成正比)
- 每个账户每日可获得600点免费Bandwidth(于UTC时间00:00重置)
- 一笔基础TRX转账约消耗267点Bandwidth(可被免费额度覆盖)
- 若Bandwidth不足:将以每点Bandwidth约1000 SUN的费率燃烧TRX
Energy
Energy
- Consumed ONLY by smart contract calls (TRC-20 transfers, DEX swaps, DeFi interactions)
- No free daily allowance
- Must be obtained by: freezing TRX (Stake 2.0), renting from marketplace, or burning TRX
- A USDT transfer typically costs ~65,000 Energy ≈ 13-27 TRX if burned
- 仅在调用智能合约时消耗(如TRC-20转账、DEX兑换、DeFi交互等)
- 无每日免费额度
- 需通过以下方式获取:冻结TRX(Stake 2.0)、从第三方市场租赁,或燃烧TRX
- 一笔USDT转账通常约消耗65,000 Energy,若选择燃烧TRX则成本约为13-27 TRX
Cost Comparison
成本对比
| Operation | Energy Needed | TRX Burned (no staking) | With Staked Energy |
|---|---|---|---|
| TRX transfer | 0 | 0 (free bandwidth) | 0 |
| USDT transfer | ~65,000 | ~13-27 TRX | 0 TRX |
| SunSwap V2 swap | ~65,000-200,000 | ~13-40 TRX | 0 TRX |
| Contract deployment | ~200,000-1,000,000+ | ~40-200+ TRX | 0 TRX |
| Approve token | ~30,000 | ~6-12 TRX | 0 TRX |
| 操作类型 | 所需Energy | 消耗TRX(未质押) | 已质押Energy时 |
|---|---|---|---|
| TRX转账 | 0 | 0(使用免费Bandwidth) | 0 |
| USDT转账 | ~65,000 | ~13-27 TRX | 0 TRX |
| SunSwap V2兑换 | ~65,000-200,000 | ~13-40 TRX | 0 TRX |
| 合约部署 | ~200,000-1,000,000+ | ~40-200+ TRX | 0 TRX |
| 代币授权 | ~30,000 | ~6-12 TRX | 0 TRX |
Commands
命令说明
1. Resource Info
1. 资源信息查询
bash
node scripts/tron_api.mjs resource-info --address <TRON_ADDRESS>Returns:
- Free Bandwidth: remaining / 600
- Staked Bandwidth: available / total
- Energy: available / total
- TRX frozen for Energy
- TRX frozen for Bandwidth
bash
node scripts/tron_api.mjs resource-info --address <TRON_ADDRESS>返回内容:
- 剩余免费Bandwidth:剩余量 / 600
- 已质押Bandwidth:可用量 / 总量
- Energy:可用量 / 总量
- 用于获取Energy的冻结TRX数量
- 用于获取Bandwidth的冻结TRX数量
2. Energy Estimation
2. Energy消耗估算
bash
node scripts/tron_api.mjs estimate-energy \
--contract <CONTRACT_ADDRESS> \
--function <FUNCTION_SIGNATURE> \
--params <PARAMS> \
--caller <CALLER_ADDRESS>Shortcut for common operations:
bash
undefinedbash
node scripts/tron_api.mjs estimate-energy \
--contract <CONTRACT_ADDRESS> \
--function <FUNCTION_SIGNATURE> \
--params <PARAMS> \
--caller <CALLER_ADDRESS>常见操作快捷命令:
bash
undefinedEstimate energy for USDT transfer
估算USDT转账的Energy消耗
node scripts/tron_api.mjs estimate-energy
--contract TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t
--function "transfer(address,uint256)"
--params "<TO_ADDRESS>,1000000"
--caller <YOUR_ADDRESS>
--contract TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t
--function "transfer(address,uint256)"
--params "<TO_ADDRESS>,1000000"
--caller <YOUR_ADDRESS>
Returns: estimated Energy consumption and equivalent TRX cost.node scripts/tron_api.mjs estimate-energy
--contract TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t
--function "transfer(address,uint256)"
--params "<TO_ADDRESS>,1000000"
--caller <YOUR_ADDRESS>
--contract TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t
--function "transfer(address,uint256)"
--params "<TO_ADDRESS>,1000000"
--caller <YOUR_ADDRESS>
返回内容:估算的Energy消耗量及对应的TRX成本。3. Bandwidth Estimation
3. Bandwidth消耗估算
bash
node scripts/tron_api.mjs estimate-bandwidth --tx-size <BYTES>Returns: estimated Bandwidth consumption, whether free allowance covers it.
bash
node scripts/tron_api.mjs estimate-bandwidth --tx-size <BYTES>返回内容:估算的Bandwidth消耗量,以及免费额度是否足以覆盖该消耗。
4. Current Energy Price
4. 当前Energy价格
bash
node scripts/tron_api.mjs energy-priceReturns: current Energy price in SUN (1 TRX = 1,000,000 SUN), TRX cost per 10,000 Energy, and recent price trend.
bash
node scripts/tron_api.mjs energy-price返回内容:当前Energy的SUN计价(1 TRX = 1,000,000 SUN)、每10,000 Energy对应的TRX成本,以及近期价格趋势。
5. Resource Rental Marketplace
5. 资源租赁市场信息
bash
node scripts/tron_api.mjs energy-rental --amount <ENERGY_NEEDED>Returns: available energy rental offers from third-party platforms with pricing.
Common rental platforms:
- TronNRG (https://tronnrg.com)
- JustLend Energy Rental
- Community energy providers
bash
node scripts/tron_api.mjs energy-rental --amount <ENERGY_NEEDED>返回内容:第三方平台提供的可用能源租赁报价及价格信息。
常见租赁平台:
- TronNRG (https://tronnrg.com)
- JustLend Energy Rental
- 社区能源供应商
6. Cost Optimization Report
6. 成本优化报告
bash
node scripts/tron_api.mjs optimize-cost --address <TRON_ADDRESS>Returns: personalized recommendations:
- How much TRX to freeze for typical usage pattern
- Whether renting energy is cheaper than freezing
- Whether burning TRX is acceptable for low-frequency usage
- Estimated monthly savings with different strategies
bash
node scripts/tron_api.mjs optimize-cost --address <TRON_ADDRESS>返回内容:个性化优化建议:
- 根据你的使用习惯,建议冻结的TRX数量
- 租赁能源是否比冻结TRX更划算
- 对于低频使用场景,燃烧TRX是否可行
- 不同策略下的月度预估节省金额
Decision Tree for Agents
Agent决策树
User wants to do a smart contract operation?
├── Check energy: resource-info --address <addr>
├── Has enough energy? → Proceed
└── Not enough energy?
├── Frequent user (daily TRC-20 transfers)?
│ └── Recommend: Freeze TRX for Energy (tron-staking)
├── Occasional user (1-2 tx/week)?
│ └── Recommend: Rent energy from marketplace
└── One-time user?
└── Recommend: Accept TRX burn (simplest)用户想要执行智能合约操作?
├── 检查Energy:resource-info --address <addr>
├── 拥有足够Energy? → 继续执行
└── Energy不足?
├── 高频用户(每日进行TRC-20转账)?
│ └── 建议:冻结TRX获取Energy(使用tron-staking技能)
├── 偶尔使用用户(每周1-2笔交易)?
│ └── 建议:从市场租赁能源
└── 一次性用户?
└── 建议:接受燃烧TRX(操作最简单)Important Notes
重要注意事项
- Energy and Bandwidth recover over 24 hours after use (not instant)
- Staked TRX earns Energy/Bandwidth continuously but is locked for minimum 14 days
- Delegated resources can be reclaimed after the lock period expires
- Energy price fluctuates based on network demand — check before large operations
- Free Bandwidth (600/day) is sufficient for ~2 basic TRX transfers daily
- Energy和Bandwidth在使用后会在24小时内逐渐恢复(并非即时恢复)
- 质押的TRX会持续产生Energy/Bandwidth,但存在至少14天的锁定期
- 委托的资源可在锁定期结束后收回
- Energy价格会随网络需求波动——执行大额操作前请先查询当前价格
- 每日600点的免费Bandwidth足以支持约2笔基础TRX转账