⚙️ Tronsell Wiki

Full Node Development — Building on TRON's Java-tron

Comprehensive guide to full node development on TRON. Covers Java-tron architecture, API integration, custom plugin development, performance optimization, and advanced node customization.

⚙️ Full Node Development at a Glance
Core FrameworkJava-tron
Primary LanguageJava
API ProtocolgRPC / HTTP / WebSocket
Plugin SystemInterface-based
Build ToolGradle

📖 Introduction to Full Node Development

Full node development on TRON involves building applications, plugins, and custom solutions that interact with or extend the Java-tron node software. This is the most advanced level of TRON development, requiring a deep understanding of the blockchain's inner workings.

Whether you're building a custom API gateway, creating a monitoring dashboard, developing a specialized plugin, or optimizing node performance for enterprise use, full node development gives you complete control over how you interact with the TRON network.

💡 Who Needs Full Node Development?

Use cases include: exchanges requiring high-throughput transaction processing, enterprise blockchain solutions needing custom integrations, analytics platforms building on-chain data pipelines, and node operators optimizing for performance and reliability.

🏗️ Java-tron Architecture Overview

Java-tron is the reference implementation of the TRON protocol, written in Java. Its modular architecture consists of several key layers:

🧩
Actuator Layer

Executes smart contract transactions and updates the state tree. Includes contract-specific actuators for TRC10, TRC20, and custom contracts.

📦
Manager Layer

Manages blocks, transactions, and the blockchain state. Handles block validation, transaction processing, and chain reorganization.

💾
Storage Layer

Provides database interfaces for persistent storage. Uses LevelDB and RocksDB for key-value storage of blockchain data.

🔌
API Layer

Exposes gRPC, HTTP, and WebSocket interfaces for external interaction. Includes wallet, contract, and monitoring APIs.

// Simplified Java-tron component structure
public class TronApplication {
  private ActuatorManager actuatorManager;
  private BlockManager blockManager;
  private StorageManager storageManager;
  private ApiService apiService;
  private PluginManager pluginManager;
}

🔌 Node APIs: gRPC, HTTP, and WebSocket

TRON nodes expose multiple APIs for external interaction. Understanding these APIs is essential for building applications that communicate with the node.

API TypePort (Default)ProtocolPrimary Use
gRPC API50051gRPC/ProtobufHigh-performance programmatic access, transaction submission, contract calls
HTTP REST API8090HTTP/JSONWallet operations, contract queries, block/transaction lookup
WebSocket API18888 (or custom)WebSocketReal-time event streaming, block notifications, transaction monitoring
// gRPC client example (using Java)
var channel = ManagedChannelBuilder.forAddress("localhost", 50051).usePlaintext().build();
var stub = WalletGrpc.newBlockingStub(channel);
var request = AccountResourceMessage.newBuilder().setAddress(address).build();
var response = stub.getAccountResource(request);

// HTTP API example (curl)
// Get account balance
curl -X POST http://localhost:8090/wallet/getaccount -d '{"address": "41..."}'
💡 Choosing the Right API

Use gRPC for high-volume, low-latency production applications. Use HTTP for simple queries, debugging, and wallet interactions. Use WebSocket for real-time monitoring and event-driven architectures.

🧩 Building Custom Plugins

Java-tron supports a plugin system that allows developers to extend node functionality without modifying the core codebase. Plugins can intercept events, add custom RPC endpoints, monitor node health, or implement custom business logic.

Plugin Development Steps

  • Implement PluginInterface — Create a Java class that implements the PluginInterface from the Java-tron API.
  • Define lifecycle methods — Implement start(), stop(), and onBlock() methods to handle node events.
  • Package as JAR — Build the plugin as a JAR file with all dependencies.
  • Deploy to node — Place the JAR in the plugins directory and configure in config.conf.
// Basic plugin template
import org.tron.core.plugin.PluginInterface;

public class CustomPlugin implements PluginInterface {
  @Override
  public void start() {
    System.out.println("Custom plugin started");
  }

  @Override
  public void stop() {
    System.out.println("Custom plugin stopped");
  }

  @Override
  public void onBlock(Block block) {
    // Custom logic for each new block
    System.out.println("New block: " + block.getBlockId());
  }
}
💡 Plugin Use Cases

Common plugin applications: transaction monitoring (track specific addresses), custom analytics (compute on-chain metrics), alerts (notify when certain events occur), data export (stream blockchain data to external databases), and custom authentication (secure node access).

⚡ Performance Optimization

Optimizing a TRON full node for performance is critical for production deployments handling high transaction volumes.

  • JVM Tuning — Adjust heap size (-Xmx), garbage collection settings (-XX:+UseG1GC), and thread stack sizes for optimal performance.
  • Storage Optimization — Use high-performance NVMe SSDs, enable database compression, and implement proper indexing strategies.
  • Network Optimization — Adjust P2P connection limits, enable fast sync mode, and optimize peer selection algorithms.
  • Thread Pool Configuration — Tune executor service thread pools for transaction processing, block validation, and API serving.
  • Database Caching — Enable LevelDB/RocksDB block cache and table cache for faster data access.
  • Batch Processing — Process transactions and blocks in batches to reduce overhead.
# JVM performance tuning options
java -Xmx32g -Xms16g -XX:+UseG1GC \
  -XX:MaxGCPauseMillis=200 \
  -XX:ParallelGCThreads=8 \
  -jar FullNode.jar -c config.conf
💡 Benchmarking

Use tools like JMH (Java Microbenchmark Harness) to benchmark specific node components. Monitor key metrics: transactions per second, block propagation time, and API response latency.

🗄️ Custom Database Integration

For advanced use cases, you can integrate custom databases to store and index blockchain data for analytics or specialized applications.

  • PostgreSQL/MySQL — Store transaction history and account data for SQL-based analytics.
  • Elasticsearch — Build searchable indices for transaction and address lookup.
  • Time-series databases — Monitor node performance metrics with InfluxDB or Prometheus.
  • Data pipelines — Use Apache Kafka to stream blockchain data to multiple consumers.

Implement a plugin that listens to block events and writes data to your custom database. This approach gives you full control over data indexing and query performance.

⚡ Real-time Data Pipeline

For enterprise applications, build a real-time data pipeline: Java-tron → Plugin → Kafka → Consumer → Database → API. This architecture scales horizontally and supports multiple data consumers.

🔍 Debugging & Monitoring Tools

Effective debugging and monitoring are essential for maintaining a healthy node.

  • Log Analysis — Configure detailed logging with logback. Monitor logs for errors, warnings, and performance bottlenecks.
  • JMX Monitoring — Enable JMX to monitor JVM metrics (memory, CPU, threads, garbage collection).
  • Metrics Export — Use Prometheus to collect and visualize node metrics with Grafana dashboards.
  • Heap Dumps — Analyze heap dumps with tools like Eclipse MAT to identify memory leaks.
  • Database Inspection — Use LevelDB/RocksDB tools to inspect database content and performance.
# Enable JMX for remote monitoring
java -Dcom.sun.management.jmxremote \
  -Dcom.sun.management.jmxremote.port=9999 \
  -Dcom.sun.management.jmxremote.authenticate=false \
  -Dcom.sun.management.jmxremote.ssl=false \
  -jar FullNode.jar -c config.conf

🏆 Development Best Practices

  • Use version control — Track your custom code and configuration changes with Git.
  • Write comprehensive tests — Unit test plugins and extensions using JUnit.
  • Document your code — Maintain clear documentation for all custom modules and APIs.
  • Follow security best practices — Never hardcode secrets, use secure key management, and implement proper authentication.
  • Monitor performance — Continuously monitor node performance and optimize as needed.
  • Stay updated — Keep Java-tron updated with the latest releases and security patches.
  • Use feature flags — Implement feature flags to safely deploy new functionality.

❓ Frequently Asked Questions

What is full node development on TRON?

Full node development on TRON involves building applications, plugins, and custom solutions that interact with or extend the Java-tron node software. This includes developing custom APIs, implementing event listeners, building monitoring tools, and optimizing node performance for specific use cases.

What is the architecture of Java-tron?

Java-tron is built on a modular architecture with key components: the Actuator layer (executes smart contracts), the Manager layer (manages blocks, transactions, and state), the Storage layer (database interfaces), and the API layer (gRPC and HTTP interfaces). Developers can extend this architecture through custom plugins and service implementations.

How do I build custom plugins for TRON nodes?

You can build custom plugins for TRON nodes by implementing the PluginInterface in Java. Plugins can intercept block production, monitor transactions, add custom RPC endpoints, or extend the node's functionality. You package your plugin as a JAR and place it in the plugins directory of the Java-tron installation.

What APIs are available for TRON node development?

TRON nodes expose several APIs: gRPC API (port 50051) for high-performance programmatic access, HTTP REST API (port 8090) for wallet and contract operations, and a WebSocket API for real-time event streaming. Developers can also expose custom APIs through plugins.

How do I optimize a TRON full node for high performance?

Performance optimization strategies include: tuning JVM heap settings, using high-performance SSD storage, implementing database indexing, enabling fast sync mode, adjusting thread pool sizes, using efficient data serialization, and optimizing network parameters. For high-traffic applications, consider load balancing and read replicas.

What are the security considerations for full node development?

Security considerations include: never storing private keys in plain text, implementing proper authentication for APIs, using secure communication (TLS/SSL), validating all external inputs, running the node with minimal privileges, regularly updating dependencies, and implementing monitoring for suspicious activity.

⚡ Build with Tronsell Energy

Integrate Tronsell Energy into your zero-fee USDT transfer contracts. Simple API, instant delivery.