This guide explains how to launch a Java-tron node and interact with it using the command-line tool wallet-cli. Whether you're generating accounts, joining the TRON Nile testnet, or transferring TRX, this tutorial covers the essentials.
👉 Explore advanced Java-tron features
Prerequisites
- Java-tron installation: Download executable files or build from source (installation guide).
- wallet-cli: A TRON network CLI tool for seamless interaction with nodes.
Key Concepts
Java-tron is a Java-based TRON client that transforms your computer into a TRON network node. The decentralized network relies on nodes to validate and propagate blocks, maintaining account states (balances) for:
- External accounts: User-managed key pairs (addresses).
- Contract accounts: Execute code upon receiving transactions.
Step 1: Generate an Account
Use wallet-cli to create a key pair (public + private keys):
Launch wallet-cli:
$ java -jar wallet-cli.jarRegister a wallet:
wallet> registerwalletFollow prompts to set a password. The CLI saves your private key for transaction signing.
Step 2: Log In to wallet-cli
- Use the
logincommand. - Select your account and enter the password.
- Verify success:
Login successful!.
Retrieve your address:
wallet> getaddressBackup your private key securely:
wallet> backupwalletStep 3: Launch Java-tron Node
Connect to the Nile testnet:
$ java -Xmx24g -XX:+UseConcMarkSweepGC -jar FullNode.jar -c nile_net_config.confSuccess logs indicate peer connections and block synchronization:
11:08:42.547 INFO [TronJClientWorker-1] [net] Connected to peer: 123.56.3.74:18888Verify node status via HTTP:
$ curl http://127.0.0.1:16887/wallet/getnodeinfoStep 4: Obtain TRX
Testnet TRX is free via the Nile Faucet. Mainnet TRX requires:
- Block rewards.
- Transfers from other accounts.
- Exchanges.
Step 5: Interact with Java-tron
Using wallet-cli
Check balance:
wallet> getbalanceTransfer TRX:
wallet> sendcoin <receiver_address> <amount>Query transactions:
wallet> gettransactionbyid <txID>
Using Curl (HTTP)
Get account balance:
curl -X POST http://127.0.0.1:16887/wallet/getaccount -d '{"address": "<your_address>"}'Send unsigned transaction:
curl -X POST http://127.0.0.1:16887/wallet/createtransaction -d '{"to_address": "...", "amount": 10000000}'Broadcast signed transaction:
curl -X POST http://127.0.0.1:16887/wallet/broadcasttransaction -d '{"txID": "...", "signature": [...]}'
FAQ
How do I know my node is synced?
Compare local block height (/wallet/getnowblock) with Tronscan’s latest block.
What if my transaction fails?
Check logs for errors or use gettransactioninfobyid for detailed status.
How to securely store private keys?
Use encrypted keystore files and avoid sharing them.