Getting Started with Java-tron: Launching Nodes and Basic Commands

·

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


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:


Step 1: Generate an Account

Use wallet-cli to create a key pair (public + private keys):

  1. Launch wallet-cli:

    $ java -jar wallet-cli.jar
  2. Register a wallet:

    wallet> registerwallet

    Follow prompts to set a password. The CLI saves your private key for transaction signing.


Step 2: Log In to wallet-cli

  1. Use the login command.
  2. Select your account and enter the password.
  3. Verify success: Login successful!.

Retrieve your address:

wallet> getaddress

Backup your private key securely:

wallet> backupwallet

Step 3: Launch Java-tron Node

Connect to the Nile testnet:

$ java -Xmx24g -XX:+UseConcMarkSweepGC -jar FullNode.jar -c nile_net_config.conf

Success logs indicate peer connections and block synchronization:

11:08:42.547 INFO [TronJClientWorker-1] [net] Connected to peer: 123.56.3.74:18888

Verify node status via HTTP:

$ curl http://127.0.0.1:16887/wallet/getnodeinfo

👉 Need help troubleshooting?


Step 4: Obtain TRX

Testnet TRX is free via the Nile Faucet. Mainnet TRX requires:

  1. Block rewards.
  2. Transfers from other accounts.
  3. Exchanges.

Step 5: Interact with Java-tron

Using wallet-cli

  1. Check balance:

    wallet> getbalance
  2. Transfer TRX:

    wallet> sendcoin <receiver_address> <amount>
  3. Query transactions:

    wallet> gettransactionbyid <txID>

Using Curl (HTTP)

  1. Get account balance:

    curl -X POST http://127.0.0.1:16887/wallet/getaccount -d '{"address": "<your_address>"}'
  2. Send unsigned transaction:

    curl -X POST http://127.0.0.1:16887/wallet/createtransaction -d '{"to_address": "...", "amount": 10000000}'
  3. 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.


👉 Master Java-tron with advanced tutorials