admin

The admin namespace provides a suite of RPC endpoints for administering your R5 node. You can retrieve node properties, manage peers, control RPC/HTTP/WS servers, and perform maintenance operations such as importing/exporting the chain. Below is a detailed list of all available endpoints.


admin_datadir

Description: Returns the absolute path to the node’s data directory (where blockchain data and configuration files are stored).

Sample Request:

{
  "jsonrpc": "2.0",
  "method": "admin_datadir",
  "params": [],
  "id": 1
}

Expected Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "C:\\..."
}

Parameters: None.


admin_nodeInfo

Description: Returns detailed information about the node including its enode URL, ENR, IP, listening addresses, client version, and protocol-specific details (e.g. network, difficulty, genesis block).

Sample Request:

Expected Response:

Parameters: None.


admin_peers

Description: Returns an array of objects representing the node’s connected peers. Each peer object contains connection details such as enode URL, IP address, ports, and protocol capabilities.

Sample Request:

Expected Response:

Parameters: None.


admin_addPeer

Description: Adds a new peer to the node’s network. The peer is specified by its enode URL.

Sample Request:

Expected Response:

Parameters:

  • peer (string): The enode URL of the peer to add.


admin_addTrustedPeer

Description: Adds a trusted peer to the node’s network. Trusted peers are given preferential treatment during connection establishment.

Sample Request:

Expected Response:

Parameters:

  • peer (string): The enode URL of the trusted peer.


admin_clearHistory

Description: Clears the node’s internal history (such as console command history). &#xNAN;Note: This endpoint is typically used for maintenance and debugging purposes.

Sample Request:

Expected Response:

Parameters: None.


admin_exportChain

Description: Exports the current blockchain data (chain export) to a file or stream. This can be used for backup or migration purposes.

Sample Request:

Expected Response: &#xNAN;The response is typically a success confirmation (true) or an error message if the export fails.

Parameters: None.


admin_getDatadir

Description: Retrieves the data directory of the node. (Equivalent to admin_datadir but provided as a function with callback support in some implementations.)

Sample Request:

Expected Response: &#xNAN;Similar to admin_datadir.

Parameters: None.


admin_getNodeInfo

Description: Retrieves detailed node information, equivalent to admin_nodeInfo.

Sample Request:

Expected Response: &#xNAN;Same as admin_nodeInfo.

Parameters: None.


admin_getPeers

Description: Retrieves the current list of connected peers.

Sample Request:

Expected Response: &#xNAN;Same as admin_peers, returning an array of peer objects.

Parameters: None.


admin_importChain

Description: Imports blockchain data (chain import) from a specified file or stream. This is used for chain restoration or migration.

Sample Request:

Expected Response: &#xNAN;Returns true on successful import.

Parameters:

  • filePath (string): The file path or identifier of the chain data to import.


admin_removePeer

Description: Removes a peer from the node’s network based on its enode URL.

Sample Request:

Expected Response:

Parameters:

  • peer (string): The enode URL of the peer to remove.


admin_removeTrustedPeer

Description: Removes a trusted peer from the node’s list of trusted connections.

Sample Request:

Expected Response:

Parameters:

  • peer (string): The enode URL of the trusted peer to remove.


admin_sleep

Description: Pauses execution for a specified duration. This endpoint is useful for testing and debugging, allowing you to simulate delays. &#xNAN;Note: The actual implementation may vary; this function is typically used via callbacks in the console.

Sample Request:

Expected Response: &#xNAN;Returns true after pausing for the specified duration (in milliseconds).

Parameters:

  • duration (number): The number of milliseconds to pause execution.


admin_sleepBlocks

Description: Pauses execution until a specified number of blocks have been mined. Useful for testing block-dependent operations.

Sample Request:

Expected Response: &#xNAN;Returns true after the specified number of blocks have been produced.

Parameters:

  • blockCount (number): The number of blocks to wait before resuming execution.


admin_startHTTP

Description: Starts the node’s HTTP server for JSON-RPC communication.

Sample Request:

Expected Response:

Parameters:

  • host (string): IP address to bind the HTTP server (e.g., "127.0.0.1").

  • port (number): Port number for the HTTP server (e.g., 8545).

  • cors (boolean): Whether to enable Cross-Origin Resource Sharing.


admin_startRPC

Description: Starts the node’s RPC server for JSON-RPC requests over HTTP. (Often synonymous with startHTTP.)

Sample Request:

Expected Response:

Parameters: &#xNAN;Same as admin_startHTTP.


admin_startWS

Description: Starts the WebSocket JSON-RPC server, allowing real-time subscriptions and RPC calls over WebSocket.

Sample Request:

Expected Response:

Parameters:

  • host (string): IP address to bind the WS server.

  • port (number): Port number for the WS server (e.g., 8546).

  • cors (boolean): Whether to enable CORS.


admin_stopHTTP

Description: Stops the HTTP JSON-RPC server if it is running.

Sample Request:

Expected Response:

Parameters: None.


admin_stopRPC

Description: Stops the RPC server (HTTP) if it is active.

Sample Request:

Expected Response:

Parameters: None.


admin_stopWS

Description: Stops the WebSocket JSON-RPC server if it is active.

Sample Request:

Expected Response:

Parameters: None.

Last updated