admin
gives you access to several non-standard RPC methods. They will allow you to have fine-grained control over your Klaytn instance, including but not limited to network peer and RPC endpoint management.nodeInfo
administrative property can be queried for all the information known about the running Klaytn node at the networking granularity. These include general information about the node itself as a participant of the devp2p P2P overlay protocol, as well as specialized information added by each of the running application protocols, e.g., klay
.admin.nodeInfo
{"method": "admin_nodeInfo"}
datadir
administrative property can be queried for the absolute path the running Klaytn node currently uses to store all its databases. The default path is different depending on the node types (kcn, kpn, and ken) and the OS type.admin.datadir
{"method": "admin_datadir"}
datadir
path.peers
administrative property can be queried for all the information known about the connected remote nodes at the networking granularity. These include general information about the nodes themselves as participants of the devp2p P2P overlay protocol, as well as specialized information added by each of the running application protocols.admin.peers
{"method": "admin_peers"}
addPeer
is an administrative method that requests adding a new remote node to the list of tracked static nodes. The node will try to maintain connectivity to these nodes at all times, reconnecting every once in a while if the remote connection goes down.enode
concept in the geth. It is URL of the remote peer to start tracking and returns a BOOL
indicating whether the peer was accepted for tracking or some error occurred.admin.addPeer(url)
{"method": "admin_addPeer", "params": [url]}
kni
URL.true
if the peer was accepted, false
otherwise.removePeer
is an administrative method that requests removing a node from the list of tracked static nodes.enode
concept in the geth. It is URL of the remote peer to be removed from a list and returns a BOOL
indicating whether the peer was removed or some error occurred.admin.removePeer(url)
{"method": "admin_removePeer", "params": [url]}
kni
URL.true
if the peer was accepted, false
otherwise.admin_startRPC
. The admin_startRPC
will be deprecated soon.startHTTP
is an administrative method that starts an HTTP based JSON RPC API webserver to handle client requests.admin.startHTTP(host, port, cors, apis)
{"method": "admin_startHTTP", "params": [host, port, cors, apis]}
"localhost"
).8551
)."klay,net,rpc"
).true
if the HTTP RPC listener was opened, false
if not.admin_stopRPC
. The admin_stopRPC
will be deprecated soon.stopHTTP
is an administrative method that closes the currently open HTTP RPC endpoint. As the node can only have a single HTTP endpoint running, this method takes no parameters, returning a boolean whether the endpoint was closed or not.admin.stopHTTP()
{"method": "admin_stopHTTP"}
true
if the endpoint was closed, false
if not.startWS
is an administrative method that starts an WebSocket based JSON RPC API webserver to handle client requests.admin.startWS(host, port, cors, apis)
{"method": "admin_startWS", "params": [host, port, cors, apis]}
"localhost"
).8552
)."klay,net,personal"
).true
if the WebSocket RPC listener was opened, false
if not.stopWS
is an administrative method that closes the currently open WebSocket RPC endpoint. As the node can only have a single WebSocket endpoint running, this method takes no parameters, returning a boolean whether the endpoint was closed or not.admin.stopWS()
{"method": "admin_stopWS"}
true
if the endpoint was closed, false
if not.exportChain
is an administrative method that exports the blockchain to a file.admin.exportChain(fileName)
{"method": "admin_importChain"}, "params": [fileName]}
true
if chain was exported, false
if not.importChain
is an administrative method that imports an exported chain from a file into a node. This method imports only blocks that haven't existed in a Klaytn node. This method does not delete any data of the existing chain.admin.importChain(fileName)
{"method": "admin_importChain"}, "params": [fileName]}
true
if chain was imported, false
if not.importChainFromString
is an administrative method that imports a chain from a RLP-encoded string of blocks into a Klaytn node. This only works if there is no existing chain in a Klaytn node. This method does not delete any data of the existing chain.admin.importChainFromString(blockRlp)
{"method": "admin_importChainFromString"}, "params": [<blockRlp>]}
debug.getBlockRlp
)true
if a chain was imported, or false
if not.startStateMigration
is an administrative method that starts a state migration and removes old state/storage trie nodes. This can save the storage space of a Klaytn node. The method returns an error if it fails to start a state migration, or null
if it succeeds to start. NOTE: After the state migration, the node cannot serve APIs with previous states.admin.startStateMigration()
{"method": "admin_startStateMigration"}
null
if the state migration has started, or an error message if not.stopStateMigration
is an administrative method that stops the currently running state migration. This method takes no parameters and returns null
or an error whether the state migration was stopped or not.admin.stopStateMigration()
{"method": "admin_stopStateMigration"}
null
if the state migration is stopped, or an error if not.stateMigrationStatus
is an administrative method that returns the status information of the state migration. This method takes no parameters and returns the status of the currently running state migration.admin.stateMigrationStatus
{"method": "admin_stateMigrationStatus"}
committed
is the number of trie nodes that have been copied by the state migration.null
if the state migration finished well, or an error if not.true
if the state migration is running, or false
if not.0
if the state migration is not running.)pending
represents the number of trie nodes that have not been processed by the state migration.progress
is the progress of the state migration calculated in percent.read
represents the number of trie nodes that have been read by the state migration.saveTrieNodeCacheToDisk
is an administrative method that starts saving the cached trie node to the disk to reuse them when the node restarts. Cached trie node data will be stored to and loaded from $DATA_DIR/fastcache
. This method returns an error if the saving process has been already triggered or trie node cache is disabled. This feature is supported since Klaytn 1.5.3.admin.saveTrieNodeCacheToDisk()
{"method": "admin_saveTrieNodeCacheToDisk"}
null
if saving the trie node has started, or an error message if not.setMaxSubscriptionPerWSConn
is an administrative method that sets the maximum allowed number of subscriptions per single WebSocket connection. For example, if the maximum number is set to five and a user requests more than five subscriptions through the klay_subscribe
API, an error message "Maximum 5 subscriptions are allowed for a WebSocket connection" will be displayed. This feature is supported since Klaytn 1.6.0.admin.setMaxSubscriptionPerWSConn(limit)
{"method": "admin_setMaxSubscriptionPerWSConn"}
null
if the limit is set successfully; otherwise, it returns an error message.