Admin API
This API can be used for measuring node health and debugging. Note that the Admin API is disabled by default for security reasons. To run a node with the Admin API enabled, use config flag --api-admin-enabled=true
.
Formatβ
This API uses the json 2.0
RPC format. For details, see here.
Endpointβ
/ext/admin
API Methodsβ
admin.aliasβ
Assign an API endpoint an alias, a different endpoint for the API. The original endpoint will still work. This change only affects this node; other nodes will not know about this alias.
Signatureβ
admin.alias({endpoint:string, alias:string}) -> {success:bool}
endpoint
is the original endpoint of the API.endpoint
should only include the part of the endpoint after/ext/
.- The API being aliased can now be called at
ext/alias
. alias
can be at most 512 characters.
Example Callβ
curl -X POST --data '{
"jsonrpc":"2.0",
"id" :1,
"method" :"admin.alias",
"params": {
"alias":"myAlias",
"endpoint":"bc/X"
}
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/admin
Example Responseβ
{
"jsonrpc":"2.0",
"id" :1,
"result" :{
"success":true
}
}
Now, calls to the X-Chain can be made to either /ext/bc/X
or, equivalently, to /ext/myAlias
.
admin.aliasChainβ
Give a blockchain an alias, a different name that can be used any place the blockchainβs ID is used.
Signatureβ
admin.aliasChain(
{
chain:string,
alias:string
}
) -> {success:bool}
chain
is the blockchainβs ID.alias
can now be used in place of the blockchainβs ID (in API endpoints, for example.)
Example Callβ
curl -X POST --data '{
"jsonrpc":"2.0",
"id" :1,
"method" :"admin.aliasChain",
"params": {
"chain":"sV6o671RtkGBcno1FiaDbVcFv2sG5aVXMZYzKdP4VQAWmJQnM",
"alias":"myBlockchainAlias"
}
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/admin
Example Responseβ
{
"jsonrpc":"2.0",
"id" :1,
"result" :{
"success":true
}
}
Now, instead of interacting with the blockchain whose ID is sV6o671RtkGBcno1FiaDbVcFv2sG5aVXMZYzKdP4VQAWmJQnM
by making API calls to /ext/bc/sV6o671RtkGBcno1FiaDbVcFv2sG5aVXMZYzKdP4VQAWmJQnM
, one can also make calls to ext/bc/myBlockchainAlias
.
admin.getChainAliasesβ
Returns the aliases of the chain
Signatureβ
admin.getChainAliases(
{
chain:string
}
) -> {aliases:string[]}
chain
is the blockchainβs ID.
Example Callβ
curl -X POST --data '{
"jsonrpc":"2.0",
"id" :1,
"method" :"admin.getChainAliases",
"params": {
"chain":"sV6o671RtkGBcno1FiaDbVcFv2sG5aVXMZYzKdP4VQAWmJQnM"
}
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/admin
Example Responseβ
{
"jsonrpc": "2.0",
"result": {
"aliases": [
"X",
"avm",
"2eNy1mUFdmaxXNj1eQHUe7Np4gju9sJsEtWQ4MX3ToiNKuADed"
]
},
"id": 1
}
admin.getLoggerLevelβ
Returns log and display levels of loggers.
Signatureβ
admin.getLoggerLevel(
{
loggerName:string // optional
}
) -> {
loggerLevels: {
loggerName: {
logLevel: string,
displayLevel: string
}
}
}
loggerName
is the name of the logger to be returned. This is an optional argument. If not specified, it returns all possible loggers.
Example Callβ
curl -X POST --data '{
"jsonrpc":"2.0",
"id" :1,
"method" :"admin.getLoggerLevel",
"params": {
"loggerName": "C"
}
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/admin
Example Responseβ
{
"jsonrpc": "2.0",
"result": {
"loggerLevels": {
"C": {
"logLevel": "DEBUG",
"displayLevel": "INFO"
}
}
},
"id": 1
}
admin.loadVMsβ
Dynamically loads any virtual machines installed on the node as plugins. See here for more information on how to install a virtual machine on a node.
Signatureβ
admin.loadVMs() -> {
newVMs: map[string][]string
failedVMs: map[string]string,
}
failedVMs
is only included in the response if at least one virtual machine fails to be loaded.
Example Callβ
curl -X POST --data '{
"jsonrpc":"2.0",
"id" :1,
"method" :"admin.loadVMs",
"params" :{}
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/admin
Example Responseβ
{
"jsonrpc": "2.0",
"result": {
"newVMs": {
"tGas3T58KzdjLHhBDMnH2TvrddhqTji5iZAMZ3RXs2NLpSnhH": ["foovm"]
},
"failedVMs": {
"rXJsCSEYXg2TehWxCEEGj6JU2PWKTkd6cBdNLjoe2SpsKD9cy": "error message"
}
},
"id": 1
}
admin.lockProfileβ
Writes a profile of mutex statistics to lock.profile
.
Signatureβ
admin.lockProfile() -> {success:bool}
Example Callβ
curl -X POST --data '{
"jsonrpc":"2.0",
"id" :1,
"method" :"admin.lockProfile",
"params" :{}
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/admin
Example Responseβ
{
"jsonrpc":"2.0",
"id" :1,
"result" :{
"success":true
}
}
admin.memoryProfileβ
Writes a memory profile of the to mem.profile
.
Signatureβ
admin.memoryProfile() -> {success:bool}
Example Callβ
curl -X POST --data '{
"jsonrpc":"2.0",
"id" :1,
"method" :"admin.memoryProfile",
"params" :{}
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/admin
Example Responseβ
{
"jsonrpc":"2.0",
"id" :1,
"result" :{
"success":true
}
}
admin.setLoggerLevelβ
Sets log and display levels of loggers.
Signatureβ
admin.setLoggerLevel(
{
loggerName: string, // optional
logLevel: string, // optional
displayLevel: string, // optional
}
) -> {success:bool}
loggerName
is the logger's name to be changed. This is an optional parameter. If not specified, it changes all possible loggers.logLevel
is the log level of written logs, can be omitted.displayLevel
is the log level of displayed logs, can be omitted.
logLevel
and displayLevel
cannot be omited at the same time.
Example Callβ
curl -X POST --data '{
"jsonrpc":"2.0",
"id" :1,
"method" :"admin.setLoggerLevel",
"params": {
"loggerName": "C",
"logLevel": "DEBUG",
"displayLevel": "INFO"
}
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/admin
Example Responseβ
{
"jsonrpc":"2.0",
"id" :1,
"result" :{
"success":true
}
}
admin.startCPUProfilerβ
Start profiling the CPU utilization of the node. To stop, call admin.stopCPUProfiler
. On stop, writes the profile to cpu.profile
.
Signatureβ
admin.startCPUProfiler() -> {success:bool}
Example Callβ
curl -X POST --data '{
"jsonrpc":"2.0",
"id" :1,
"method" :"admin.startCPUProfiler",
"params" :{}
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/admin
Example Responseβ
{
"jsonrpc":"2.0",
"id" :1,
"result" :{
"success":true
}
}
admin.stopCPUProfilerβ
Stop the CPU profile that was previously started.
Signatureβ
admin.stopCPUProfiler() -> {success:bool}
Example Callβ
curl -X POST --data '{
"jsonrpc":"2.0",
"id" :1,
"method" :"admin.stopCPUProfiler"
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/admin
Example Responseβ
{
"jsonrpc":"2.0",
"id" :1,
"result" :{
"success":true
}
}