wallet-cli¶
wallet-cli is a command-line wallet for the TRON network; its official repository is
tronprotocol/wallet-cli. It manages keys and accounts locally
and talks to a TRON node primarily over gRPC (through the
Trident SDK) to query chain data and build, sign, and
broadcast transactions. A few features (such as GasFree fee-delegated transfers) instead call the
relevant service over HTTP.
It offers two ways to drive it:
- Interactive (REPL) mode — a human-friendly shell with tab completion and interactive prompts. Best for manual exploration and day-to-day wallet management.
- Standard CLI mode — a non-interactive, scriptable interface with deterministic exit codes and optional JSON output. Best for automation, scripts, CI/CD, and AI agents.
Every command in this documentation is shown in both modes wherever it exists in both. Use the tabs to switch:
java -jar build/libs/wallet-cli.jar --network nile get-account --address TXyz...
GetAccount TXyz...
Build¶
wallet-cli is built with Gradle and requires Java 8.
# Build the project (also generates protobuf sources into src/main/gen/)
./gradlew build
# Build the fat JAR (output: build/libs/wallet-cli.jar)
./gradlew shadowJar
After shadowJar, you can run the wallet from the produced JAR:
java -jar build/libs/wallet-cli.jar
Run¶
Interactive (REPL) mode¶
Launch the interactive shell with no command. Either of these works:
./gradlew run
# or, from the built JAR:
java -jar build/libs/wallet-cli.jar
You then type commands at the prompt (for example Login, GetBalance, SendCoin ...). Command
names are case-insensitive and support tab completion. Type Help to list commands, or
Help <Command> for details on one command.
Standard CLI mode¶
Pass a command (and its options) on the command line. The process runs the single command, prints the result, and exits:
java -jar build/libs/wallet-cli.jar --network nile get-balance --address TXyz...
java -jar build/libs/wallet-cli.jar --output json --network nile get-account --address TXyz...
Standard CLI command names use kebab-case (get-account, send-coin); most commands also accept a
no-dash alias (getaccount, sendcoin). Not every command registers one — the alias-* commands,
for example, are only available in their dashed form.
There is also a help command for per-command usage:
java -jar build/libs/wallet-cli.jar help --command send-coin
Global options (Standard CLI)¶
Global options come before the command name. They are parsed by GlobalOptions.
| Option | Values | Description |
|---|---|---|
--network |
main, nile, shasta, custom |
Select the network to connect to. |
--grpc-endpoint |
host:port |
Override the gRPC endpoint (used with --network custom). |
--output |
text (default), json |
Output format. |
--wallet |
name or path | Select a specific wallet keystore by name or path. |
--quiet |
flag | Suppress non-essential informational output. |
--verbose |
flag | Enable debug logging. (Conflicts with --quiet.) |
--password-stdin |
flag | Read the wallet password from stdin (overrides MASTER_PASSWORD). |
--interactive |
flag | Launch the interactive REPL instead of running a command. |
--help, -h |
flag | Show global help, or help for the named command. (The help --command <name> command does the same.) |
--version |
flag | Print version information. |
Notes:
--outputand--networkaccept their value either as the next token (--network nile) or inline (--network=nile).- Options that take a value cannot be repeated, and unknown global options are rejected.
Authentication (Standard CLI)¶
Standard CLI mode is non-interactive, so it never prompts for a password. Commands that build and sign a transaction (marked requires auth in this documentation) authenticate automatically:
- The wallet password is read from the
MASTER_PASSWORDenvironment variable, or from stdin when--password-stdinis passed (stdin takes precedence). - The keystore is loaded from the
Wallet/directory. Use--wallet <name|path>to pick a specific wallet, or set an active wallet withset-active-wallet(see Wallet Management).
Most read-only query commands do not require authentication. The exceptions are queries that act on
the current wallet: get-address always requires auth, and get-balance / get-usdt-balance /
gas-free-info require auth when --address is omitted (see Queries and
GasFree).
export MASTER_PASSWORD='your-wallet-password'
java -jar build/libs/wallet-cli.jar --network nile send-coin --to TXyz... --amount 1000000
The REPL handles authentication differently: you log in interactively with Login / LoginAll
and the session stays unlocked. See Wallet Management.
JSON output and exit codes (Standard CLI)¶
With --output json, every command emits a single JSON envelope on stdout.
Success:
{
"success": true,
"data": { }
}
Error:
{
"success": false,
"error": "execution_error",
"message": "human-readable explanation"
}
Additional rules:
- Commands that broadcast a transaction include the transaction id as
txidindata(single-signature broadcasts only). deploy-contractincludes the deployedcontract_addressindata.- When an alias is resolved for an option, the envelope includes a
meta.resolvedarray describing the resolution (see the alias system in Wallet Management).
Exit codes:
| Code | Meaning |
|---|---|
0 |
Success. |
1 |
Execution error ("error": "execution_error" and others). |
2 |
Usage error ("error": "usage_error" — bad flags, missing required option, etc.). |
This makes the standard CLI safe to drive from scripts: check the exit code, and parse the single JSON object from stdout.
Networks and configuration¶
The default node endpoints for each network, plus other defaults, live in
src/main/resources/config.conf (HOCON format). The --network flag selects among main, nile
(testnet), shasta (testnet), and custom. For custom, provide the endpoint with
--grpc-endpoint host:port.
In the REPL, use SwitchNetwork to change networks and CurrentNetwork to see the active one.
Command reference¶
Commands are grouped by domain:
- Wallet Management — create/import/export wallets, login, backup, lock, active wallet, aliases.
- Accounts — on-chain account creation and updates, balances, permissions.
- Staking & Resources — freeze/unfreeze (v1 & v2), resource delegation, rewards.
- Transactions — transfer TRX/assets/USDT, multi-signature signing, broadcast.
- Smart Contracts — deploy, trigger, constant calls, energy estimation.
- TRC-10 Assets — issue, update, participate, transfer, and query TRC-10 tokens.
- Governance — witnesses, voting, proposals, brokerage, reward withdrawal.
- GasFree — gas-free (sponsored) USDT transfers.
- Queries — blocks, transactions, chain parameters, prices, nodes, and utilities.