CLI tool for TRON blockchain operations via TronLink wallet signing.
All transactions are built locally and signed through the TronLink browser extension — private keys never leave TronLink.
- Node.js >= 20
- TronLink browser extension installed
- Browser running (write operations open TronLink for signing)
# From npm
npm install -g @tronlink/tronlink-cli
# Local development
npm install
npm run build
npm linkAfter installation, the tronlink command is available globally.
| Option | Default | Description |
|---|---|---|
--local-broadcast |
off | CLI broadcasts locally instead of letting signer broadcast |
--json |
off | Output as JSON for scripts / AI agents |
--api-key <key> |
- | TronGrid API key (or set TRON_API_KEY env) |
--timeout <ms> |
300000 | Signing/connection timeout in milliseconds |
All option names are case-insensitive (e.g. --toAddress, --TOADDRESS, --toaddress are equivalent).
Read commands support two modes:
- With
--address: queries directly via TronGrid, no wallet connection needed. Defaults to mainnet if--networkis omitted. - Without
--address: connects wallet to get real-time address and network from TronLink.
# Query all token balances
tronlink balance --address <address> [--network mainnet]
tronlink balance # connects wallet
# Query a specific TRC20 token balance (decimals auto-detected)
tronlink balance --address <address> --token <contract> [--decimals 6] [--network mainnet]
# Query a specific TRC10 token balance (decimals auto-detected)
tronlink balance --address <address> --tokenId <id> [--decimals 6] [--network mainnet]
# Query energy & bandwidth
tronlink resource --address <address> [--network nile]
tronlink resource # connects walletMainnet tokens queried: TRX, USDT, USDD, USDC, SUN, JST, BTT, WIN, WTRX Nile tokens queried: TRX, USDT Shasta tokens queried: TRX
# TRX (amount in TRX, not sun)
tronlink transfer --type trx --toAddress <to> --amount <amount> [--network nile]
# TRC10 (decimals auto-detected or specify --decimals)
tronlink transfer --type trc10 --tokenId <id> --toAddress <to> --amount <amount> [--decimals 6] [--network nile]
# TRC20 (decimals auto-detected; optional --fee-limit in TRX, default 100)
tronlink transfer --type trc20 --contract <contract> --toAddress <to> --amount <amount> [--decimals 6] [--fee-limit 150] [--network nile]
# TRC721 NFT (optional --fee-limit in TRX, default 100)
tronlink transfer --type trc721 --contract <contract> --toAddress <to> --tokenId <id> [--fee-limit 150] [--network nile]Examples:
tronlink transfer --type trx --toAddress TYqx5gm3p3wLDE9Bv8TBJAbK4ELNbSLfJV --amount 100
tronlink transfer --type trc20 --contract TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t --toAddress TYqx5gm3p3wLDE9Bv8TBJAbK4ELNbSLfJV --amount 50
tronlink transfer --type trc721 --contract TContractAddr --toAddress TRecipient --tokenId 12345Parameter validation per type:
| Type | Required | Not allowed |
|---|---|---|
| trx | --toAddress, --amount |
--tokenId, --contract, --decimals, --fee-limit |
| trc10 | --toAddress, --amount, --tokenId |
--contract, --fee-limit |
| trc20 | --toAddress, --amount, --contract |
--tokenId |
| trc721 | --toAddress, --contract, --tokenId |
--amount, --decimals |
# Stake TRX for energy or bandwidth
tronlink stake --amount <amount> --resource <energy|bandwidth> [--network nile]
# Unlock staked TRX
tronlink unstake --amount <amount> --resource <energy|bandwidth> [--network nile]
# Withdraw unfrozen TRX (after 14-day unlock period)
tronlink withdraw [--network nile]# Delegate energy or bandwidth (lock-period in days, supports decimals e.g. 1.5)
tronlink delegate --toAddress <to> --amount <amount> --resource <energy|bandwidth> [--lock-period <days>] [--network nile]
# Reclaim delegated resources
tronlink reclaim --fromAddress <from> --amount <amount> --resource <energy|bandwidth> [--network nile]# Vote for super representatives (format: address:count, supports multiple)
tronlink vote --votes <address:count...> [--network nile]
# Claim voting rewards
tronlink reward [--network nile]Examples:
tronlink vote --votes TXxx:5 TYyy:3 TZzz:2
tronlink rewardWrite operations (transfer, stake, delegate, vote, etc.) require TronLink approval in the browser:
- CLI builds the transaction locally and displays a preview
- Browser opens the TronLink Signer approval page
- User reviews and clicks Approve or Reject
- Result is returned to the CLI
The browser window is reused across multiple commands — only one browser tab is needed per session. Closing the browser tab ends the session.
Multiple concurrent commands are supported. The browser UI shows each pending request as its own tab; approve them in any order.
Cancelling a command (Ctrl+C) cancels only that transaction. Other queued transactions are unaffected.
All write operations display a preview before signing:
Transaction Preview
┌───────────┬────────────────────────────────────────┐
│ Action │ Transfer TRX │
│ Network │ nile │
│ From │ TXxx... │
│ To │ TYyy... │
│ Amount │ 100 TRX │
│ Broadcast │ Signer │
└───────────┴────────────────────────────────────────┘
Awaiting TronLink approval...
By default, signed transactions are broadcast by the signer (TronLink). Use --local-broadcast to have the CLI broadcast locally via its own TronWeb instead:
# Default: signer broadcasts after signing
tronlink transfer --type trx --toAddress TYqx5gm3p3wLDE9Bv8TBJAbK4ELNbSLfJV --amount 100
# CLI broadcasts locally
tronlink transfer --type trx --toAddress TYqx5gm3p3wLDE9Bv8TBJAbK4ELNbSLfJV --amount 100 --local-broadcastAll inputs are validated before connecting to TronLink:
- Amounts: non-negative numbers only, no scientific notation, no multiple decimals
- TRX amounts: must be > 0, within safe integer range after sun conversion
- TRC20/TRC10 amounts: decimal places must not exceed the token's decimals. Decimals auto-detected from chain if
--decimalsis omitted - Addresses: valid TRON address format (verified via
TronWeb.isAddress()) - Contract existence: verified on the specified network before querying decimals
- Vote counts: positive integers, no duplicate SR addresses
- Network: must be
mainnet,nile, orshasta - Decimals: non-negative integer (0-77)
- Fee limit: positive number in TRX (TRC20/TRC721 only)
- Transfer type validation: missing required params or extra inapplicable params are rejected with clear errors
Invalid inputs are rejected immediately with a clear error before any wallet interaction.
Table (default): Human-readable table output.
JSON (--json): Machine-readable output for scripts and AI agents.
| Network | API Endpoint | Explorer |
|---|---|---|
| mainnet | https://api.trongrid.io |
https://tronscan.org |
| nile | https://nile.trongrid.io |
https://nile.tronscan.org |
| shasta | https://api.shasta.trongrid.io |
https://shasta.tronscan.org |
- CLI parses command and validates all inputs
- For read operations with
--address: queries TronGrid directly - For write/read without
--address: connects to the TronLink browser extension for wallet info - Builds unsigned transaction using local TronWeb
transactionBuilder - Sends transaction to TronLink for signing (browser approval page)
- Broadcasts: signer broadcasts by default (returns txId); with
--local-broadcast, CLI broadcasts locally and verifies the result - Outputs result
TronLink CLI supports AI agent integration via --json output. All commands return structured JSON for easy parsing.
tronlinkinstalled globally (npm i -g @tronlink/tronlink-cli)- TronLink browser extension installed and unlocked
- Browser running (write operations open TronLink for signing)
- Always append
--jsonto get machine-readable output - Write operations (transfer, stake, vote, etc.) will open the browser for user signing — wait for the command to return (default timeout: 5 minutes)
- Read operations with
--addressdon't need wallet connection, faster for lookups - Use
--networkto specify network, otherwise defaults to wallet's current network (write) or mainnet (read with address) - Cancelling a command (Ctrl+C) cancels only that transaction, not the signing session
# Check all token balances
tronlink balance --address <address> --network mainnet --json
# Check a specific TRC20 token balance
tronlink balance --address <address> --token <contract> --network mainnet --json
# Check a specific TRC10 token balance
tronlink balance --address <address> --tokenId <id> --network mainnet --json
# Check energy & bandwidth
tronlink resource --address <address> --network mainnet --json# TRX
tronlink transfer --type trx --toAddress <to> --amount <amount> --json
# TRC20 (decimals auto-detected)
tronlink transfer --type trc20 --contract <contract> --toAddress <to> --amount <amount> --json
# TRC10 (decimals auto-detected)
tronlink transfer --type trc10 --tokenId <id> --toAddress <to> --amount <amount> --json
# TRC721 NFT
tronlink transfer --type trc721 --contract <contract> --toAddress <to> --tokenId <id> --jsontronlink stake --amount <amount> --resource energy --json
tronlink unstake --amount <amount> --resource energy --json
tronlink withdraw --jsontronlink delegate --toAddress <to> --amount <amount> --resource energy --json
tronlink reclaim --fromAddress <from> --amount <amount> --resource energy --jsontronlink vote --votes <addr:count...> --json
tronlink reward --json| Token | Network | Contract |
|---|---|---|
| USDT | mainnet | TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t |
| USDD | mainnet | TXDk8mbtRbXeYuMNS83CfKPaYYT8XWv9Hz |
| USDC | mainnet | TEkxiTehnzSmSe2XqrBj4w32RUN966rdz8 |
# 1. Check balance first
tronlink balance --address TNPeeaaFB7K9cmo4uQpcU32zGK8G1NYqeL --network mainnet --json
# 2. Send 10 TRX (opens browser for signing, wait for return)
tronlink transfer --type trx --toAddress TRecipientAddress --amount 10 --network mainnet --json
# 3. Verify result — output includes txId and explorer URL
# { "Status": "Success", "TxID": "abc...", "Explorer": "https://tronscan.org/#/transaction/abc..." }- All write commands block until the user approves/rejects in TronLink browser popup
- If the user rejects or the signing times out (5 min), the command exits with an error
- Cancelling a CLI command (Ctrl+C) cancels only that transaction — other queued transactions continue
- Use
--timeout <ms>to adjust the signing timeout - Amounts use string-based math internally — no floating point precision issues
MIT License Copyright (c) 2026 TronLink