The Node Pilot JSON-RPC server provides API access to every single Node Pilot operation, from initial registration to creating, staking, and updating nodes.
The RPC server is available both via HTTP and via the command line using the Node Pilot CLI.
The server can be accessed via port 34417
on the host machine at path /v1
e.g. http://localhost:34417/v1
. It follows the JSON-RPC 2.0 Specification. All requests must be POST
requests sent with a Content-Type
of application/json
. The payload must be in the following form:
{
id: number
jsonrpc: '2.0'
method: string
params?: Object
}
All server methods are available via the cli with the api
command. Any parameters should be entered as --param.[key] [value'
. For example, if you need to pass an id
as a parameter, you would use --param.id pokt-000
. That will set the parameters {id: 'pokt-000'}
in the JSON-RPC request.
All methods are namespaced with one of the following:
np
- These methods have to do with Node Pilot as a wholenode
- These methods have to do with individual nodespokt
- These methods are specific to Pocket nodes
Gets the Node Pilot version.
{
"id": 1,
"jsonrpc": "2.0",
"method": "np_getVersion"
}
curl -X POST -H 'Content-Type: application/json' --data '{"jsonrpc": "2.0", "id": 1, "method": "np_getVersion"}' http://localhost:34417/v1
./np api np_getVersion
Registers a new Node Pilot instance.
{
"id": 1,
"jsonrpc": "2.0",
"method": "np_configureTLS",
"params": {
"email": "[email protected]"
"masterPassword": "mypassword"
"domain": "subdomain.mydomain.com"
}
}
curl -X POST -H 'Content-Type: application/json' --data '{"jsonrpc": "2.0", "id": 1, "method": "np_register", "params": {"email": "[email protected]", "domain": "subdomain.mydomain.com", "masterPassword": "mypassword"}}' http://localhost:34417/v1
./np api np_register --params.email "[email protected]" --params.masterPassword "mypassword" --params.domain "subdomain.mydomain.com"
Configures and generates TLS certs using Let's Encrypt.
{
"id": 1,
"jsonrpc": "2.0",
"method": "np_configureTLS",
"params": {
"masterPassword": "mypassword"
}
}
curl -X POST -H 'Content-Type: application/json' --data '{"jsonrpc": "2.0", "id": 1, "method": "np_configureTLS", "params": {"masterPassword": "mypassword"}}' http://localhost:34417/v1
./np api np_configureTLS --params.masterPassword "mypassword"
Shuts down Node Pilot while leaving all nodes and load balancers running.
{
"id": 1,
"jsonrpc": "2.0",
"method": "np_shutdown"
}
curl -X POST -H 'Content-Type: application/json' --data '{"jsonrpc": "2.0", "id": 1, "method": "np_shutdown"}' http://localhost:34417/v1
./np api np_shutdown
Shuts down all of Node Pilot including all nodes and load balancers.
{
"id": 1,
"jsonrpc": "2.0",
"method": "np_shutdownAll"
}
curl -X POST -H 'Content-Type: application/json' --data '{"jsonrpc": "2.0", "id": 1, "method": "np_shutdownAll"}' http://localhost:34417/v1
./np api np_shutdownAll
Gets all running load balancers available to be used as relay chains in Pocket nodes.
{
"id": 1,
"jsonrpc": "2.0",
"method": "np_getLoadBalancers"
}
curl -X POST -H 'Content-Type: application/json' --data '{"jsonrpc": "2.0", "id": 1, "method": "np_getLoadBalancers"}' http://localhost:34417/v1
./np api np_getLoadBalancers
Gets information on all nodes. (matches the contents of ~/.node-pilot/config/chains.json
)
{
"id": 1,
"jsonrpc": "2.0",
"method": "node_getAll"
}
curl -X POST -H 'Content-Type: application/json' --data '{"jsonrpc": "2.0", "id": 1, "method": "node_getAll"}' http://localhost:34417/v1
./np api node_getAll
Gets an individual node's information.
{
"id": 1,
"jsonrpc": "2.0",
"method": "node_get",
"params": {
"id": "pokt-000"
}
}
curl -X POST -H 'Content-Type: application/json' --data '{"jsonrpc": "2.0", "id": 1, "method": "node_get", "params": {"id": "pokt-000"}}' http://localhost:34417/v1
./np api node_get --params.id "pokt-000"
Gets a node's current block height.
{
"id": 1,
"jsonrpc": "2.0",
"method": "node_getBlockHeight",
"params": {
"id": "pokt-000"
}
}
curl -X POST -H 'Content-Type: application/json' --data '{"jsonrpc": "2.0", "id": 1, "method": "node_getBlockHeight", "params": {"id": "pokt-000"}}' http://localhost:34417/v1
./np api node_getBlockHeight --params.id "pokt-000"
Gets a node's current status.
{
"id": 1,
"jsonrpc": "2.0",
"method": "node_getStatus",
"params": {
"id": "pokt-000"
}
}
curl -X POST -H 'Content-Type: application/json' --data '{"jsonrpc": "2.0", "id": 1, "method": "node_getStatus", "params": {"id": "pokt-000"}}' http://localhost:34417/v1
./np api node_getStatus --params.id "pokt-000"
Starts a stopped node.
{
"id": 1,
"jsonrpc": "2.0",
"method": "node_start",
"params": {
"id": "pokt-000"
}
}
curl -X POST -H 'Content-Type: application/json' --data '{"jsonrpc": "2.0", "id": 1, "method": "node_start", "params": {"id": "pokt-000"}}' http://localhost:34417/v1
./np api node_start --params.id "pokt-000"
Stops a running node.
{
"id": 1,
"jsonrpc": "2.0",
"method": "node_stop",
"params": {
"id": "pokt-000"
}
}
curl -X POST -H 'Content-Type: application/json' --data '{"jsonrpc": "2.0", "id": 1, "method": "node_stop", "params": {"id": "pokt-000"}}' http://localhost:34417/v1
./np api node_stop --params.id "pokt-000"
Restarts a running or stopped node.
{
"id": 1,
"jsonrpc": "2.0",
"method": "node_restart",
"params": {
"id": "pokt-000"
}
}
curl -X POST -H 'Content-Type: application/json' --data '{"jsonrpc": "2.0", "id": 1, "method": "node_restart", "params": {"id": "pokt-000"}}' http://localhost:34417/v1
./np api node_restart --params.id "pokt-000"
Gets the validator info of a validator node.
{
"id": 1,
"jsonrpc": "2.0",
"method": "node_getValidatorInfo",
"params": {
"id": "pokt-000"
}
}
./np api node_getValidatorInfo --params.id "pokt-000"
Gets the Docker container info of a node. (equivalent of docker container inspect
)
{
"id": 1,
"jsonrpc": "2.0",
"method": "node_getContainerInfo",
"params": {
"id": "pokt-000"
}
}
./np api node_getContainerInfo --params.id "pokt-000"
Gets the Docker container's hardware stats. (equivalent of docker container stats
)
{
"id": 1,
"jsonrpc": "2.0",
"method": "node_getContainerStats",
"params": {
"id": "pokt-000"
}
}
./np api node_getContainerStats --params.id "pokt-000"
Gets a node's balance. (this only applies to validator nodes)
{
"id": 1,
"jsonrpc": "2.0",
"method": "node_getBalance",
"params": {
"id": "pokt-000"
}
}
./np api node_getBalance --params.id "pokt-000"
Sends coin to another wallet. (this method is only available to validator nodes)
{
"id": 1,
"jsonrpc": "2.0",
"method": "node_getBalance",
"params": {
"id": "pokt-000",
"masterPassword": "mypassword",
"amount": "4.5",
"to": "156924a37c36e9e6b75e0a34027747032fe22cd2",
"memo": "some memo"
}
}
./np api node_send --params.id "pokt-000" --params.masterPassword "mypassword" --params.amount "4.5" --params.to "156924a37c36e9e6b75e0a34027747032fe22cd2" --params.memo "some memo"
Gets info on any node upgrades available.
{
"id": 1,
"jsonrpc": "2.0",
"method": "node_getAvailableUpgrades"
}
./np api node_getAvailableUpgrades
Upgrades a node to the latest available version.
{
"id": 1,
"jsonrpc": "2.0",
"method": "node_upgrade",
"params": {
"id": "pokt-000",
"masterPassword": "mypassword"
}
}
./np api node_upgrade --params.id "pokt-000" --params.masterPassword "mypassword"
Stakes a validator node.
{
"id": 1,
"jsonrpc": "2.0",
"method": "node_stakeValidator",
"params": {
"id": "pokt-000",
"masterPassword": "mypassword",
"stakeAmount": "15100"
}
}
./np api node_stakeValidator --params.id "pokt-000" --params.masterPassword "mypassword" --params.stakeAmount "15100"
Restakes an already-staked validator node.
{
"id": 1,
"jsonrpc": "2.0",
"method": "node_restakeValidator",
"params": {
"id": "pokt-000",
"masterPassword": "mypassword"
}
}
./np api node_restakeValidator --params.id "pokt-000" --params.masterPassword "mypassword"
Unjails a validator node.
{
"id": 1,
"jsonrpc": "2.0",
"method": "node_unjailValidator",
"params": {
"id": "pokt-000",
"masterPassword": "mypassword"
}
}
./np api node_unjailValidator --params.id "pokt-000" --params.masterPassword "mypassword"
Unstakes a validator node.
{
"id": 1,
"jsonrpc": "2.0",
"method": "node_unstakeValidator",
"params": {
"id": "pokt-000",
"masterPassword": "mypassword"
}
}
./np api node_unstakeValidator --params.id "pokt-000" --params.masterPassword "mypassword"
Creates a new node. Available properties for creation:
masterPassword: string
ticker: string
"pokt", "eth", "fuse", etc.network?: string
"MAINNET"|"TESTNET"|"RINKEBY"peerPort?: number
rpcPort?: number
dockerCPUs?: number
dockerMem?: number
password?: string
Key password required for validator nodeschainsDir?: string
Directory which the node's data directory will be placed into.
{
"id": 1,
"jsonrpc": "2.0",
"method": "node_create",
"params": {
"masterPassword": "mypassword",
"ticker": "pokt",
"network": "MAINNET",
"password": "mynodepassword"
}
}
./np api node_create --params.masterPassword "mypassword" --params.ticker "pokt" --params.network "MAINNET" --params.password "mynodepassword"
Deletes a node.
{
"id": 1,
"jsonrpc": "2.0",
"method": "node_delete",
"params": {
"id": "pokt-000",
"masterPassword": "mypassword"
}
}
./np api node_delete --params.id "pokt-000" --params.masterPassword "mypassword"
Clears a node's chain data directory.
{
"id": 1,
"jsonrpc": "2.0",
"method": "node_clearDataDir",
"params": {
"id": "pokt-000",
"masterPassword": "mypassword"
}
}
./np api node_clearDataDir --params.id "pokt-000" --params.masterPassword "mypassword"
Gets a validator node's raw private key.
{
"id": 1,
"jsonrpc": "2.0",
"method": "node_getRawPrivateKey",
"params": {
"id": "pokt-000",
"masterPassword": "mypassword"
}
}
./np api node_getRawPrivateKey --params.id "pokt-000" --params.masterPassword "mypassword"
Gets a validator node's key password.
{
"id": 1,
"jsonrpc": "2.0",
"method": "node_getKeyPassword",
"params": {
"id": "pokt-000",
"masterPassword": "mypassword"
}
}
./np api node_getKeyPassword --params.id "pokt-000" --params.masterPassword "mypassword"
Gets a Pocket node's prometheus data.
{
"id": 1,
"jsonrpc": "2.0",
"method": "pokt_getPrometheusData",
"params": {
"id": "pokt-000"
}
}
./np api pokt_getPrometheusData --params.id "pokt-000"
Gets a Pocket node's relay chains.
{
"id": 1,
"jsonrpc": "2.0",
"method": "pokt_getRelayChains",
"params": {
"id": "pokt-000"
}
}
./np api pokt_getRelayChains --params.id "pokt-000"
Sets a Pocket node's relay chains.
{
"id": 1,
"jsonrpc": "2.0",
"method": "pokt_setRelayChains",
"params": {
"id": "pokt-000",
"masterPassword": "mypassword",
"chains": [
{
"id": "0002",
"url": "http://localhost:8081",
"basic_auth": {
"username": "",
"password": ""
}
},
{
"id": "0021",
"url": "http://eth-mainnet",
"basic_auth": {
"username": "",
"password": ""
}
}
]
}
}
not available via CLI
Adds a relay chain to a Pocket node.
{
"id": 1,
"jsonrpc": "2.0",
"method": "pokt_addRelayChain",
"params": {
"id": "pokt-000",
"masterPassword": "mypassword",
"chainId": "0025",
"chainUrl": "http://eth-rinkeby"
}
}
./np api pokt_addRelayChain --params.id "pokt-000" --params.masterPassword "mypassword" --params.chainId "0025" --params.chainUrl "http://eth-rinkeby"
Removes a relay chain from a Pocket node.
{
"id": 1,
"jsonrpc": "2.0",
"method": "pokt_removeRelayChain",
"params": {
"id": "pokt-000",
"masterPassword": "mypassword",
"chainId": "0025"
}
}
./np api pokt_removeRelayChain --params.id "pokt-000" --params.masterPassword "mypassword" --params.chainId "0025"