Skip to main content
TLDR:
  • Explains TRON’s unique fee model with Energy and Bandwidth resources that can reduce transaction costs to zero.
  • Demonstrates how to freeze (stake) TRX to gain daily allocations of Energy for smart contracts and Bandwidth for basic transactions.
  • Shows how to use Python and Chainstack TRON nodes to manage resources, check balances, and execute transactions.
  • Provides a complete script to freeze/unfreeze TRX, monitor resource usage, and optimize transaction fees.

Overview

The short version is if you stake your TRX (called Freezing), you will get your daily allowance of gas free EOA to EOA transactions (Bandwidth allocation) and EOA to contract transactions (Energy allocation). EOA to EOA transactions are called Bandwidth-consuming transactions. EOA to contract transactions are called Energy-consuming transactions. TRON’s unique fee model revolves around two core resources—Energy and Bandwidth. Mastering how these resources function allows developers and users to significantly reduce transaction costs, potentially to zero. This article will guide you through understanding and managing TRON resources using Python and a Chainstack TRON nodes, offering practical examples and scripts to streamline your interaction with the TRON blockchain.
For the detailed TRON Resource Model overview, see TRON docs: Resource Model.

Bandwidth

Bandwidth on TRON is consumed by basic operations such as sending TRX or TRC-10 tokens (TRC-10s are like colored coins—they are similar to TRC-20 but don’t involve an actual smart contract processing). Accounts receive daily free bandwidth based on their state, but heavy usage can quickly exhaust these allowances.

Energy

Energy powers smart contract executions, including TRC-20 token interactions. Without sufficient Energy, transactions consume TRX as fees.

Freezing TRX

Freezing is pretty much staking. Freezing (staking) TRX grants daily Energy or Bandwidth, enabling fee-free transactions. You can reclaim your frozen TRX after a 3-day staking period.

Implementation

Let’s do a full cycle script that retrieves the account’s Energy and Bandwidth data from the chain, stakes (freezes) and unstakes (unfreezes) the TRXs.

Prerequisites

  1. Python 3.7+
  2. Chainstack account to deploy a reliable TRON RPC endpoint. Make sure you pick the HTTP API endpoint that looks like this https://tron-nile.core.chainstack.com/11112222333444555666677778888/wallet
  3. A TRON account with a private key and some TRX balance that you can get from the Nile faucet

Install dependencies

Connect to Chainstack Node

In your Python script, connect to your Chainstack node:

Generate or load a TRON account

Create a new account:
Or load your existing key:

Check resources by retrieving the data from the chain

Retrieve your current Bandwidth and Energy:

Freeze TRX for resources

Freeze TRX to gain Energy:

Send TRX with minimal fees

Execute a simple TRX transaction:

Verify transaction fees

Check the fees for your transaction:

Unfreeze TRX

Note that on the mainnet it’ll take 3 days to unstake.
Reclaim your staked TRX:

Full script

Last modified on April 13, 2026