Skip to content

Design of a Secure IPC and JSON-RPC Based Administration Framework for FullNode #6497

Description

@317787106

Background

After a FullNode is started, its runtime status must be continuously monitored in real time . Once an abnormal condition is detected, timely manual intervention should be possible, such as dynamically adjusting startup or runtime parameters. Currently, the system lacks an effective mechanism to interact with the node. In most abnormal scenarios, recovery can only be achieved by restarting the node, which inevitably interrupts the services provided by the FullNode and negatively impacts overall stability and availability.

Although the existing configuration file provides the node.dynamicConfig capability, its functionality is relatively limited, lacks extensibility, and provides no real-time feedback to users. As a result, it does not adequately meet operational and debugging requirements. To address these limitations, we designed and implemented a real-time interaction mechanism for FullNode based on a UNIX Server Socket combined with a JSON-RPC service bound only to the local network interface. This approach significantly improves system flexibility, operability, and issue-handling efficiency while maintaining strong security guarantees.

Rationale

Why should this feature exist?

This solution enables real-time, bidirectional interaction with a FullNode, rather than being limited to passive reading of node status or information. It greatly improves troubleshooting and debugging efficiency, simplifies node management workflows, and supports rapid intervention in abnormal scenarios, ultimately ensuring the overall stability and availability of the service.

What are the use-cases?

  • Support dynamic management of node connections, including operations such as AddPeer, RemovePeer, AddTrustedPeer, and RemoveTrustedPeer, enabling flexible runtime adjustment of peers and related policies.
  • Support querying all runtime non-sensitive parameters, not limited to the information currently exposed by org.tron.core.services.NodeInfoService, thereby improving observability and operational transparency.
  • Support dynamic modification of configuration parameters during runtime for debugging and issue diagnosis without restarting the FullNode, reducing service interruption risks and improving debugging efficiency.

Specification

Users can interact with the FullNode in two ways:

  1. an HTTP-based JSON-RPC service, and
  2. a local IPC service based on a UNIX Server Socket.

Both approaches share identical interface definitions, parameter validation, and execution logic, differing only in communication channels and security boundaries.

Assume the following JSON-RPC interface is defined in FullNode:

@Component
public interface AdminJsonRpc {
  @JsonRpcMethod("admin_example")
  @JsonRpcErrors({
      @JsonRpcError(exception = JsonRpcInvalidParamsException.class, code = -32602, data = "{}"),
  })
  String adminExample(@JsonRpcParam("param1") String param1,
                      @JsonRpcParam("param2") String param2)
      throws JsonRpcInvalidParamsException;
}

Approach 1: HTTP-based JSON-RPC Interaction

In this approach, a dedicated HTTP service and port are started to expose the AdminJsonRpc interface, referred to as AdminRpcHttpService. Users can interact with the node through standard HTTP POST requests, for example:

{"jsonrpc":"2.0","id":1,"method":"admin_example","params":["abc","def"]}

For security reasons, AdminRpcHttpService listens on localhost by default to prevent external exposure of administrative interfaces. If necessary, the listening address can be adjusted via configuration to allow access from LAN nodes or a wider network scope. This approach is suitable for automated operations, remote management, and integration with external systems.

The overall interaction flow is illustrated below:

Image

Approach 2: Inter-Process Communication via UNIX Server Socket

The second approach uses a UNIX Server Socket to enable inter-process communication (IPC). When the FullNode starts, it creates a socket file named after the process ID under the /tmp directory and starts an IpcService bound to this socket. The IpcService listens for incoming socket requests in a dedicated thread.

On the same machine, users can bind to the socket file using FullNode.jar and start an IpcClient process. Interaction with the IpcService is performed using commands such as:

> admin_example abc def

The IpcClient parses and validates the command-line input, resolves the corresponding JSON-RPC method, and converts it into a standard JSON-RPC request. The request is then sent to the IpcService through the UNIX socket, and the execution result is received and displayed.

Upon receiving the request, the IpcService delegates execution to the internal JSON-RPC Server and returns the result to the IpcClient through the same socket, which is then presented to the user. Functionally and in terms of output, this approach is fully equivalent to the HTTP-based approach.

Key Characteristics

  • Both interaction methods share the same underlying JSON-RPC Server, ensuring consistent behavior.
  • Each method can be independently enabled or disabled via configuration, without mutual dependency or interference.
  • The local UNIX Server Socket communication model avoids exposing network ports, significantly enhancing security and reducing the attack surface.

Test Specification

Scope Of Impact

Only the services module of the framework is affected.

Implementation

Do you have ideas regarding the implementation of this feature?
Yes.

Are you willing to implement this feature?
Yes. An example interaction between the IPC Client and IPC Service is shown below:

[use@host]$ java -jar build/libs/FullNode.jar --attach /tmp/java-tron.91257.sock
Connected to server: /tmp/java-tron.91257.sock
You can enter the following commands, case insensitive:
admin_example, help, exit, quit
> help
You can enter the following commands, case insensitive:
admin_example, help, exit, quit
> help admin_example
usage: admin_example param1 param2
> admin_example abc def
{"jsonrpc":"2.0","id":2,"result":"abc:def"}

Backwards Compatibility

This solution does not depend on existing JSON-RPC interface definitions; therefore, it introduces no interface evolution or compatibility risks.

Starting from JDK 16, Java provides native support for Unix Domain Sockets. In JDK 1.8 environments, access to Unix Domain Sockets on Linux / Unix platforms can be achieved via the third-party library junixsocket. Since FullNode must currently support both JDK 1.8 and JDK 17 runtimes, junixsocket is used as the unified underlying communication mechanism to ensure consistent behavior and implementation stability.

In future versions, once compatibility with JDK 1.8 is no longer required, the implementation can be migrated to Java’s native Unix Domain Socket support. This will reduce third-party dependencies, further simplify the system architecture, and lower long-term maintenance costs.

Activity

  1. lxcmyf commented on Dec 23, 2025

    @lxcmyf
    Collaborator

    @317787106
    I don't quite understand. What configuration parameters support dynamic modification?

  2. 317787106 commented on Dec 23, 2025

    @317787106
    CollaboratorAuthor

    @lxcmyf There is a configuration item: node.dynamicConfig.enable. It allows change active nodes dynamically.

  3. waynercheung commented on Dec 23, 2025

    @waynercheung
    Collaborator

    This solution does not depend on existing JSON-RPC interface definitions

    What does it mean?

    You mentioned that you will add a new AdminRpcHttpService. Does it include the functions that have already been implemented by the existing JSON-RPC API?

  4. halibobo1205 commented on Dec 24, 2025

    @halibobo1205
    Collaborator

    dynamic modification: such as vm.minTimeRatio, vm.maxTimeRatio, rate.limiter, jsonrpc.maxBlockRange, jsonrpc.maxSubTopics, openHistoryQueryWhenLiteFN, api service, prometheus, and so on.

  5. 317787106 commented on Dec 24, 2025

    @317787106
    CollaboratorAuthor

    @waynercheung Yes, there will be a new AdminRpcHttpService with independent port. It doesn't include existing eth-compattible JSON-RPC API.

  6. waynercheung commented on Dec 24, 2025

    @waynercheung
    Collaborator

    @317787106 I have two questions regarding the admin API:

    • What specific functions/capabilities will the admin API provide?

    • How do the HTTP-based JSON-RPC and IPC approaches differ in their implementation of the admin API? Is the IPC approach dependent on the HTTP-based JSON-RPC service?

  7. 317787106 commented on Dec 24, 2025

    @317787106
    CollaboratorAuthor

    @waynercheung Two functions are planned initially: peer management and runtime parameter queries. Additional functions can be added as needed.

    IPC and HTTP-based JSON-RPC are independent of each other and have separate enable/disable switches. IPC access is restricted to the local machine (similar to the geth console), while the JSON-RPC service can be configured to be accessible from the local host only, the local network (LAN), or an open network.

  8. 317787106 commented on Dec 24, 2025

    @317787106
    CollaboratorAuthor

    dynamic modification: such as vm.minTimeRatio, vm.maxTimeRatio, rate.limiter, jsonrpc.maxBlockRange, jsonrpc.maxSubTopics, openHistoryQueryWhenLiteFN, api service, prometheus, and so on.

    @halibobo1205 @waynercheung These are optional choices.

  9. waynercheung commented on Dec 27, 2025

    @waynercheung
    Collaborator

    Is the underlying implementation logic of the jsonrpc admin interface shared with the IPC method?

  10. 317787106 commented on Dec 29, 2025

    @317787106
    CollaboratorAuthor

    Is the underlying implementation logic of the jsonrpc admin interface shared with the IPC method?

    @waynercheung Yes, they share the same implementation.

  11. 3for commented on Jan 14, 2026

    @3for
    Collaborator

    Placing the .sock file under /run or a dedicated data directory is more secure, because putting a Unix server socket in /tmp is effectively equivalent to exposing a local high-privilege control interface in a public space that is world-writable, preemptable, and susceptible to hijacking, which introduces real hijacking attack risks.

  12. lxcmyf commented on Mar 17, 2026

    @lxcmyf
    Collaborator

    @317787106
    Hi, any progress here? Has anything been implemented yet (PR or prototype)? Would love to follow along.

  13. liuyifei001 commented on Mar 17, 2026

    @liuyifei001

    @lxcmyf Draft is ready. I would like to share it some days later.

  14. waynercheung commented on May 15, 2026

    @waynercheung
    Collaborator

    @317787106 @liuyifei001 Hi, is there any update for this issue?

  15. 317787106 commented on May 15, 2026

    @317787106
    CollaboratorAuthor

    @lxcmyf @waynercheung Sorry for the long wait. The core architecture of this feature is already functionally in place. However, given the priority on maintaining network stability and allowing more time to gather community feedback, this feature will not be included in the upcoming v4.8.2 release.

    The framework is designed with a modular architecture to support future community-driven extensions. I’ll share a draft PR as soon as the initial version is organized, and we can review it together at that point. Once there is a concrete plan to include it in a specific future release, I’ll update the progress immediately. Thanks again for your patience!

  16. 317787106 commented on Sep 2, 2026

    @317787106
    CollaboratorAuthor

    @lxcmyf @waynercheung This feature will be included in next release, I will implement more design details later.

  17. waynercheung commented on Sep 2, 2026

    @waynercheung
    Collaborator

    @317787106 Good. Looking forward to the code implementation.

  18. 317787106 commented on Sep 17, 2026

    @317787106
    CollaboratorAuthor

    @317787106 Good. Looking forward to the code implementation.

    @waynercheung See it in this PR #6979.

  19. removed this from the GreatVoyage-v4.8.3 milestone on Sep 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

  • Status
    No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions