Staking TRX for Energy and Bandwidth

TRON uses a resource model where TRX can be staked (frozen) to obtain energy and bandwidth, which are needed to execute transactions and smart contract calls.

Understanding Resources

ResourceUsed ForHow to Get
BandwidthAll transactions (transfers, contract calls)Stake TRX or use free daily allowance
EnergySmart contract execution (TRC20 transfers, DeFi)Stake TRX only

Check Current Resources

package main

import (
    "fmt"
    "log"

    "github.com/fbsobreira/gotron-sdk/pkg/client"
)

func main() {
    conn := client.NewGrpcClient("grpc.trongrid.io:50051")
    if err := conn.Start(); err != nil {
        log.Fatal(err)
    }
    defer conn.Stop()

    resource, err := conn.GetAccountResource("YOUR_ADDRESS")
    if err != nil {
        log.Fatal(err)
    }

    fmt.Printf("Energy: %d / %d\n",
        resource.GetEnergyUsed(),
        resource.GetEnergyLimit(),
    )
    fmt.Printf("Bandwidth: %d / %d\n",
        resource.GetFreeNetUsed(),
        resource.GetFreeNetLimit(),
    )
}

Freeze TRX for Energy

tx, err := conn.FreezeBalance(
    "OWNER_ADDRESS",
    "OWNER_ADDRESS", // delegate to self
    core.ResourceCode_ENERGY,
    1_000_000_000, // 1000 TRX in SUN
)
if err != nil {
    log.Fatal(err)
}
// Sign and broadcast tx...

Freeze TRX for Bandwidth

tx, err := conn.FreezeBalance(
    "OWNER_ADDRESS",
    "OWNER_ADDRESS",
    core.ResourceCode_BANDWIDTH,
    500_000_000, // 500 TRX in SUN
)

Vote for Super Representatives

After staking, you earn TRON Power (TP) equal to the amount of TRX staked. Use TP to vote for Super Representatives and earn daily rewards:

votes := map[string]int64{
    "SR_ADDRESS_1": 500,
    "SR_ADDRESS_2": 500,
}

tx, err := conn.VoteWitnessAccount("YOUR_ADDRESS", votes)
if err != nil {
    log.Fatal(err)
}

Using tronctl CLI

# Stake for energy
tronctl stake --from ADDRESS --amount 1000 --resource ENERGY

# Stake for bandwidth
tronctl stake --from ADDRESS --amount 500 --resource BANDWIDTH

# Vote for SR
tronctl vote --from ADDRESS --witness SR_ADDRESS --count 1000

# Check rewards
tronctl rewards ADDRESS

Resource Calculation

Energy obtained from staking depends on the total network staking:

Your Energy = (Your Staked TRX / Total Network Staked TRX) × Total Energy Limit

A typical USDT transfer costs ~65,000 energy. Check current rates before staking.

Next Steps