Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<h1 align="center">wallet-cli</h1>

<h4 align="center">
A command-line wallet for the <a href="https://tron.network">TRON network</a> — interactive in Java, agent-first in TypeScript
A command-line wallet for <a href="https://tron.network">TRON</a> and selected EVM networks — interactive in Java, agent-first in TypeScript
</h4>

<p align="center">
Expand All @@ -17,20 +17,20 @@ This repository holds **two independent implementations** that share the same pu
- **[Java](java/README.md)** — the original, full-featured reference CLI. An interactive prompt (REPL) you drive by hand.
- **[TypeScript](ts/README.md)** — an agent-first rewrite for automation. Standard subcommands with a stable JSON envelope, built for scripts, CI, and AI agents.

Both manage the same kind of wallet on the same networks — your address is identical regardless of which you use. They cover the same TRON feature surface and differ in how you install and drive them. Pick one and read its own README for depth; this page gives you the basics of each so you can choose.
Both manage TRON wallets, but they are independent implementations rather than interchangeable account stores. Do not assume every derived account has the same address across implementations: check the recorded BIP44 path when migrating. The TypeScript implementation additionally supports selected EVM networks.

## At a glance

| | [**Java**](java/README.md) — the original | [**TypeScript**](ts/README.md) — agent-first rewrite |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **What it is** | The mature, full-feature reference CLI. | A newer rewrite focused on programmatic integration. |
| **Runtime** | JVM — built with Gradle, run as a `.jar`. Uses the [Trident](https://github.com/tronprotocol/trident) SDK. | [Node.js](https://nodejs.org) **20+**. |
| **Install** | `git clone` + `./gradlew build` (see [Setup](java/README.md#setup)) | `npm install -g @tron-walletcli/wallet-cli` |
| **Install** | `git clone` + `cd wallet-cli/java && ./gradlew build` (see [Setup](java/README.md#setup)) | `npm install -g @tron-walletcli/wallet-cli` |
| **How you drive it** | An **interactive prompt only** — start it, then type commands at `>`. | **One-shot subcommands** — `wallet-cli <command>` from your shell. Interactive prompts only for secret input. |
| **Command style** | PascalCase verbs: `RegisterWallet`, `SendCoin`, `GetBalance`. Amounts in **SUN** (1 TRX = 1,000,000 SUN). | Noun-verb subcommands: `create`, `tx send`, `account balance`, with `--flags`. |
| **Output for scripts** | Human-readable text. | Stable JSON via `-o json` ([`wallet-cli.result.v1`](ts/docs/machine-interface.md)) + fixed exit codes (`0`/`1`/`2`). |
| **Config / networks** | `config.conf` (net type + full node), or `SwitchNetwork` at runtime. Mainnet · Nile · Shasta · custom. | `--network` flag / `config` command. `tron:mainnet` · `tron:nile` · `tron:shasta`. |
| **Signing** | Software keystore · Ledger. | Encrypted local keystore · Ledger. Secrets never via argv/env. |
| **Config / networks** | `config.conf` endpoints, or `SwitchNetwork` at runtime. Mainnet · Nile · Shasta · custom. | `--network` flag / `config` command. Three TRON networks plus Ethereum, Sepolia, BNB Smart Chain, and its testnet. |
| **Signing** | Software keystore · Ledger. | Encrypted local keystore · Ledger. Secrets enter via stdin/TTY, never argv or dedicated secret environment variables. |
| **Feature scope** | **The full surface** — wallets and transfers, staking, voting and rewards, governance, contracts, TRC10, and the on-chain exchange. | **The full surface** — HD wallets, TRX/TRC20/TRC10 transfers, staking & delegation, voting & rewards, governance proposals & super-representative operation, contract call/deploy/governance, TRC10 issuance, the on-chain Bancor exchange, multi-sig, GasFree transfers, message signing, and on-chain queries. |
| **Best for** | People at a terminal who want every TRON capability. | Scripting, CI pipelines, and AI agents. |
| **Full docs** | [java/README.md](java/README.md) | [ts/README.md](ts/README.md) |
Expand All @@ -41,9 +41,9 @@ Interactive only. Build it, start the prompt, then type commands:

```console
$ git clone https://github.com/tronprotocol/wallet-cli.git
$ cd wallet-cli && ./gradlew build && cd build/libs
$ cd wallet-cli/java && ./gradlew build && cd build/libs
$ java -jar wallet-cli.jar # opens the interactive prompt
> RegisterWallet 123456 # create a keystore (password 123456)
> RegisterWallet # prompts twice for the password, then for mnemonic length
> Login # unlock it
> GetAddress # your TRON address
> GetBalance # TRX balance
Expand All @@ -58,7 +58,7 @@ Install from npm, then run subcommands directly from your shell:
```console
$ npm install -g @tron-walletcli/wallet-cli
$ wallet-cli create --label main # prompts for a master password
$ wallet-cli account balance --network tron:nile
$ wallet-cli account balance --network tron:3448148188
$ wallet-cli account balance -o json # one wallet-cli.result.v1 JSON frame
```

Expand Down
10 changes: 5 additions & 5 deletions java/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ git clone https://github.com/tronprotocol/wallet-cli.git

### Configuration

A minimal `config.conf` only needs a network type and a full node to talk to:
A minimal `config.conf` needs a full-node endpoint. `net.type` does not select the network; it only controls whether `grpc.mainnet.apiKey` is applied. The startup network is inferred from the configured node endpoints.

```
net {
Expand All @@ -40,13 +40,13 @@ You can also switch networks at runtime with the [`SwitchNetwork`](docs/commands
- **Compile and run**:

```console
$ cd wallet-cli
$ cd wallet-cli/java
$ ./gradlew build
$ cd build/libs
$ java -jar wallet-cli.jar
```

wallet-cli connects to java-tron via the gRPC protocol, which can be deployed locally or remotely. Configure the java-tron node IP and port in `src/main/resources/config.conf`, or use `SwitchNetwork` to switch among mainnet, testnets (Nile and Shasta), and custom networks.
wallet-cli connects to java-tron via gRPC. At startup it first looks for `config.conf` in the current working directory, then falls back to the bundled classpath resource. Use `SwitchNetwork` to switch among mainnet, testnets (Nile and Shasta), and custom networks.

## Quickstart

Expand All @@ -55,13 +55,13 @@ Build, create an account, and send your first transfer — all from the interact
```console
# 1. Build
$ git clone https://github.com/tronprotocol/wallet-cli.git
$ cd wallet-cli && ./gradlew build && cd build/libs
$ cd wallet-cli/java && ./gradlew build && cd build/libs

# 2. Start the interactive wallet
$ java -jar wallet-cli.jar

# 3. In the wallet prompt: create an account (or ImportWallet), unlock, and inspect it
> RegisterWallet 123456 # create a keystore with password 123456
> RegisterWallet # prompts twice for the password, then for mnemonic length
> Login # unlock the account
> GetAddress # show your address
> GetBalance # TRX balance
Expand Down
8 changes: 5 additions & 3 deletions java/docs/commands/contract.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,18 +111,20 @@ Example:
## TriggerConstantContract

```console
> TriggerConstantContract [ownerAddress] contractAddress method args isHex fee_limit value token_value token_id
> TriggerConstantContract ownerAddress contractAddress method args isHex [value token_value token_id]
```

- `OwnerAddress` — the address of the account that initiated the transaction, optional, default is the address of the login account.
- `ownerAddress` — required. Pass a base58 address, or `#` to use the logged-in account.
- `contractAddress` — smart contract address.
- `method` — the name of the function and parameters; refer to the example.
- `args` — parameter value; if you want to call `receive`, pass `#` instead.
- `isHex` — the format of the parameters `method` and `args`; hex string or not.
- `fee_limit` — the most TRX allowed for consumption.
- `value` — optional call value in SUN; when supplied, `token_value` and `token_id` are required too.
- `token_value` — number of TRC10.
- `token_id` — TRC10 id; if not, use `#` instead.

The command accepts exactly five parameters without value/token fields, or eight parameters with all three optional fields. It does not take `fee_limit`.

Example:

```console
Expand Down
2 changes: 2 additions & 0 deletions java/docs/commands/multisig.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

Configure account permissions, co-sign transactions, inspect signature weight, and use TronLink multi-sign. For the underlying permission model, see [concepts/multisig](../concepts/multisig.md).

Many REPL write commands accept `-m` only as their final token. That switch routes the operation through the interactive multi-sign flow instead of the normal single-signer broadcast. Support is command-specific; use the command's built-in usage text before appending it.

## How to use the multi-signature feature of wallet-cli

Multi-signature allows other users to access the account in order to better manage it. There are three types of access:
Expand Down
7 changes: 4 additions & 3 deletions java/docs/commands/stake-v1-legacy.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ After the funds are frozen, the corresponding number of shares and bandwidth wil
**Freeze operation is as follows:**

```console
> freezeBalance [OwnerAddress] frozen_balance frozen_duration [ResourceCode:0 BANDWIDTH, 1 ENERGY] [receiverAddress]
> freezeBalance [OwnerAddress] frozen_balance frozen_duration [ResourceCode:0 BANDWIDTH, 1 ENERGY, 2 TRON_POWER] [receiverAddress]
```

- `OwnerAddress` — the address of the account that initiated the transaction, optional, default is the address of the login account.
- `frozen_balance` — the amount of frozen funds, the unit is Sun. The minimum value is **1000000 Sun (1 TRX)**.
- `frozen_duration` — freeze time, this value is currently only allowed for **3 days**.
- `ResourceCode` — `0` BANDWIDTH; `1` ENERGY; `2` TRON_POWER only when `getAllowNewResourceModel` is enabled. TRON_POWER cannot be delegated, so omit `receiverAddress` when using `2`.

For example:

Expand All @@ -33,7 +34,7 @@ After the freezing time expires, funds can be unfrozen.
**Unfreeze operation is as follows:**

```console
> unfreezeBalance [OwnerAddress] ResourceCode(0 BANDWIDTH, 1 CPU) [receiverAddress]
> unfreezeBalance [OwnerAddress] ResourceCode(0 BANDWIDTH, 1 ENERGY, 2 TRON_POWER) [receiverAddress]
```

## How to delegate resource
Expand All @@ -55,7 +56,7 @@ The latter two parameters are optional. If not set, the TRX is frozen to obtain
### UnfreezeBalance (undelegate)

```console
> unfreezeBalance [OwnerAddress] ResourceCode(0 BANDWIDTH, 1 CPU) [receiverAddress]
> unfreezeBalance [OwnerAddress] ResourceCode(0 BANDWIDTH, 1 ENERGY) [receiverAddress]
```

The latter two parameters are optional. If they are not set, the BANDWIDTH resource is unfrozen by default; when the `receiverAddress` is set, the delegated resources are unfrozen.
Expand Down
4 changes: 2 additions & 2 deletions java/docs/commands/stake-v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ FreezeV2-based staking, resource delegation, and unfreeze withdrawal — the cur

- `OwnerAddress` — the address of the account that initiated the transaction, optional, default is the address of the login account.
- `frozen_balance` — the amount of frozen, the unit is the smallest unit (Sun), the minimum is 1000000 sun.
- `ResourceCode` — 0 BANDWIDTH; 1 ENERGY.
- `ResourceCode` — `0` BANDWIDTH; `1` ENERGY; `2` TRON_POWER only when `getAllowNewResourceModel` is enabled.

Example:

Expand Down Expand Up @@ -60,7 +60,7 @@ wallet> GetTransactionById 82244829971b4235d98a9f09ba67ddb09690ac2f879ad93e09ba

- `OwnerAddress` — the address of the account that initiated the transaction, optional, default is the address of the login account.
- `unfreezeBalance` — the amount of unfreeze, the unit is the smallest unit (Sun).
- `ResourceCode` — 0 BANDWIDTH; 1 ENERGY.
- `ResourceCode` — `0` BANDWIDTH; `1` ENERGY; `2` TRON_POWER only when `getAllowNewResourceModel` is enabled.

Example:

Expand Down
2 changes: 1 addition & 1 deletion java/docs/commands/transfer-trc10.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ assetV2
Query the list of all the tokens by pagination. Returns a list of tokens that succeed the token located at offset.

```console
> ListAssetIssuePaginated address code salt
> ListAssetIssuePaginated offset limit
```

Example:
Expand Down
6 changes: 3 additions & 3 deletions java/docs/commands/vote-reward.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Voting requires share. Share can be obtained by freezing funds.
For example:

```console
> freezeBalance 100000000 3 1 address # Freeze 10TRX and acquire 10 units of shares
> freezeBalance 10000000 3 1 address # Freeze 10 TRX and acquire 10 units of shares

> votewitness 123455 witness1 4 witness2 6 # Cast 4 votes for witness1 and 6 votes for witness2 at the same time

Expand Down Expand Up @@ -97,15 +97,15 @@ Apply to become a super representative candidate.
```

```console
> CreateWitness TEDapYSVvAZ3aYH7w8N9tMEEFKaNKUD5Bp 007570646174654e616d6531353330363038383733343633
> CreateWitness TEDapYSVvAZ3aYH7w8N9tMEEFKaNKUD5Bp https://sr.example.com
```

### UpdateWitness

Edit the URL of the SR's official website.

```console
> UpdateWitness TEDapYSVvAZ3aYH7w8N9tMEEFKaNKUD5Bp 007570646174654e616d6531353330363038383733343633
> UpdateWitness TEDapYSVvAZ3aYH7w8N9tMEEFKaNKUD5Bp https://sr.example.com/v2
```

## ListWitnesses
Expand Down
2 changes: 1 addition & 1 deletion java/docs/commands/wallet.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Import a derived account from a Ledger device into wallet-cli.

```console
wallet> ImportWalletByLedger
((Note:This will pair Ledger to user your hardward wallet)
(Note:This will pair Ledger to user your hardware wallet)
Only one Ledger device is supported. If you have multiple devices, please ensure only one is connected.
Ledger device found: Nano X
Please input password.
Expand Down
8 changes: 4 additions & 4 deletions java/docs/guide/command-flow.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
A worked end-to-end example of an interactive session: build and run, register, back up, inspect, issue an asset, and transfer it.

```console
$ cd wallet-cli
$ cd wallet-cli/java
$ ./gradlew build
$ ./gradlew run
> RegisterWallet 123456 (password = 123456)
> login 123456
> RegisterWallet (prompts twice for the password, then for mnemonic length)
> login (prompts for the password)
> getAddress
address = TRfwwLDpr4excH4V4QzghLEsdYwkapTxnm' # backup it!
> BackupWallet 123456
> BackupWallet (prompts for the password)
priKey = 1234567890123456789012345678901234567890123456789012345678901234 # backup it!!! (BackupWallet2Base64 option)
> getbalance
Balance = 0
Expand Down
4 changes: 2 additions & 2 deletions java/docs/guide/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ Build, create an account, and send your first transfer — all from the interact
```console
# 1. Build
$ git clone https://github.com/tronprotocol/wallet-cli.git
$ cd wallet-cli && ./gradlew build && cd build/libs
$ cd wallet-cli/java && ./gradlew build && cd build/libs

# 2. Start the interactive wallet
$ java -jar wallet-cli.jar

# 3. In the wallet prompt: create an account (or ImportWallet), unlock, and inspect it
> RegisterWallet 123456 # create a keystore with password 123456
> RegisterWallet # prompts twice for the password, then for mnemonic length
> Login # unlock the account
> GetAddress # show your address
> GetBalance # TRX balance
Expand Down
Loading
Loading