github.com/MetalBlockchain/metalgo@v1.11.9/api/info/service.md (about)

     1  ---
     2  tags: [AvalancheGo APIs]
     3  description: This page is an overview of the Info API associated with AvalancheGo.
     4  sidebar_label: Info API
     5  pagination_label: Info API
     6  ---
     7  
     8  # Info API
     9  
    10  This API can be used to access basic information about the node.
    11  
    12  ## Format
    13  
    14  This API uses the `json 2.0` RPC format. For more information on making JSON RPC calls, see
    15  [here](/reference/standards/guides/issuing-api-calls.md).
    16  
    17  ## Endpoint
    18  
    19  ```text
    20  /ext/info
    21  ```
    22  
    23  ## Methods
    24  
    25  ### `info.acps`
    26  
    27  Returns peer preferences for Avalanche Community Proposals (ACPs)
    28  
    29  **Signature:**
    30  
    31  ```go
    32  info.acps() -> {
    33      acps: map[uint32]{
    34          supportWeight: uint64
    35          supporters:    set[string]
    36          objectWeight:  uint64
    37          objectors:     set[string]
    38          abstainWeight: uint64
    39      }
    40  }
    41  ```
    42  
    43  **Example Call:**
    44  
    45  ```sh
    46  curl -sX POST --data '{
    47      "jsonrpc":"2.0",
    48      "id"     :1,
    49      "method" :"info.acps",
    50      "params" :{}
    51  }' -H 'content-type:application/json;' 127.0.0.1:9650/ext/info
    52  ```
    53  
    54  **Example Response:**
    55  
    56  ```json
    57  {
    58    "jsonrpc": "2.0",
    59    "result": {
    60      "acps": {
    61        "23": {
    62          "supportWeight": "0",
    63          "supporters": [],
    64          "objectWeight": "0",
    65          "objectors": [],
    66          "abstainWeight": "161147778098286584"
    67        },
    68        "24": {
    69          "supportWeight": "0",
    70          "supporters": [],
    71          "objectWeight": "0",
    72          "objectors": [],
    73          "abstainWeight": "161147778098286584"
    74        },
    75        "25": {
    76          "supportWeight": "0",
    77          "supporters": [],
    78          "objectWeight": "0",
    79          "objectors": [],
    80          "abstainWeight": "161147778098286584"
    81        },
    82        "30": {
    83          "supportWeight": "0",
    84          "supporters": [],
    85          "objectWeight": "0",
    86          "objectors": [],
    87          "abstainWeight": "161147778098286584"
    88        },
    89        "31": {
    90          "supportWeight": "0",
    91          "supporters": [],
    92          "objectWeight": "0",
    93          "objectors": [],
    94          "abstainWeight": "161147778098286584"
    95        },
    96        "41": {
    97          "supportWeight": "0",
    98          "supporters": [],
    99          "objectWeight": "0",
   100          "objectors": [],
   101          "abstainWeight": "161147778098286584"
   102        },
   103        "62": {
   104          "supportWeight": "0",
   105          "supporters": [],
   106          "objectWeight": "0",
   107          "objectors": [],
   108          "abstainWeight": "161147778098286584"
   109        }
   110      }
   111    },
   112    "id": 1
   113  }
   114  ```
   115  
   116  ### `info.isBootstrapped`
   117  
   118  Check whether a given chain is done bootstrapping
   119  
   120  **Signature:**
   121  
   122  ```sh
   123  info.isBootstrapped({chain: string}) -> {isBootstrapped: bool}
   124  ```
   125  
   126  `chain` is the ID or alias of a chain.
   127  
   128  **Example Call:**
   129  
   130  ```sh
   131  curl -X POST --data '{
   132      "jsonrpc":"2.0",
   133      "id"     :1,
   134      "method" :"info.isBootstrapped",
   135      "params": {
   136          "chain":"X"
   137      }
   138  }' -H 'content-type:application/json;' 127.0.0.1:9650/ext/info
   139  ```
   140  
   141  **Example Response:**
   142  
   143  ```json
   144  {
   145    "jsonrpc": "2.0",
   146    "result": {
   147      "isBootstrapped": true
   148    },
   149    "id": 1
   150  }
   151  ```
   152  
   153  ### `info.getBlockchainID`
   154  
   155  Given a blockchain’s alias, get its ID. (See [`admin.aliasChain`](/reference/avalanchego/admin-api.md#adminaliaschain).)
   156  
   157  **Signature:**
   158  
   159  ```sh
   160  info.getBlockchainID({alias:string}) -> {blockchainID:string}
   161  ```
   162  
   163  **Example Call:**
   164  
   165  ```sh
   166  curl -X POST --data '{
   167      "jsonrpc":"2.0",
   168      "id"     :1,
   169      "method" :"info.getBlockchainID",
   170      "params": {
   171          "alias":"X"
   172      }
   173  }' -H 'content-type:application/json;' 127.0.0.1:9650/ext/info
   174  ```
   175  
   176  **Example Response:**
   177  
   178  ```json
   179  {
   180    "jsonrpc": "2.0",
   181    "id": 1,
   182    "result": {
   183      "blockchainID": "sV6o671RtkGBcno1FiaDbVcFv2sG5aVXMZYzKdP4VQAWmJQnM"
   184    }
   185  }
   186  ```
   187  
   188  ### `info.getNetworkID`
   189  
   190  Get the ID of the network this node is participating in.
   191  
   192  **Signature:**
   193  
   194  ```sh
   195  info.getNetworkID() -> {networkID:int}
   196  ```
   197  
   198  **Example Call:**
   199  
   200  ```sh
   201  curl -X POST --data '{
   202      "jsonrpc":"2.0",
   203      "id"     :1,
   204      "method" :"info.getNetworkID"
   205  }' -H 'content-type:application/json;' 127.0.0.1:9650/ext/info
   206  ```
   207  
   208  **Example Response:**
   209  
   210  ```json
   211  {
   212    "jsonrpc": "2.0",
   213    "id": 1,
   214    "result": {
   215      "networkID": "2"
   216    }
   217  }
   218  ```
   219  
   220  Network ID of 1 = Mainnet
   221  Network ID of 5 = Fuji (testnet)
   222  
   223  ### `info.getNetworkName`
   224  
   225  Get the name of the network this node is participating in.
   226  
   227  **Signature:**
   228  
   229  ```sh
   230  info.getNetworkName() -> {networkName:string}
   231  ```
   232  
   233  **Example Call:**
   234  
   235  ```sh
   236  curl -X POST --data '{
   237      "jsonrpc":"2.0",
   238      "id"     :1,
   239      "method" :"info.getNetworkName"
   240  }' -H 'content-type:application/json;' 127.0.0.1:9650/ext/info
   241  ```
   242  
   243  **Example Response:**
   244  
   245  ```json
   246  {
   247    "jsonrpc": "2.0",
   248    "id": 1,
   249    "result": {
   250      "networkName": "local"
   251    }
   252  }
   253  ```
   254  
   255  ### `info.getNodeID`
   256  
   257  Get the ID, the BLS key, and the proof of possession(BLS signature) of this node.
   258  
   259  :::info
   260  This endpoint set is for a specific node, it is unavailable on the [public server](/tooling/rpc-providers.md).
   261  :::
   262  
   263  **Signature:**
   264  
   265  ```sh
   266  info.getNodeID() -> {
   267      nodeID: string,
   268      nodePOP: {
   269          publicKey: string,
   270          proofOfPossession: string
   271      }
   272  }
   273  ```
   274  
   275  - `nodeID` Node ID is the unique identifier of the node that you set to act as a validator on the
   276    Primary Network.
   277  - `nodePOP` is this node's BLS key and proof of possession. Nodes must register a BLS key to act as
   278    a validator on the Primary Network. Your node's POP is logged on startup and is accessible over this endpoint.
   279    - `publicKey` is the 48 byte hex representation of the BLS key.
   280    - `proofOfPossession` is the 96 byte hex representation of the BLS signature.
   281  
   282  **Example Call:**
   283  
   284  ```sh
   285  curl -X POST --data '{
   286      "jsonrpc":"2.0",
   287      "id"     :1,
   288      "method" :"info.getNodeID"
   289  }' -H 'content-type:application/json;' 127.0.0.1:9650/ext/info
   290  ```
   291  
   292  **Example Response:**
   293  
   294  ```json
   295  {
   296    "jsonrpc": "2.0",
   297    "result": {
   298      "nodeID": "NodeID-5mb46qkSBj81k9g9e4VFjGGSbaaSLFRzD",
   299      "nodePOP": {
   300        "publicKey": "0x8f95423f7142d00a48e1014a3de8d28907d420dc33b3052a6dee03a3f2941a393c2351e354704ca66a3fc29870282e15",
   301        "proofOfPossession": "0x86a3ab4c45cfe31cae34c1d06f212434ac71b1be6cfe046c80c162e057614a94a5bc9f1ded1a7029deb0ba4ca7c9b71411e293438691be79c2dbf19d1ca7c3eadb9c756246fc5de5b7b89511c7d7302ae051d9e03d7991138299b5ed6a570a98"
   302      }
   303    },
   304    "id": 1
   305  }
   306  ```
   307  
   308  ### `info.getNodeIP`
   309  
   310  Get the IP of this node.
   311  
   312  :::info
   313  This endpoint set is for a specific node, it is unavailable on the [public server](/tooling/rpc-providers.md).
   314  :::
   315  
   316  **Signature:**
   317  
   318  ```text
   319  info.getNodeIP() -> {ip: string}
   320  ```
   321  
   322  **Example Call:**
   323  
   324  ```sh
   325  curl -X POST --data '{
   326      "jsonrpc":"2.0",
   327      "id"     :1,
   328      "method" :"info.getNodeIP"
   329  }' -H 'content-type:application/json;' 127.0.0.1:9650/ext/info
   330  ```
   331  
   332  **Example Response:**
   333  
   334  ```json
   335  {
   336    "jsonrpc": "2.0",
   337    "result": {
   338      "ip": "192.168.1.1:9651"
   339    },
   340    "id": 1
   341  }
   342  ```
   343  
   344  ### `info.getNodeVersion`
   345  
   346  Get the version of this node.
   347  
   348  **Signature:**
   349  
   350  ```sh
   351  info.getNodeVersion() -> {
   352      version: string,
   353      databaseVersion: string,
   354      gitCommit: string,
   355      vmVersions: map[string]string,
   356      rpcProtocolVersion: string,
   357  }
   358  ```
   359  
   360  where:
   361  
   362  - `version` is this node's version
   363  - `databaseVersion` is the version of the database this node is using
   364  - `gitCommit` is the Git commit that this node was built from
   365  - `vmVersions` is map where each key/value pair is the name of a VM, and the version of that VM this
   366    node runs
   367  - `rpcProtocolVersion` is the RPCChainVM protocol version
   368  
   369  **Example Call:**
   370  
   371  ```sh
   372  curl -X POST --data '{
   373      "jsonrpc":"2.0",
   374      "id"     :1,
   375      "method" :"info.getNodeVersion"
   376  }' -H 'content-type:application/json;' 127.0.0.1:9650/ext/info
   377  ```
   378  
   379  **Example Response:**
   380  
   381  ```json
   382  {
   383    "jsonrpc": "2.0",
   384    "result": {
   385      "version": "avalanche/1.9.1",
   386      "databaseVersion": "v1.4.5",
   387      "rpcProtocolVersion": "18",
   388      "gitCommit": "79cd09ba728e1cecef40acd60702f0a2d41ea404",
   389      "vmVersions": {
   390        "avm": "v1.9.1",
   391        "evm": "v0.11.1",
   392        "platform": "v1.9.1"
   393      }
   394    },
   395    "id": 1
   396  }
   397  ```
   398  
   399  ### `info.getTxFee`
   400  
   401  Get the fees of the network.
   402  
   403  **Signature:**
   404  
   405  ```sh
   406  info.getTxFee() ->
   407  {
   408      txFee: uint64,
   409      createAssetTxFee: uint64,
   410      createSubnetTxFee: uint64,
   411      transformSubnetTxFee: uint64,
   412      createBlockchainTxFee: uint64,
   413      addPrimaryNetworkValidatorFee: uint64,
   414      addPrimaryNetworkDelegatorFee: uint64,
   415      addSubnetValidatorFee: uint64,
   416      addSubnetDelegatorFee: uint64
   417  }
   418  ```
   419  
   420  - `txFee` is the default fee for making transactions.
   421  - `createAssetTxFee` is the fee for creating a new asset.
   422  - `createSubnetTxFee` is the fee for creating a new Subnet.
   423  - `transformSubnetTxFee` is the fee for converting a PoA Subnet into a PoS Subnet.
   424  - `createBlockchainTxFee` is the fee for creating a new blockchain.
   425  - `addPrimaryNetworkValidatorFee` is the fee for adding a new primary network validator.
   426  - `addPrimaryNetworkDelegatorFee` is the fee for adding a new primary network delegator.
   427  - `addSubnetValidatorFee` is the fee for adding a new Subnet validator.
   428  - `addSubnetDelegatorFee` is the fee for adding a new Subnet delegator.
   429  
   430  All fees are denominated in nAVAX.
   431  
   432  **Example Call:**
   433  
   434  ```sh
   435  curl -X POST --data '{
   436      "jsonrpc":"2.0",
   437      "id"     :1,
   438      "method" :"info.getTxFee"
   439  }' -H 'content-type:application/json;' 127.0.0.1:9650/ext/info
   440  ```
   441  
   442  **Example Response:**
   443  
   444  ```json
   445  {
   446    "jsonrpc": "2.0",
   447    "id": 1,
   448    "result": {
   449      "txFee": "1000000",
   450      "createAssetTxFee": "10000000",
   451      "createSubnetTxFee": "1000000000",
   452      "transformSubnetTxFee": "10000000000",
   453      "createBlockchainTxFee": "1000000000",
   454      "addPrimaryNetworkValidatorFee": "0",
   455      "addPrimaryNetworkDelegatorFee": "0",
   456      "addSubnetValidatorFee": "1000000",
   457      "addSubnetDelegatorFee": "1000000"
   458    }
   459  }
   460  ```
   461  
   462  ### `info.getVMs`
   463  
   464  Get the virtual machines installed on this node.
   465  
   466  :::info
   467  This endpoint set is for a specific node, it is unavailable on the [public server](/tooling/rpc-providers.md).
   468  :::
   469  
   470  **Signature:**
   471  
   472  ```sh
   473  info.getVMs() -> {
   474      vms: map[string][]string
   475  }
   476  ```
   477  
   478  **Example Call:**
   479  
   480  ```bash
   481  curl -X POST --data '{
   482      "jsonrpc":"2.0",
   483      "id"     :1,
   484      "method" :"info.getVMs",
   485      "params" :{}
   486  }' -H 'content-type:application/json;' 127.0.0.1:9650/ext/info
   487  ```
   488  
   489  **Example Response:**
   490  
   491  ```json
   492  {
   493    "jsonrpc": "2.0",
   494    "result": {
   495      "vms": {
   496        "jvYyfQTxGMJLuGWa55kdP2p2zSUYsQ5Raupu4TW34ZAUBAbtq": ["avm"],
   497        "mgj786NP7uDwBCcq6YwThhaN8FLyybkCa4zBWTQbNgmK6k9A6": ["evm"],
   498        "qd2U4HDWUvMrVUeTcCHp6xH3Qpnn1XbU5MDdnBoiifFqvgXwT": ["nftfx"],
   499        "rWhpuQPF1kb72esV2momhMuTYGkEb1oL29pt2EBXWmSy4kxnT": ["platform"],
   500        "rXJsCSEYXg2TehWxCEEGj6JU2PWKTkd6cBdNLjoe2SpsKD9cy": ["propertyfx"],
   501        "spdxUxVJQbX85MGxMHbKw1sHxMnSqJ3QBzDyDYEP3h6TLuxqQ": ["secp256k1fx"]
   502      }
   503    },
   504    "id": 1
   505  }
   506  ```
   507  
   508  ### `info.peers`
   509  
   510  Get a description of peer connections.
   511  
   512  **Signature:**
   513  
   514  ```sh
   515  info.peers({
   516      nodeIDs: string[] // optional
   517  }) ->
   518  {
   519      numPeers: int,
   520      peers:[]{
   521          ip: string,
   522          publicIP: string,
   523          nodeID: string,
   524          version: string,
   525          lastSent: string,
   526          lastReceived: string,
   527          benched: string[],
   528          observedUptime: int,
   529          observedSubnetUptime: map[string]int,
   530      }
   531  }
   532  ```
   533  
   534  - `nodeIDs` is an optional parameter to specify what NodeID's descriptions should be returned. If
   535    this parameter is left empty, descriptions for all active connections will be returned. If the
   536    node is not connected to a specified NodeID, it will be omitted from the response.
   537  - `ip` is the remote IP of the peer.
   538  - `publicIP` is the public IP of the peer.
   539  - `nodeID` is the prefixed Node ID of the peer.
   540  - `version` shows which version the peer runs on.
   541  - `lastSent` is the timestamp of last message sent to the peer.
   542  - `lastReceived` is the timestamp of last message received from the peer.
   543  - `benched` shows chain IDs that the peer is being benched.
   544  - `observedUptime` is this node's primary network uptime, observed by the peer.
   545  - `observedSubnetUptime` is a map of Subnet IDs to this node's Subnet uptimes, observed by the peer.
   546  
   547  **Example Call:**
   548  
   549  ```sh
   550  curl -X POST --data '{
   551      "jsonrpc":"2.0",
   552      "id"     :1,
   553      "method" :"info.peers",
   554      "params": {
   555          "nodeIDs": []
   556      }
   557  }' -H 'content-type:application/json;' 127.0.0.1:9650/ext/info
   558  ```
   559  
   560  **Example Response:**
   561  
   562  ```json
   563  {
   564    "jsonrpc": "2.0",
   565    "id": 1,
   566    "result": {
   567      "numPeers": 3,
   568      "peers": [
   569        {
   570          "ip": "206.189.137.87:9651",
   571          "publicIP": "206.189.137.87:9651",
   572          "nodeID": "NodeID-8PYXX47kqLDe2wD4oPbvRRchcnSzMA4J4",
   573          "version": "avalanche/1.9.4",
   574          "lastSent": "2020-06-01T15:23:02Z",
   575          "lastReceived": "2020-06-01T15:22:57Z",
   576          "benched": [],
   577          "observedUptime": "99",
   578          "observedSubnetUptimes": {},
   579          "trackedSubnets": [],
   580          "benched": []
   581        },
   582        {
   583          "ip": "158.255.67.151:9651",
   584          "publicIP": "158.255.67.151:9651",
   585          "nodeID": "NodeID-C14fr1n8EYNKyDfYixJ3rxSAVqTY3a8BP",
   586          "version": "avalanche/1.9.4",
   587          "lastSent": "2020-06-01T15:23:02Z",
   588          "lastReceived": "2020-06-01T15:22:34Z",
   589          "benched": [],
   590          "observedUptime": "75",
   591          "observedSubnetUptimes": {
   592            "29uVeLPJB1eQJkzRemU8g8wZDw5uJRqpab5U2mX9euieVwiEbL": "100"
   593          },
   594          "trackedSubnets": [
   595            "29uVeLPJB1eQJkzRemU8g8wZDw5uJRqpab5U2mX9euieVwiEbL"
   596          ],
   597          "benched": []
   598        },
   599        {
   600          "ip": "83.42.13.44:9651",
   601          "publicIP": "83.42.13.44:9651",
   602          "nodeID": "NodeID-LPbcSMGJ4yocxYxvS2kBJ6umWeeFbctYZ",
   603          "version": "avalanche/1.9.3",
   604          "lastSent": "2020-06-01T15:23:02Z",
   605          "lastReceived": "2020-06-01T15:22:55Z",
   606          "benched": [],
   607          "observedUptime": "95",
   608          "observedSubnetUptimes": {},
   609          "trackedSubnets": [],
   610          "benched": []
   611        }
   612      ]
   613    }
   614  }
   615  ```
   616  
   617  ### `info.uptime`
   618  
   619  Returns the network's observed uptime of this node.
   620  This is the only reliable source of data for your node's uptime.
   621  Other sources may be using data gathered with incomplete (limited) information.
   622  
   623  **Signature:**
   624  
   625  ```sh
   626  info.uptime({
   627      subnetID: string // optional
   628  }) ->
   629  {
   630      rewardingStakePercentage: float64,
   631      weightedAveragePercentage: float64
   632  }
   633  ```
   634  
   635  - `subnetID` is the Subnet to get the uptime of. If not provided, returns the uptime of the node on
   636    the primary network.
   637  
   638  - `rewardingStakePercentage` is the percent of stake which thinks this node is above the uptime
   639    requirement.
   640  - `weightedAveragePercentage` is the stake-weighted average of all observed uptimes for this node.
   641  
   642  **Example Call:**
   643  
   644  ```sh
   645  curl -X POST --data '{
   646      "jsonrpc":"2.0",
   647      "id"     :1,
   648      "method" :"info.uptime"
   649  }' -H 'content-type:application/json;' 127.0.0.1:9650/ext/info
   650  ```
   651  
   652  **Example Response:**
   653  
   654  ```json
   655  {
   656    "jsonrpc": "2.0",
   657    "id": 1,
   658    "result": {
   659      "rewardingStakePercentage": "100.0000",
   660      "weightedAveragePercentage": "99.0000"
   661    }
   662  }
   663  ```
   664  
   665  #### **Example Subnet Call**
   666  
   667  ```sh
   668  curl -X POST --data '{
   669      "jsonrpc":"2.0",
   670      "id"     :1,
   671      "method" :"info.uptime",
   672      "params" :{
   673          "subnetID":"29uVeLPJB1eQJkzRemU8g8wZDw5uJRqpab5U2mX9euieVwiEbL"
   674      }
   675  }' -H 'content-type:application/json;' 127.0.0.1:9650/ext/info
   676  ```
   677  
   678  #### **Example Subnet Response**
   679  
   680  ```json
   681  {
   682    "jsonrpc": "2.0",
   683    "id": 1,
   684    "result": {
   685      "rewardingStakePercentage": "74.0741",
   686      "weightedAveragePercentage": "72.4074"
   687    }
   688  }
   689  ```