Staking and Resources¶
Stake TRX to earn resources — energy and bandwidth — instead of burning TRX on every transaction. This walkthrough uses the stake commands on Nile. Background: Energy & bandwidth.
Password: a stake write command needs your master password on stdin (
--password-stdin) only when the selected mode signs, and signing shows no prompt. The examples below omit it to keep the resource flags in focus — prependprintf '%s' "$PW" |and append--password-stdin, or pipe from a password manager (see Getting started).--dry-run,--build-only,stake infoandstake delegatedneed no password.TRON only. Staking, delegation and resources are TRON protocol features; the
stakegroup fails on an EVM network withfamily_mismatch.
1. See what you have¶
Run a read-only query first. stake info gives a staking-focused overview (staked amount, per-resource limits, pending unstakes, TRON Power); for the used / limit breakdown of your resources, use account info:
wallet-cli account info --network nile
Label main
Address TMSgJxtPw29AFEHMXsjGo4kWV7UwbCToHJ
Balance 1,976.489 TRX
Staked 12 TRX (energy 12 + bandwidth 0)
Energy used 0 / 888
Bandwidth used 0 / 600
Created 2026-06-30
Permissions owner 1-of-1, 1 active group
Plain TRX transfers consume bandwidth; smart-contract calls (TRC20 transfers included) consume energy. Every activated account gets a small free bandwidth allowance (here 0 / 600). Energy, though, comes only from staking — this account shows 0 / 888 because it already has 12 TRX staked for energy (the Staked line); with nothing staked, energy is 0. When a resource runs out, the node burns TRX from your balance to cover the shortfall — staking is how you avoid that.
2. Stake for a resource¶
--amount-sun is raw SUN (1 TRX = 1,000,000 SUN). Stake 100 TRX for energy:
wallet-cli stake freeze --amount-sun 100000000 --resource energy --network nile
--resource chooses which resource the stake produces. It defaults to bandwidth; stake for energy when you plan to send TRC20 tokens or call contracts, since those spend energy (as in step 1). The TRX stays yours — it is locked, not spent — and staking also grants TRON Power (governance votes). Like the other stake write commands, stake freeze supports --dry-run, --sign-only, --build-only, --wait, and returns at submission by default.
Verify the effect by running account info again — the Energy limit now reflects the TRX you staked:
wallet-cli account info --network nile
3. Delegate resources to another address¶
Lend the resource your stake produces — for example, to a hot operations account so it can transact without holding staked TRX:
wallet-cli stake delegate --amount-sun 50000000 --resource energy --receiver TGkbaCYB4kRBc3Q6wjqkACefUvRwf2KzkH --network nile
By default you can reclaim a delegation at any time. Adding --lock blocks that until a lock period passes — set its length with --lock-period <blocks> (each block is ~3 seconds). Once delegated, use stake delegated any time to inspect your current delegations and the maximum you can delegate. To reclaim the resource later, run the opposite command, stake undelegate, with the same amount, receiver, and resource:
wallet-cli stake undelegate --amount-sun 50000000 --resource energy --receiver TGkbaCYB4kRBc3Q6wjqkACefUvRwf2KzkH --network nile
4. Unstake — a two-step exit, plus an undo¶
Unstaking is not instant; the chain imposes a waiting period — 14 days on mainnet (other networks may differ):
# step 1: request unstake — resources drop immediately, TRX enters the waiting queue
wallet-cli stake unfreeze --amount-sun 100000000 --resource energy --network nile
# step 2 (after the waiting period): claim the expired unstake back to balance
wallet-cli stake withdraw --network nile
# not a step — changed your mind before expiry? roll ALL pending unstakes back to staked
wallet-cli stake cancel-unfreeze --network nile
cancel-unfreeze cancels the exit rather than continuing it — it is all-or-nothing across pending unstakes, so you cannot roll back just part of one. Run it and there is nothing left for withdraw to claim. withdraw claims whatever has expired.
See also¶
Energy & bandwidth — the model behind these commands · account info · full flag reference for each stake subcommand: freeze · unfreeze · withdraw · cancel-unfreeze · delegate · undelegate · info · delegated