New Beta V2.1 Release!

Check out the latest version of the app. If you still want to use the legacy version, log in at app.chaingateway.io. Read more in our latest blog post.

Blog Post

Read our latest blog posts and stay updated with the latest trends and insights in the blockchain industry.
Explore a wide range of topics and discover valuable information that can help you enhance your knowledge and skills.

The Ultimate Guide To Calculate Tron Fees

Sep 18, 2024

Guide

The Ultimate Guide To Calculate Tron Fees

Tron (TRX) is one of the leading blockchain platforms that aims to decentralize the web by enabling efficient, scalable, and cost-effective transactions.Tron has quickly become a popular choice for decentralized applications (dApps), smart contracts, and cryptocurrency enthusiasts. With its 2.000 TPS (Transactions per seconds) it focuses alot on speed which makes it attractive for dApps developers.

To make it easier for you calculating the fees, we created an Tron Fee Calculator which will estimate the fees for your transaction

Why understanding Tron Fees is important

Like any blockchain, transactions on the Tron network come with associated fees. While these fees are much lower compared to some of its competitors like Ethereum, it’s crucial for anyone using the Tron to understand how these fees work. Fees on Tron can vary depending on the type of transaction, the complexity of smart contracts, and the availability of bandwidth and energy resources.

By understanding Tron fees, users can:

- Avoid overpaying for transactions.
- Optimize smart contracts to reduce energy consumption.
- Take advantage of the free daily bandwidth allowance.
- Utilize strategies like freezing TRX to minimize or eliminate fees altogether.

In this guide, we will break down how Tron’s fee structure works, what factors influence the cost of transactions, and how to calculate these fees manually or by using a free tool we’ve created just for you. Whether you’re a developer looking to deploy smart contracts or a casual user sending TRX, knowing how fees operate can save you money and make your Tron experience more efficient.

2. Overview of Tron Fees

What Are Tron Network Fees?

Tron network fees are the costs incurred when executing transactions or deploying smart contracts on the Tron blockchain. Unlike many other blockchains, Tron utilizes two key resources—Bandwidth Points and Energy—to handle fees, making its fee structure pretty unique compared to EVM Blockchains. These resources are used differently based on the type of transaction being processed, making it crucial to understand how they function.

  • Bandwidth Points for every kind of transactions, such as sending TRX TRC10 or TRC20 tokens between accounts.
  • Energy is consumed when executing smart contracts, especially TRC20 token transactions or complex dApps.

In Tron you are not paying your fees directly in TRX like on other blockchains like Ethereum or Binance Smart Chain, instead you are paying with those two resources.

Types of Tron Fees

Tron fees are categorized into two main types: Bandwidth Fees and Energy Fees, both of which have different purposes and usage scenarios.

Bandwidth Points

Bandwidth points are primarily used for basic transactions such as transferring TRX between accounts or sending TRC-10 tokens. Each Tron account is allocated a limited number of free bandwidth points daily, allowing users to make a certain number of transactions without incurring any fees.

How Bandwidth Points Work:

  • Bandwidth points are consumed with every transaction. For instance, a simple TRX transfer uses up bandwidth.
  • Every Tron user receives 600 free bandwidth points per day. Once this is exhausted, TRX is deducted as a fee for any additional transactions.
  • Bandwidth can also be obtained by freezing TRX, which allows users to generate bandwidth without incurring direct costs.
Energy Fees

Energy is required when executing smart contracts on the Tron network, such as interactions with TRC-20 tokens or dApp functions. Unlike bandwidth, energy is not freely available and must either be earned by freezing TRX or purchased via transaction fees in TRX.

How Energy Works:

  • Energy is consumed based on the complexity and computational needs of a smart contract. The more complex the contract, the more energy is required.
  • Users can freeze TRX to generate energy, thereby reducing their reliance on TRX fees when using dApps or deploying contracts.
  • If you don’t have enough energy, the equivalent cost will be deducted from your TRX balance.

Differences Between Bandwidth and Energy

  • Usage: Bandwidth is used for all transactions (e.g., TRX transfers), while energy is only used for more complex operations involving smart contracts (e.g., TRC-20 token interactions).
  • Free Allowance: Users get free daily bandwidth, but there is no free energy. Energy must be earned by freezing TRX or paid for in TRX fees.
  • Transaction Complexity: Bandwidth is sufficient for basic transactions, but for dApp developers and those interacting with smart contracts, energy is necessary as well.

Comparison with Other Blockchains

Tron’s fee system is different from other popular blockchains like Ethereum or Bitcoin, where transaction fees are paid directly in ETH or BTC. Here’s why Tron’s model stands out:

  • Lower Costs: Tron generally offers much lower fees due to its energy and bandwidth allocation model, making it attractive for users and developers alike.
  • More Predictable Fees: With free daily bandwidth and the ability to freeze TRX for energy, users can avoid unpredictable spikes in transaction costs.

Understanding how these resources function and how they impact Tron transactions is crucial for anyone looking to optimize their experience on the network. With this foundation, you’ll be better prepared to minimize your costs, whether you’re transacting TRX or interacting with smart contracts.

4. How to Calculate Tron Fees Manually

Understanding how to calculate Tron fees manually can help you manage transaction costs more effectively. Tron fees are primarily based on the consumption of Bandwidth Points and Energy, which are used differently depending on the type of transaction. In this section, we’ll walk you through the process of calculating both types of fees, using practical examples.

Step-by-Step Guide

1. Calculating Bandwidth Fees

For basic transactions, such as transferring TRX or TRC-10 tokens between wallets, you’ll primarily use Bandwidth Points. Tron automatically allocates 5,000 free bandwidth points per account daily. Once these are exhausted, the equivalent amount of TRX is deducted as a fee.

Here’s how to calculate the fee:

  • Check Your Available Bandwidth: Start by checking how much bandwidth you have remaining. You can do this through Tron wallet apps like TronLink or by querying your account using Tron’s block explorer.

  • Estimate the Bandwidth Consumption: Each TRX or TRC-10 transaction consumes a certain number of bandwidth points. For example:
    • A simple TRX transfer typically consumes 250–300 bandwidth points.
    • If your transaction exceeds your free daily bandwidth allocation, you’ll be charged in TRX for the remaining amount.
  • Calculate the Cost: If you run out of free bandwidth, Tron will charge 0.001 TRX per bandwidth point needed to complete the transaction.

Formula

If you want to calculate the Bandwidth points used by an transaction, you first need to create the transaction to receive the raw data hex for your transaction.

// Constants
DATA_HEX_PROTOBUF_EXTRA = 2 //Add PROTBUF Overhead
MAX_RESULT_SIZE_IN_TX = 64 //Add fixe sized overhead for Transaction Data
A_SIGNATURE = 67 //Add Overhead for the signature

// Example: Assume the raw_data_hex is a hex string of a transaction
// Example hex string for createdTransaction['raw_data_hex']:
createdTransactionRawDataHex = "0a020add22086c2763abadf9ed2940c8d5deea822e5a65080112610a2d747970652e676f6f676c6561706973
2e636f6d2f70726f746f636f6c2e5472616e73666572436f6e747261637412300a15418840e6c55b9ada326d211d818c34a994aeced808121541d31367
87e667d1e055d2cd5db4b5f6c880563049186470ac89dbea822e"  # Your Raw transaction result

// Bandwidth consumption calculation

# 1. Get the length of the hex string (16 characters in this case)
rawDataLengthInHex = length_of(createdTransactionRawDataHex)  # rawDataLengthInHex = 262

# 2. Convert the length from hex characters to bytes (divide by 2)
rawDataLengthInBytes = rawDataLengthInHex / 2  # rawDataLengthInBytes = 262 / 2 = 131 bytes

# 3. Add the fixed overheads
bandwidthConsumption = rawDataLengthInBytes              # 131 bytes
                      + DATA_HEX_PROTOBUF_EXTRA          # + 2 bytes
                      + MAX_RESULT_SIZE_IN_TX            # + 64 bytes
                      + A_SIGNATURE;                     # + 67 bytes


# Final bandwidth consumption
bandwidthConsumption = 8 + 3 + 64 + 67 - 1 = 264 bytes

// Output the bandwidth consumption
return bandwidthConsumption  # 264 bandwidth points
2. Calculating Energy Fees

Energy is consumed when interacting with smart contracts, such as when using TRC-20 tokens or interacting with decentralized applications (dApps). Unlike bandwidth, there’s no free daily energy allowance, and energy consumption can vary depending on the complexity of the smart contract.

Here’s how to calculate energy fees:

  • Check Your Energy Balance: Similar to bandwidth, you can check how much energy your account has via Tron wallets or the block explorer. Energy can be obtained by freezing TRX tokens or it can be deducted as a TRX fee.

  • Estimate the Energy Usage: Each smart contract transaction has a specific energy requirement based on the contract’s complexity. Simple contract interactions may consume 10,000–30.000 energy, while more complex contracts could consume 100,000+ energy.

  • Calculate the Energy Cost: If you don’t have enough energy, TRX will be burned from your wallet. Tron currently charges 0.00042 TRX per energy unit. This can change sometimes. You can find the latest Resource Costs on Tronscan

For estimating the energy consumption, there is an EstimateEnergy API available for tron nodes.

If you have no tron node available, just use our Tron Fee Calculator to estimate the energy consumption

Using our Tron Fee Calculator Tool

To decide between Staking, Burning, or using our Tron Paymaster API, we created a small calculator for estimating Energy and Bandwidth consumption.

You can use this tool also via API by subscribing to our Blockchain API

Tron Fee Calculator

Save Transaction Cost

Our customers were Suffering from High Transaction Cost on the Tron Network. Therefore we’ve developed the Tron Paymaster API which helps our customers automating the complete Fee Handling and save up to 60% on fees. We achive this by buying Energy from stakers in large margins and share them with our customers. Go and check out the new feature by subscribing to our 30 days Free Trial

Share This Post

Cookie Policy

We use cookies to enhance your experience. By continuing to visit this site, you agree to our use of cookies.