R5 Network
WebsiteR5 LabsGitHub
  • Getting Started
    • Hello & Welcome!
  • About R5
    • Overview
    • R5 Components
    • Consensus Mechanism
    • zkNet (Privacy)
  • R5 Coin
  • R5 Tokenomics
  • Tutorials & Guides
    • Connect & Use R5
      • R5 Desktop Wallet
      • MetaMask
      • Rabby Wallet
      • Coinbase Wallet
    • zkNet Web Wallet
    • R5 Desktop Wallet
      • Interface Overview
      • Send a Transaction
      • Receive a Transaction
      • Backup Your Wallet
      • Retrieve Your Private Key
    • How To: Deploy a Node
    • How To: Mine R5
    • How To: GPU Mine R5
    • How To: Build R5 From Source
    • How To: Connect Local Nodes
  • For Developers
    • R5 SDK
      • R5 Relayer
      • R5 Console
      • JS Console
      • CLI Wallet
      • SCdev
      • SSL Proxy
    • Hardware Requirements
    • R5 Testnet
    • R5 Devnet
    • Local Networks
    • JSON-RPC API
      • admin
      • debug
      • ethash
      • miner
      • net
      • r5 (eth)
      • rpc
      • txpool
      • web3
    • Indexer API
    • zkNet API
    • Node Configuration
    • Ethash-R5
    • Smart Contracts
    • Wrapped R5 (Native)
    • Tokens & NFTs
  • Bug Bounty Program
  • Resources
    • Website
    • R5 Labs
    • R5 Labs GitHub
Powered by GitBook
On this page
  • admin_datadir
  • admin_nodeInfo
  • admin_peers
  • admin_addPeer
  • admin_addTrustedPeer
  • admin_clearHistory
  • admin_exportChain
  • admin_getDatadir
  • admin_getNodeInfo
  • admin_getPeers
  • admin_importChain
  • admin_removePeer
  • admin_removeTrustedPeer
  • admin_sleep
  • admin_sleepBlocks
  • admin_startHTTP
  • admin_startRPC
  • admin_startWS
  • admin_stopHTTP
  • admin_stopRPC
  • admin_stopWS
  1. For Developers
  2. JSON-RPC API

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:

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

Expected Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "enode": "enode://09aa3dfa13dc48d7059cfe79e40e9175f2a33b95702b92ca2ff96ba21dfc14a426f2183a8e023d83921a16978177eb12f0cfa0f9dcd800054f10c161ae461b55@127.0.0.1:30135",
    "enr": "enr:-KO4QNI_73lTKCq82VRiqGBAF48nMtwd9rU_LDoWPb3ftRPiZozCj5LyyY0XptYLNSFkzflA3Y77tZ8_13Tdh7ZypoCGAZV4LRmmg2V0aMfGhHHIM3-AgmlkgnY0gmlwhH8AAAGJc2VjcDI1NmsxoQMJqj36E9xI1wWc_nnkDpF18qM7lXArksov-WuiHfwUpIRzbmFwwIN0Y3CCdbeDdWRwgnW3",
    "id": "e76d42de7c1552da51159a4952f58405dbc0081aa2f0dc6f0b94c47baee15c71",
    "ip": "127.0.0.1",
    "listenAddr": "[::]:30135",
    "name": "r5-core/v1.0.0-stable-9c0438ba/windows-amd64/go1.19",
    "ports": {
      "discovery": 30135,
      "listener": 30135
    },
    "protocols": {
      "eth": {
        "config": { /* configuration details */ },
        "difficulty": 809668952,
        "genesis": "0x52268bba59f455485c61c23661f9def0dd7c81adfa7c5fd8c44e84ec45bf70c9",
        "head": "0xa966a73858f8e41c8374f6e91139a1eed9a41fc961e2588478b652c78ba1fc98",
        "network": 135
      },
      "snap": {}
    }
  }
}

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:

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

Expected Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": []
}

Parameters: None.


admin_addPeer

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

Sample Request:

{
  "jsonrpc": "2.0",
  "method": "admin_addPeer",
  "params": ["enode://09aa3dfa13dc48d7059cfe79e40e9175f2a33b95702b92ca2ff96ba21dfc14a426f2183a8e023d83921a16978177eb12f0cfa0f9dcd800054f10c161ae461b55@127.0.0.1:30135"],
  "id": 1
}

Expected Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}

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:

{
  "jsonrpc": "2.0",
  "method": "admin_addTrustedPeer",
  "params": ["enode://trustedpeer1234567890abcdef@127.0.0.1:30135"],
  "id": 1
}

Expected Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}

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:

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

Expected Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}

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:

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

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:

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

Expected Response: &#xNAN;Similar to admin_datadir.

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

Parameters: None.


admin_getNodeInfo

Description: Retrieves detailed node information, equivalent to admin_nodeInfo.

Sample Request:

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

Expected Response: &#xNAN;Same as admin_nodeInfo.

Parameters: None.


admin_getPeers

Description: Retrieves the current list of connected peers.

Sample Request:

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

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:

{
  "jsonrpc": "2.0",
  "method": "admin_importChain",
  "params": ["path/to/chain/export.dat"],
  "id": 1
}

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:

{
  "jsonrpc": "2.0",
  "method": "admin_removePeer",
  "params": ["enode://peerToRemove@127.0.0.1:30135"],
  "id": 1
}

Expected Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}

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:

{
  "jsonrpc": "2.0",
  "method": "admin_removeTrustedPeer",
  "params": ["enode://trustedpeer1234567890abcdef@127.0.0.1:30135"],
  "id": 1
}

Expected Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}

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:

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

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:

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

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:

{
  "jsonrpc": "2.0",
  "method": "admin_startHTTP",
  "params": ["127.0.0.1", 8545, true],
  "id": 1
}

Expected Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}

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:

{
  "jsonrpc": "2.0",
  "method": "admin_startRPC",
  "params": ["127.0.0.1", 8545, true],
  "id": 1
}

Expected Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}

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:

{
  "jsonrpc": "2.0",
  "method": "admin_startWS",
  "params": ["127.0.0.1", 8546, true],
  "id": 1
}

Expected Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}

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:

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

Expected Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}

Parameters: None.


admin_stopRPC

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

Sample Request:

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

Expected Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}

Parameters: None.


admin_stopWS

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

Sample Request:

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

Expected Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": true
}

Parameters: None.

PreviousJSON-RPC APINextdebug

Last updated 2 months ago