Modules: admin
admin_addPeer
AddPeer requests connecting to a remote node, and also maintaining the new
connection at all times, even reconnecting if it is lost.
Params (1)
Parameters must be given by position.
1: url string
- Required: ✓ Yes
Result
bool
- Required: ✓ Yes
Client Method Invocation Examples
"Shell HTTP"
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "admin_addPeer", "params": [<url>]}'"Shell WebSocket"
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "admin_addPeer", "params": [<url>]}'"Javascript Console"
admin.addPeer(url);admin_datadir
Datadir retrieves the current data directory the node is using.
Params (0)
None
Result
string
- Required: ✓ Yes
Client Method Invocation Examples
"Shell HTTP"
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "admin_datadir", "params": []}'"Shell WebSocket"
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "admin_datadir", "params": []}'"Javascript Console"
admin.datadir();admin_exportChain
ExportChain exports the current blockchain into a local file,
or a range of blocks if first and last are non-nil.
Params (3)
Parameters must be given by position.
1: file string
- Required: ✓ Yes
2: first *uint64
- Required: ✓ Yes
"Schema"
- description: `Hex representation of the integer`
- pattern: `^0x[a-fA-F0-9]+$`
- title: `integer`
- type: string"Raw"
{
"description": "Hex representation of the integer",
"pattern": "^0x[a-fA-F0-9]+$",
"title": "integer",
"type": [
"string"
]
}3: last *uint64
- Required: ✓ Yes
"Schema"
- description: `Hex representation of the integer`
- pattern: `^0x[a-fA-F0-9]+$`
- title: `integer`
- type: string"Raw"
{
"description": "Hex representation of the integer",
"pattern": "^0x[a-fA-F0-9]+$",
"title": "integer",
"type": [
"string"
]
}Result
bool
- Required: ✓ Yes
Client Method Invocation Examples
"Shell HTTP"
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "admin_exportChain", "params": [<file>, <first>, <last>]}'"Shell WebSocket"
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "admin_exportChain", "params": [<file>, <first>, <last>]}'Javascript Console"
admin.exportChain(file,first,last);admin_maxPeers
MaxPeers sets the maximum peer limit for the protocol manager and the p2p server.
Params (1)
Parameters must be given by position.
1: n int
- Required: ✓ Yes
"Schema"
- description: `Hex representation of the integer`
- pattern: `^0x[a-fA-F0-9]+$`
- title: `integer`
- type: string"Raw"
{
"description": "Hex representation of the integer",
"pattern": "^0x[a-fA-F0-9]+$",
"title": "integer",
"type": [
"string"
]
}Result
bool
- Required: ✓ Yes
Client Method Invocation Examples
"Shell HTTP"
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "admin_maxPeers", "params": [<n>]}'"Shell WebSocket"
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "admin_maxPeers", "params": [<n>]}'"Javascript Console"
admin.maxPeers(n);admin_peerEvents
PeerEvents creates an RPC subscription which receives peer events from the
node's p2p.Server
Params (0)
None
Result
*rpc.Subscription
- Required: ✓ Yes
"Schema"
- description: `Subscription identifier`
- title: `subscriptionID`
- type: string"Raw"
{
"description": "Subscription identifier",
"title": "subscriptionID",
"type": [
"string"
]
}Client Method Invocation Examples
"Shell WebSocket"
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "admin_subscribe", "params": ["peerEvents"]}'admin_removePeer
RemovePeer disconnects from a remote node if the connection exists
Params (1)
Parameters must be given by position.
1: url string
- Required: ✓ Yes
Result
bool
- Required: ✓ Yes
Client Method Invocation Examples
"Shell HTTP"
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "admin_removePeer", "params": [<url>]}'"Shell WebSocket"
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "admin_removePeer", "params": [<url>]}'"Javascript Console"
admin.removePeer(url);admin_startHTTP
StartHTTP starts the HTTP RPC API server.
Params (5)
Parameters must be given by position.
1: host *string
- Required: ✓ Yes
2: port *int
- Required: ✓ Yes
"Schema"
- description: `Hex representation of the integer`
- pattern: `^0x[a-fA-F0-9]+$`
- title: `integer`
- type: string"Raw"
{
"description": "Hex representation of the integer",
"pattern": "^0x[a-fA-F0-9]+$",
"title": "integer",
"type": [
"string"
]
}3: cors *string
- Required: ✓ Yes
4: apis *string
- Required: ✓ Yes
5: vhosts *string
- Required: ✓ Yes
Result
bool
- Required: ✓ Yes
Client Method Invocation Examples
"Shell HTTP"
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "admin_startHTTP", "params": [<host>, <port>, <cors>, <apis>, <vhosts>]}'"Shell WebSocket"
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "admin_startHTTP", "params": [<host>, <port>, <cors>, <apis>, <vhosts>]}'"Javascript Console"
``` js
admin.startHTTP(host,port,cors,apis,vhosts);
```admin_startRPC
StartRPC starts the HTTP RPC API server.
Deprecated: use StartHTTP instead.
Params (5)
Parameters must be given by position.
1: host *string
- Required: ✓ Yes
2: port *int
- Required: ✓ Yes
"Schema"
- description: `Hex representation of the integer`
- pattern: `^0x[a-fA-F0-9]+$`
- title: `integer`
- type: string"Raw"
{
"description": "Hex representation of the integer",
"pattern": "^0x[a-fA-F0-9]+$",
"title": "integer",
"type": [
"string"
]
}3: cors *string
- Required: ✓ Yes
4: apis *string
- Required: ✓ Yes
5: vhosts *string
- Required: ✓ Yes
Result
bool
- Required: ✓ Yes
Client Method Invocation Examples
"Shell HTTP"
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "admin_startRPC", "params": [<host>, <port>, <cors>, <apis>, <vhosts>]}'"Shell WebSocket"
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "admin_startRPC", "params": [<host>, <port>, <cors>, <apis>, <vhosts>]}'"Javascript Console"
admin.startRPC(host,port,cors,apis,vhosts);admin_stopHTTP
StopHTTP shuts down the HTTP server.
Params (0)
None
Result
bool
- Required: ✓ Yes
Client Method Invocation Examples
"Shell HTTP"
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "admin_stopHTTP", "params": []}'"Shell WebSocket"
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "admin_stopHTTP", "params": []}'"Javascript Console"
admin.stopHTTP();admin_stopWS
StopWS terminates all WebSocket servers.
Params (0)
None
Result
bool
- Required: ✓ Yes
Client Method Invocation Examples
"Shell HTTP"
curl -X POST -H "Content-Type: application/json" http://localhost:8545 --data '{"jsonrpc": "2.0", "id": 42, "method": "admin_stopWS", "params": []}'"Shell WebSocket"
wscat -c ws://localhost:8546 -x '{"jsonrpc": "2.0", "id": 1, "method": "admin_stopWS", "params": []}'"Javascript Console"
admin.stopWS();