From bffa42a26b4007984c3f1eba3d9098dfc5e278cf Mon Sep 17 00:00:00 2001 From: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> Date: Mon, 25 Nov 2024 12:16:20 +0530 Subject: [PATCH] remove old api docs and add remote links (#1957) --- content/docs/api-reference/admin-api.mdx | 431 ---- content/docs/api-reference/health-api.mdx | 283 --- content/docs/api-reference/index-api.mdx | 557 ----- content/docs/api-reference/info-api.mdx | 677 ------ content/docs/api-reference/keystore-api.mdx | 254 --- content/docs/api-reference/metrics-api.mdx | 36 - content/docs/api-reference/p-chain/api.mdx | 2036 ------------------- utils/remote-content.mts | 49 + 8 files changed, 49 insertions(+), 4274 deletions(-) delete mode 100644 content/docs/api-reference/admin-api.mdx delete mode 100644 content/docs/api-reference/health-api.mdx delete mode 100644 content/docs/api-reference/index-api.mdx delete mode 100644 content/docs/api-reference/info-api.mdx delete mode 100644 content/docs/api-reference/keystore-api.mdx delete mode 100644 content/docs/api-reference/metrics-api.mdx delete mode 100644 content/docs/api-reference/p-chain/api.mdx diff --git a/content/docs/api-reference/admin-api.mdx b/content/docs/api-reference/admin-api.mdx deleted file mode 100644 index 13695292bc8..00000000000 --- a/content/docs/api-reference/admin-api.mdx +++ /dev/null @@ -1,431 +0,0 @@ ---- -title: Admin API ---- - -} > -This page was generated by a plugin that directly references this [file](https://github.com/ava-labs/avalanchego/tree/master/api/admin/service.md) in the AvalancheGo GitHub repository. - - -This API can be used for measuring node health and debugging. - - -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`](/nodes/configure/configs-flags#--api-admin-enabled-boolean). - -This API set is for a specific node, it is unavailable on the [public server](/tooling/rpc-providers). - - -## Format - -This API uses the `json 2.0` RPC format. For details, see [here](/api-reference/standards/guides/issuing-api-calls). - -## Endpoint - -``` -/ext/admin -``` - -## 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}) -> {} -``` - -- `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": {} -} -``` - -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. - - -Aliasing a chain can also be done via the [Node API](/nodes/configure/configs-flags#--chain-aliases-file-string). - -Note that the alias is set for each chain on each node individually. In a multi-node Avalanche L1, the same alias should be configured on each node to use an alias across an Avalanche L1 successfully. Setting an alias for a chain on one node does not register that alias with other nodes automatically. - - -**Signature**: - -``` -admin.aliasChain( - { - chain:string, - alias:string - } -) -> {} -``` - -- `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": {} -} -``` - -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](/virtual-machines#installing-a-vm) 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() -> {} -``` - -**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": {} -} -``` - -### `admin.memoryProfile` - -Writes a memory profile of the to `mem.profile`. - -**Signature**: - -``` -admin.memoryProfile() -> {} -``` - -**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": {} -} -``` - -### `admin.setLoggerLevel` - -Sets log and display levels of loggers. - -**Signature**: - -``` -admin.setLoggerLevel( - { - loggerName: string, // optional - logLevel: string, // optional - displayLevel: string, // optional - } -) -> {} -``` - -- `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 omitted 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": {} -} -``` - -### `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() -> {} -``` - -**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": {} -} -``` - -### `admin.stopCPUProfiler` - -Stop the CPU profile that was previously started. - -**Signature**: - -``` -admin.stopCPUProfiler() -> {} -``` - -**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": {} -} - -``` - diff --git a/content/docs/api-reference/health-api.mdx b/content/docs/api-reference/health-api.mdx deleted file mode 100644 index e6aefb42977..00000000000 --- a/content/docs/api-reference/health-api.mdx +++ /dev/null @@ -1,283 +0,0 @@ ---- -title: Health API ---- -} > -This page was generated by a plugin that directly references this [file](https://github.com/ava-labs/avalanchego/tree/master/api/health/service.md) in the AvalancheGo GitHub repository. - -This API can be used for measuring node health. - - - -This API set is for a specific node; it is unavailable on the [public server](/tooling/rpc-providers). - -Health Checks[​](#health-checks "Direct link to heading") ---------------------------------------------------------- - -The node periodically runs all health checks, including health checks for each chain. - -The frequency at which health checks are run can be specified with the [\--health-check-frequency](/nodes/configure/configs-flags) flag. - -Filterable Health Checks[​](#filterable-health-checks "Direct link to heading") -------------------------------------------------------------------------------- - -The health checks that are run by the node are filterable. You can specify which health checks you want to see by using `tags` filters. Returned results will only include health checks that match the specified tags and global health checks like `network`, `database` etc. When filtered, the returned results will not show the full node health, but only a subset of filtered health checks. This means the node can still be unhealthy in unfiltered checks, even if the returned results show that the node is healthy. AvalancheGo supports using subnetIDs as tags. - -GET Request[​](#get-request "Direct link to heading") ------------------------------------------------------ - -To get an HTTP status code response that indicates the node's health, make a `GET` request. If the node is healthy, it will return a `200` status code. If the node is unhealthy, it will return a `503` status code. In-depth information about the node's health is included in the response body. - -### Filtering[​](#filtering "Direct link to heading") - -To filter GET health checks, add a `tag` query parameter to the request. The `tag` parameter is a string. For example, to filter health results by subnetID `29uVeLPJB1eQJkzRemU8g8wZDw5uJRqpab5U2mX9euieVwiEbL`, use the following query: - -``` -curl 'http://localhost:9650/ext/health?tag=29uVeLPJB1eQJkzRemU8g8wZDw5uJRqpab5U2mX9euieVwiEbL' -``` - -In this example returned results will contain global health checks and health checks that are related to subnetID `29uVeLPJB1eQJkzRemU8g8wZDw5uJRqpab5U2mX9euieVwiEbL`. - -**Note**: This filtering can show healthy results even if the node is unhealthy in other Chains/Avalanche L1s. - -In order to filter results by multiple tags, use multiple `tag` query parameters. For example, to filter health results by subnetID `29uVeLPJB1eQJkzRemU8g8wZDw5uJRqpab5U2mX9euieVwiEbL` and `28nrH5T2BMvNrWecFcV3mfccjs6axM1TVyqe79MCv2Mhs8kxiY` use the following query: - -``` -curl 'http://localhost:9650/ext/health?tag=29uVeLPJB1eQJkzRemU8g8wZDw5uJRqpab5U2mX9euieVwiEbL&tag=28nrH5T2BMvNrWecFcV3mfccjs6axM1TVyqe79MCv2Mhs8kxiY' -``` - -The returned results will include health checks for both subnetIDs as well as global health checks. - -### Endpoints[​](#endpoints "Direct link to heading") - -The available endpoints for GET requests are: - -- `/ext/health` returns a holistic report of the status of the node. **Most operators should monitor this status.** -- `/ext/health/health` is the same as `/ext/health`. -- `/ext/health/readiness` returns healthy once the node has finished initializing. -- `/ext/health/liveness` returns healthy once the endpoint is available. - -JSON RPC Request[​](#json-rpc-request "Direct link to heading") ---------------------------------------------------------------- - -### Format[​](#format "Direct link to heading") - -This API uses the `json 2.0` RPC format. For more information on making JSON RPC calls, see [here](/api-reference/standards/guides/issuing-api-calls). - -### Endpoint[​](#endpoint "Direct link to heading") - -### Methods[​](#methods "Direct link to heading") - -#### `health.health`[​](#healthhealth "Direct link to heading") - -This method returns the last set of health check results. - -**Example Call**: - -``` -curl -H 'Content-Type: application/json' --data '{ - "jsonrpc":"2.0", - "id" :1, - "method" :"health.health", - "params": { - "tags": ["11111111111111111111111111111111LpoYY", "29uVeLPJB1eQJkzRemU8g8wZDw5uJRqpab5U2mX9euieVwiEbL"] - } -}' 'http://localhost:9650/ext/health' -``` - -**Example Response**: - -``` -{ - "jsonrpc": "2.0", - "result": { - "checks": { - "C": { - "message": { - "engine": { - "consensus": { - "lastAcceptedHeight": 31273749, - "lastAcceptedID": "2Y4gZGzQnu8UjnHod8j1BLewHFVEbzhULPNzqrSWEHkHNqDrYL", - "longestProcessingBlock": "0s", - "processingBlocks": 0 - }, - "vm": null - }, - "networking": { - "percentConnected": 0.9999592612587486 - } - }, - "timestamp": "2024-03-26T19:44:45.2931-04:00", - "duration": 20375 - }, - "P": { - "message": { - "engine": { - "consensus": { - "lastAcceptedHeight": 142517, - "lastAcceptedID": "2e1FEPCBEkG2Q7WgyZh1v4nt3DXj1HDbDthyhxdq2Ltg3shSYq", - "longestProcessingBlock": "0s", - "processingBlocks": 0 - }, - "vm": null - }, - "networking": { - "percentConnected": 0.9999592612587486 - } - }, - "timestamp": "2024-03-26T19:44:45.293115-04:00", - "duration": 8750 - }, - "X": { - "message": { - "engine": { - "consensus": { - "lastAcceptedHeight": 24464, - "lastAcceptedID": "XuFCsGaSw9cn7Vuz5e2fip4KvP46Xu53S8uDRxaC2QJmyYc3w", - "longestProcessingBlock": "0s", - "processingBlocks": 0 - }, - "vm": null - }, - "networking": { - "percentConnected": 0.9999592612587486 - } - }, - "timestamp": "2024-03-26T19:44:45.29312-04:00", - "duration": 23291 - }, - "bootstrapped": { - "message": [], - "timestamp": "2024-03-26T19:44:45.293078-04:00", - "duration": 3375 - }, - "database": { - "timestamp": "2024-03-26T19:44:45.293102-04:00", - "duration": 1959 - }, - "diskspace": { - "message": { - "availableDiskBytes": 227332591616 - }, - "timestamp": "2024-03-26T19:44:45.293106-04:00", - "duration": 3042 - }, - "network": { - "message": { - "connectedPeers": 284, - "sendFailRate": 0, - "timeSinceLastMsgReceived": "293.098ms", - "timeSinceLastMsgSent": "293.098ms" - }, - "timestamp": "2024-03-26T19:44:45.2931-04:00", - "duration": 2333 - }, - "router": { - "message": { - "longestRunningRequest": "66.90725ms", - "outstandingRequests": 3 - }, - "timestamp": "2024-03-26T19:44:45.293097-04:00", - "duration": 3542 - } - }, - "healthy": true - }, - "id": 1 -} -``` - -In this example response, every check has passed. So, the node is healthy. - -**Response Explanation**: - -- `checks` is a list of health check responses. - - A check response may include a `message` with additional context. - - A check response may include an `error` describing why the check failed. - - `timestamp` is the timestamp of the last health check. - - `duration` is the execution duration of the last health check, in nanoseconds. - - `contiguousFailures` is the number of times in a row this check failed. - - `timeOfFirstFailure` is the time this check first failed. -- `healthy` is true all the health checks are passing. - -#### `health.readiness`[​](#healthreadiness "Direct link to heading") - -This method returns the last evaluation of the startup health check results. - -**Example Call**: - -``` -curl -H 'Content-Type: application/json' --data '{ - "jsonrpc":"2.0", - "id" :1, - "method" :"health.readiness", - "params": { - "tags": ["11111111111111111111111111111111LpoYY", "29uVeLPJB1eQJkzRemU8g8wZDw5uJRqpab5U2mX9euieVwiEbL"] - } -}' 'http://localhost:9650/ext/health' -``` - -**Example Response**: - -``` -{ - "jsonrpc": "2.0", - "result": { - "checks": { - "bootstrapped": { - "message": [], - "timestamp": "2024-03-26T20:02:45.299114-04:00", - "duration": 2834 - } - }, - "healthy": true - }, - "id": 1 -} -``` - -In this example response, every check has passed. So, the node has finished the startup process. - -**Response Explanation**: - -- `checks` is a list of health check responses. - - A check response may include a `message` with additional context. - - A check response may include an `error` describing why the check failed. - - `timestamp` is the timestamp of the last health check. - - `duration` is the execution duration of the last health check, in nanoseconds. - - `contiguousFailures` is the number of times in a row this check failed. - - `timeOfFirstFailure` is the time this check first failed. -- `healthy` is true all the health checks are passing. - -#### `health.liveness`[​](#healthliveness "Direct link to heading") - -This method returns healthy. - -**Example Call**: - -``` -curl -H 'Content-Type: application/json' --data '{ - "jsonrpc":"2.0", - "id" :1, - "method" :"health.liveness" -}' 'http://localhost:9650/ext/health' -``` - -**Example Response**: - -``` -{ - "jsonrpc": "2.0", - "result": { - "checks": {}, - "healthy": true - }, - "id": 1 -} -``` - -In this example response, the node was able to handle the request and mark the service as healthy. - -**Response Explanation**: - -- `checks` is an empty list. -- `healthy` is true. diff --git a/content/docs/api-reference/index-api.mdx b/content/docs/api-reference/index-api.mdx deleted file mode 100644 index 6f47112ff38..00000000000 --- a/content/docs/api-reference/index-api.mdx +++ /dev/null @@ -1,557 +0,0 @@ ---- -title: Index API ---- - -} > -This page was generated by a plugin that directly references this [file](https://github.com/ava-labs/avalanchego/tree/master/indexer/service.md) in the AvalancheGo GitHub repository. - - -AvalancheGo can be configured to run with an indexer. That is, it saves (indexes) every container (a block, vertex or transaction) it accepts on the X-Chain, P-Chain and C-Chain. To run AvalancheGo with indexing enabled, set command line flag [\--index-enabled](/nodes/configure/configs-flags#apis) to true. - -**AvalancheGo will only index containers that are accepted when running with `--index-enabled` set to true.** To ensure your node has a complete index, run a node with a fresh database and `--index-enabled` set to true. The node will accept every block, vertex and transaction in the network history during bootstrapping, ensuring your index is complete. - -It is OK to turn off your node if it is running with indexing enabled. If it restarts with indexing still enabled, it will accept all containers that were accepted while it was offline. The indexer should never fail to index an accepted block, vertex or transaction. - -Indexed containers (that is, accepted blocks, vertices and transactions) are timestamped with the time at which the node accepted that container. Note that if the container was indexed during bootstrapping, other nodes may have accepted the container much earlier. Every container indexed during bootstrapping will be timestamped with the time at which the node bootstrapped, not when it was first accepted by the network. - -If `--index-enabled` is changed to `false` from `true`, AvalancheGo won't start as doing so would cause a previously complete index to become incomplete, unless the user explicitly says to do so with `--index-allow-incomplete`. This protects you from accidentally running with indexing disabled, after previously running with it enabled, which would result in an incomplete index. - -This document shows how to query data from AvalancheGo's Index API. The Index API is only available when running with `--index-enabled`. - -Go Client[​](#go-client "Direct link to heading") -------------------------------------------------- - -There is a Go implementation of an Index API client. See documentation [here](https://pkg.go.dev/github.com/ava-labs/avalanchego/indexer#Client). This client can be used inside a Go program to connect to an AvalancheGo node that is running with the Index API enabled and make calls to the Index API. - -Format[​](#format "Direct link to heading") -------------------------------------------- - -This API uses the `json 2.0` RPC format. For more information on making JSON RPC calls, see [here](/api-reference/standards/guides/issuing-api-calls). - -Endpoints[​](#endpoints "Direct link to heading") -------------------------------------------------- - -Each chain has one or more index. To see if a C-Chain block is accepted, for example, send an API call to the C-Chain block index. To see if an X-Chain vertex is accepted, for example, send an API call to the X-Chain vertex index. - -### C-Chain Blocks - -```text -/ext/index/C/block -``` - -### P-Chain Blocks - -```text -/ext/index/P/block -``` - -### X-Chain Transactions - -```text -/ext/index/X/tx -``` - -### X-Chain Blocks - -```text -/ext/index/X/block -``` - - -To ensure historical data can be accessed, the `/ext/index/X/vtx` is still accessible, even though it is no longer populated with chain data since the Cortina activation. If you are using `V1.10.0` or higher, you need to migrate to using the `/ext/index/X/block` endpoint. - - -Methods[​](#methods "Direct link to heading") ---------------------------------------------- - -### `index.getContainerByID`[​](#indexgetcontainerbyid "Direct link to heading") - -Get container by ID. - -**Signature**: - -```json -index.getContainerByID({ - id: string, - encoding: string -}) -> { - id: string, - bytes: string, - timestamp: string, - encoding: string, - index: string -} -``` - -**Request**: - -- `id` is the container's ID -- `encoding` is `"hex"` only. - -**Response**: - -- `id` is the container's ID -- `bytes` is the byte representation of the container -- `timestamp` is the time at which this node accepted the container -- `encoding` is `"hex"` only. -- `index` is how many containers were accepted in this index before this one - -**Example Call**: - -``` -curl --location --request POST 'localhost:9650/ext/index/X/tx' \ ---header 'Content-Type: application/json' \ ---data-raw '{ - "jsonrpc": "2.0", - "method": "index.getContainerByID", - "params": { - "id": "6fXf5hncR8LXvwtM8iezFQBpK5cubV6y1dWgpJCcNyzGB1EzY", - "encoding":"hex" - }, - "id": 1 -}' -``` - -**Example Response**: - -```json -{ - "jsonrpc": "2.0", - "id": 1, - "result": { - "id": "6fXf5hncR8LXvwtM8iezFQBpK5cubV6y1dWgpJCcNyzGB1EzY", - "bytes": "0x00000000000400003039d891ad56056d9c01f18f43f58b5c784ad07a4a49cf3d1f11623804b5cba2c6bf00000001dbcf890f77f49b96857648b72b77f9f82937f28a68704af05da0dc12ba53f2db000000070429ccc5c5eb3b80000000000000000000000001000000013cb7d3842e8cee6a0ebd09f1fe884f6861e1b29c00000001dbcf890f77f49b96857648b72b77f9f82937f28a68704af05da0dc12ba53f2db00000001dbcf890f77f49b96857648b72b77f9f82937f28a68704af05da0dc12ba53f2db000000050429d069189e0000000000010000000000000000c85fc1980a77c5da78fe5486233fc09a769bb812bcb2cc548cf9495d046b3f1b00000001dbcf890f77f49b96857648b72b77f9f82937f28a68704af05da0dc12ba53f2db00000007000003a352a38240000000000000000000000001000000013cb7d3842e8cee6a0ebd09f1fe884f6861e1b29c0000000100000009000000011cdb75d4e0b0aeaba2ebc1ef208373fedc1ebbb498f8385ad6fb537211d1523a70d903b884da77d963d56f163191295589329b5710113234934d0fd59c01676b00b63d2108", - "timestamp": "2021-04-02T15:34:00.262979-07:00", - "encoding": "hex", - "index": "0" - } -} -``` - -### `index.getContainerByIndex`[​](#indexgetcontainerbyindex "Direct link to heading") - -Get container by index. The first container accepted is at index 0, the second is at index 1, etc. - -**Signature**: - -``` -index.getContainerByIndex({ - index: uint64, - encoding: string -}) -> { - id: string, - bytes: string, - timestamp: string, - encoding: string, - index: string -} -``` - -**Request**: - -- `index` is how many containers were accepted in this index before this one -- `encoding` is `"hex"` only. - -**Response**: - -- `id` is the container's ID -- `bytes` is the byte representation of the container -- `timestamp` is the time at which this node accepted the container -- `index` is how many containers were accepted in this index before this one -- `encoding` is `"hex"` only. - -**Example Call**: - -``` -curl --location --request POST 'localhost:9650/ext/index/X/tx' \ ---header 'Content-Type: application/json' \ ---data-raw '{ - "jsonrpc": "2.0", - "method": "index.getContainerByIndex", - "params": { - "index":0, - "encoding": "hex" - }, - "id": 1 -}' -``` - -**Example Response**: - -``` -{ - "jsonrpc": "2.0", - "id": 1, - "result": { - "id": "6fXf5hncR8LXvwtM8iezFQBpK5cubV6y1dWgpJCcNyzGB1EzY", - "bytes": "0x00000000000400003039d891ad56056d9c01f18f43f58b5c784ad07a4a49cf3d1f11623804b5cba2c6bf00000001dbcf890f77f49b96857648b72b77f9f82937f28a68704af05da0dc12ba53f2db000000070429ccc5c5eb3b80000000000000000000000001000000013cb7d3842e8cee6a0ebd09f1fe884f6861e1b29c00000001dbcf890f77f49b96857648b72b77f9f82937f28a68704af05da0dc12ba53f2db00000001dbcf890f77f49b96857648b72b77f9f82937f28a68704af05da0dc12ba53f2db000000050429d069189e0000000000010000000000000000c85fc1980a77c5da78fe5486233fc09a769bb812bcb2cc548cf9495d046b3f1b00000001dbcf890f77f49b96857648b72b77f9f82937f28a68704af05da0dc12ba53f2db00000007000003a352a38240000000000000000000000001000000013cb7d3842e8cee6a0ebd09f1fe884f6861e1b29c0000000100000009000000011cdb75d4e0b0aeaba2ebc1ef208373fedc1ebbb498f8385ad6fb537211d1523a70d903b884da77d963d56f163191295589329b5710113234934d0fd59c01676b00b63d2108", - "timestamp": "2021-04-02T15:34:00.262979-07:00", - "encoding": "hex", - "index": "0" - } -} -``` - -### `index.getContainerRange`[​](#indexgetcontainerrange "Direct link to heading") - -Returns the transactions at index \[`startIndex`\], \[`startIndex+1`\], ... , \[`startIndex+n-1`\] - -- If \[`n`\] == 0, returns an empty response (for example: null). -- If \[`startIndex`\] > the last accepted index, returns an error (unless the above apply.) -- If \[`n`\] > \[`MaxFetchedByRange`\], returns an error. -- If we run out of transactions, returns the ones fetched before running out. -- `numToFetch` must be in `[0,1024]`. - -**Signature**: - -``` -index.getContainerRange({ - startIndex: uint64, - numToFetch: uint64, - encoding: string -}) -> []{ - id: string, - bytes: string, - timestamp: string, - encoding: string, - index: string -} -``` - -**Request**: - -- `startIndex` is the beginning index -- `numToFetch` is the number of containers to fetch -- `encoding` is `"hex"` only. - -**Response**: - -- `id` is the container's ID -- `bytes` is the byte representation of the container -- `timestamp` is the time at which this node accepted the container -- `encoding` is `"hex"` only. -- `index` is how many containers were accepted in this index before this one - -**Example Call**: - -``` -curl --location --request POST 'localhost:9650/ext/index/X/tx' \ ---header 'Content-Type: application/json' \ ---data-raw '{ - "jsonrpc": "2.0", - "method": "index.getContainerRange", - "params": { - "startIndex":0, - "numToFetch":100, - "encoding": "hex" - }, - "id": 1 -}' -``` - -**Example Response**: - -``` -{ - "jsonrpc": "2.0", - "id": 1, - "result": [ - { - "id": "6fXf5hncR8LXvwtM8iezFQBpK5cubV6y1dWgpJCcNyzGB1EzY", - "bytes": "0x00000000000400003039d891ad56056d9c01f18f43f58b5c784ad07a4a49cf3d1f11623804b5cba2c6bf00000001dbcf890f77f49b96857648b72b77f9f82937f28a68704af05da0dc12ba53f2db000000070429ccc5c5eb3b80000000000000000000000001000000013cb7d3842e8cee6a0ebd09f1fe884f6861e1b29c00000001dbcf890f77f49b96857648b72b77f9f82937f28a68704af05da0dc12ba53f2db00000001dbcf890f77f49b96857648b72b77f9f82937f28a68704af05da0dc12ba53f2db000000050429d069189e0000000000010000000000000000c85fc1980a77c5da78fe5486233fc09a769bb812bcb2cc548cf9495d046b3f1b00000001dbcf890f77f49b96857648b72b77f9f82937f28a68704af05da0dc12ba53f2db00000007000003a352a38240000000000000000000000001000000013cb7d3842e8cee6a0ebd09f1fe884f6861e1b29c0000000100000009000000011cdb75d4e0b0aeaba2ebc1ef208373fedc1ebbb498f8385ad6fb537211d1523a70d903b884da77d963d56f163191295589329b5710113234934d0fd59c01676b00b63d2108", - "timestamp": "2021-04-02T15:34:00.262979-07:00", - "encoding": "hex", - "index": "0" - } - ] -} -``` - -### `index.getIndex`[​](#indexgetindex "Direct link to heading") - -Get a container's index. - -**Signature**: - -``` -index.getIndex({ - id: string, - encoding: string -}) -> { - index: string -} -``` - -**Request**: - -- `id` is the ID of the container to fetch -- `encoding` is `"hex"` only. - -**Response**: - -- `index` is how many containers were accepted in this index before this one - -**Example Call**: - -``` -curl --location --request POST 'localhost:9650/ext/index/X/tx' \ ---header 'Content-Type: application/json' \ ---data-raw '{ - "jsonrpc": "2.0", - "method": "index.getIndex", - "params": { - "id":"6fXf5hncR8LXvwtM8iezFQBpK5cubV6y1dWgpJCcNyzGB1EzY", - "encoding": "hex" - }, - "id": 1 -}' -``` - -**Example Response**: - -``` -{ - "jsonrpc": "2.0", - "result": { - "index": "0" - }, - "id": 1 -} -``` - -### `index.getLastAccepted`[​](#indexgetlastaccepted "Direct link to heading") - -Get the most recently accepted container. - -**Signature**: - -``` -index.getLastAccepted({ - encoding:string -}) -> { - id: string, - bytes: string, - timestamp: string, - encoding: string, - index: string -} -``` - -**Request**: - -- `encoding` is `"hex"` only. - -**Response**: - -- `id` is the container's ID -- `bytes` is the byte representation of the container -- `timestamp` is the time at which this node accepted the container -- `encoding` is `"hex"` only. - -**Example Call**: - -``` -curl --location --request POST 'localhost:9650/ext/index/X/tx' \ ---header 'Content-Type: application/json' \ ---data-raw '{ - "jsonrpc": "2.0", - "method": "index.getLastAccepted", - "params": { - "encoding": "hex" - }, - "id": 1 -}' -``` - -**Example Response**: - -``` -{ - "jsonrpc": "2.0", - "id": 1, - "result": { - "id": "6fXf5hncR8LXvwtM8iezFQBpK5cubV6y1dWgpJCcNyzGB1EzY", - "bytes": "0x00000000000400003039d891ad56056d9c01f18f43f58b5c784ad07a4a49cf3d1f11623804b5cba2c6bf00000001dbcf890f77f49b96857648b72b77f9f82937f28a68704af05da0dc12ba53f2db000000070429ccc5c5eb3b80000000000000000000000001000000013cb7d3842e8cee6a0ebd09f1fe884f6861e1b29c00000001dbcf890f77f49b96857648b72b77f9f82937f28a68704af05da0dc12ba53f2db00000001dbcf890f77f49b96857648b72b77f9f82937f28a68704af05da0dc12ba53f2db000000050429d069189e0000000000010000000000000000c85fc1980a77c5da78fe5486233fc09a769bb812bcb2cc548cf9495d046b3f1b00000001dbcf890f77f49b96857648b72b77f9f82937f28a68704af05da0dc12ba53f2db00000007000003a352a38240000000000000000000000001000000013cb7d3842e8cee6a0ebd09f1fe884f6861e1b29c0000000100000009000000011cdb75d4e0b0aeaba2ebc1ef208373fedc1ebbb498f8385ad6fb537211d1523a70d903b884da77d963d56f163191295589329b5710113234934d0fd59c01676b00b63d2108", - "timestamp": "2021-04-02T15:34:00.262979-07:00", - "encoding": "hex", - "index": "0" - } -} -``` - -### `index.isAccepted`[​](#indexisaccepted "Direct link to heading") - -Returns true if the container is in this index. - -**Signature**: - -``` -index.isAccepted({ - id: string, - encoding: string -}) -> { - isAccepted: bool -} -``` - -**Request**: - -- `id` is the ID of the container to fetch -- `encoding` is `"hex"` only. - -**Response**: - -- `isAccepted` displays if the container has been accepted - -**Example Call**: - -``` -curl --location --request POST 'localhost:9650/ext/index/X/tx' \ ---header 'Content-Type: application/json' \ ---data-raw '{ - "jsonrpc": "2.0", - "method": "index.isAccepted", - "params": { - "id":"6fXf5hncR8LXvwtM8iezFQBpK5cubV6y1dWgpJCcNyzGB1EzY", - "encoding": "hex" - }, - "id": 1 -}' -``` - -**Example Response**: - -``` -{ - "jsonrpc": "2.0", - "result": { - "isAccepted": true - }, - "id": 1 -} -``` - -Example: Iterating Through X-Chain Transaction[​](#example-iterating-through-x-chain-transaction "Direct link to heading") --------------------------------------------------------------------------------------------------------------------------- - -Here is an example of how to iterate through all transactions on the X-Chain. - - -You can use the Index API to get the ID of every transaction that has been accepted on the X-Chain, and use the X-Chain API method `avm.getTx` to get a human-readable representation of the transaction. - -To get an X-Chain transaction by its index (the order it was accepted in), use Index API method [index.getlastaccepted](#indexgetlastaccepted). - -For example, to get the _second_ transaction (note that `"index":1`) accepted on the X-Chain, do: - -``` -curl --location --request POST 'https://indexer-demo.avax.network/ext/index/X/tx' \ ---header 'Content-Type: application/json' \ ---data-raw '{ - "jsonrpc": "2.0", - "method": "index.getContainerByIndex", - "params": { - "encoding":"hex", - "index":1 - }, - "id": 1 -}' -``` - -This returns the ID of the second transaction accepted in the X-Chain's history. To get the third transaction on the X-Chain, use `"index":2`, and so on. - -The above API call gives the response below: - -``` -{ - "jsonrpc": "2.0", - "result": { - "id": "ZGYTSU8w3zUP6VFseGC798vA2Vnxnfj6fz1QPfA9N93bhjJvo", - "bytes": "0x00000000000000000001ed5f38341e436e5d46e2bb00b45d62ae97d1b050c64bc634ae10626739e35c4b0000000221e67317cbc4be2aeb00677ad6462778a8f52274b9d605df2591b23027a87dff000000070000000129f6afc0000000000000000000000001000000017416792e228a765c65e2d76d28ab5a16d18c342f21e67317cbc4be2aeb00677ad6462778a8f52274b9d605df2591b23027a87dff0000000700000222afa575c00000000000000000000000010000000187d6a6dd3cd7740c8b13a410bea39b01fa83bb3e000000016f375c785edb28d52edb59b54035c96c198e9d80f5f5f5eee070592fe9465b8d0000000021e67317cbc4be2aeb00677ad6462778a8f52274b9d605df2591b23027a87dff0000000500000223d9ab67c0000000010000000000000000000000010000000900000001beb83d3d29f1247efb4a3a1141ab5c966f46f946f9c943b9bc19f858bd416d10060c23d5d9c7db3a0da23446b97cd9cf9f8e61df98e1b1692d764c84a686f5f801a8da6e40", - "timestamp": "2021-11-04T00:42:55.01643414Z", - "encoding": "hex", - "index": "1" - }, - "id": 1 -} -``` - -The ID of this transaction is `ZGYTSU8w3zUP6VFseGC798vA2Vnxnfj6fz1QPfA9N93bhjJvo`. - -To get the transaction by its ID, use API method `avm.getTx`: - -``` -curl -X POST --data '{ - "jsonrpc":"2.0", - "id" :1, - "method" :"avm.getTx", - "params" :{ - "txID":"ZGYTSU8w3zUP6VFseGC798vA2Vnxnfj6fz1QPfA9N93bhjJvo", - "encoding": "json" - } -}' -H 'content-type:application/json;' https://api.avax.network/ext/bc/X -``` - -Response: - -``` -{ - "jsonrpc": "2.0", - "result": { - "tx": { - "unsignedTx": { - "networkID": 1, - "blockchainID": "2oYMBNV4eNHyqk2fjjV5nVQLDbtmNJzq5s3qs3Lo6ftnC6FByM", - "outputs": [ - { - "assetID": "FvwEAhmxKfeiG8SnEvq42hc6whRyY3EFYAvebMqDNDGCgxN5Z", - "fxID": "spdxUxVJQbX85MGxMHbKw1sHxMnSqJ3QBzDyDYEP3h6TLuxqQ", - "output": { - "addresses": ["X-avax1wst8jt3z3fm9ce0z6akj3266zmgccdp03hjlaj"], - "amount": 4999000000, - "locktime": 0, - "threshold": 1 - } - }, - { - "assetID": "FvwEAhmxKfeiG8SnEvq42hc6whRyY3EFYAvebMqDNDGCgxN5Z", - "fxID": "spdxUxVJQbX85MGxMHbKw1sHxMnSqJ3QBzDyDYEP3h6TLuxqQ", - "output": { - "addresses": ["X-avax1slt2dhfu6a6qezcn5sgtagumq8ag8we75f84sw"], - "amount": 2347999000000, - "locktime": 0, - "threshold": 1 - } - } - ], - "inputs": [ - { - "txID": "qysTYUMCWdsR3MctzyfXiSvoSf6evbeFGRLLzA4j2BjNXTknh", - "outputIndex": 0, - "assetID": "FvwEAhmxKfeiG8SnEvq42hc6whRyY3EFYAvebMqDNDGCgxN5Z", - "fxID": "spdxUxVJQbX85MGxMHbKw1sHxMnSqJ3QBzDyDYEP3h6TLuxqQ", - "input": { - "amount": 2352999000000, - "signatureIndices": [0] - } - } - ], - "memo": "0x" - }, - "credentials": [ - { - "fxID": "spdxUxVJQbX85MGxMHbKw1sHxMnSqJ3QBzDyDYEP3h6TLuxqQ", - "credential": { - "signatures": [ - "0xbeb83d3d29f1247efb4a3a1141ab5c966f46f946f9c943b9bc19f858bd416d10060c23d5d9c7db3a0da23446b97cd9cf9f8e61df98e1b1692d764c84a686f5f801" - ] - } - } - ] - }, - "encoding": "json" - }, - "id": 1 -} - -``` - diff --git a/content/docs/api-reference/info-api.mdx b/content/docs/api-reference/info-api.mdx deleted file mode 100644 index 2f51e77b2ec..00000000000 --- a/content/docs/api-reference/info-api.mdx +++ /dev/null @@ -1,677 +0,0 @@ ---- -title: Info API ---- - -} > -This page was generated by a plugin that directly references this [file](https://github.com/ava-labs/avalanchego/tree/master/api/info/service.md) in the AvalancheGo GitHub repository. - - -This API can be used to access basic information about the node. - -## Format - -This API uses the `json 2.0` RPC format. For more information on making JSON RPC calls, see [here](/api-reference/standards/guides/issuing-api-calls). - -## Endpoint - -``` -/ext/info -``` - -## Methods - -### `info.acps` - -Returns peer preferences for Avalanche Community Proposals (ACPs) - -**Signature**: - -``` -info.acps() -> { - acps: map[uint32]{ - supportWeight: uint64 - supporters: set[string] - objectWeight: uint64 - objectors: set[string] - abstainWeight: uint64 - } -} -``` - -**Example Call**: - -``` -curl -sX POST --data '{ - "jsonrpc":"2.0", - "id" :1, - "method" :"info.acps", - "params" :{} -}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/info -``` - -**Example Response**: - -``` -{ - "jsonrpc": "2.0", - "result": { - "acps": { - "23": { - "supportWeight": "0", - "supporters": [], - "objectWeight": "0", - "objectors": [], - "abstainWeight": "161147778098286584" - }, - "24": { - "supportWeight": "0", - "supporters": [], - "objectWeight": "0", - "objectors": [], - "abstainWeight": "161147778098286584" - }, - "25": { - "supportWeight": "0", - "supporters": [], - "objectWeight": "0", - "objectors": [], - "abstainWeight": "161147778098286584" - }, - "30": { - "supportWeight": "0", - "supporters": [], - "objectWeight": "0", - "objectors": [], - "abstainWeight": "161147778098286584" - }, - "31": { - "supportWeight": "0", - "supporters": [], - "objectWeight": "0", - "objectors": [], - "abstainWeight": "161147778098286584" - }, - "41": { - "supportWeight": "0", - "supporters": [], - "objectWeight": "0", - "objectors": [], - "abstainWeight": "161147778098286584" - }, - "62": { - "supportWeight": "0", - "supporters": [], - "objectWeight": "0", - "objectors": [], - "abstainWeight": "161147778098286584" - } - } - }, - "id": 1 -} -``` - -### `info.isBootstrapped` - -Check whether a given chain is done bootstrapping - -**Signature**: - -``` -info.isBootstrapped({chain: string}) -> {isBootstrapped: bool} -``` - -`chain` is the ID or alias of a chain. - -**Example Call**: - -``` -curl -X POST --data '{ - "jsonrpc":"2.0", - "id" :1, - "method" :"info.isBootstrapped", - "params": { - "chain":"X" - } -}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/info -``` - -**Example Response**: - -``` -{ - "jsonrpc": "2.0", - "result": { - "isBootstrapped": true - }, - "id": 1 -} -``` - -### `info.getBlockchainID` - -Given a blockchain's alias, get its ID. (See [`admin.aliasChain`](/api-reference/admin-api#adminaliaschain).) - -**Signature**: - -``` -info.getBlockchainID({alias:string}) -> {blockchainID:string} -``` - -**Example Call**: - -``` -curl -X POST --data '{ - "jsonrpc":"2.0", - "id" :1, - "method" :"info.getBlockchainID", - "params": { - "alias":"X" - } -}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/info -``` - -**Example Response**: - -``` -{ - "jsonrpc": "2.0", - "id": 1, - "result": { - "blockchainID": "sV6o671RtkGBcno1FiaDbVcFv2sG5aVXMZYzKdP4VQAWmJQnM" - } -} -``` - -### `info.getNetworkID` - -Get the ID of the network this node is participating in. - -**Signature**: - -``` -info.getNetworkID() -> {networkID:int} -``` - -**Example Call**: - -``` -curl -X POST --data '{ - "jsonrpc":"2.0", - "id" :1, - "method" :"info.getNetworkID" -}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/info -``` - -**Example Response**: - -``` -{ - "jsonrpc": "2.0", - "id": 1, - "result": { - "networkID": "2" - } -} -``` - -Network ID of 1 = Mainnet Network ID of 5 = Fuji (testnet) - -### `info.getNetworkName` - -Get the name of the network this node is participating in. - -**Signature**: - -``` -info.getNetworkName() -> {networkName:string} -``` - -**Example Call**: - -``` -curl -X POST --data '{ - "jsonrpc":"2.0", - "id" :1, - "method" :"info.getNetworkName" -}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/info -``` - -**Example Response**: - -``` -{ - "jsonrpc": "2.0", - "id": 1, - "result": { - "networkName": "local" - } -} -``` - -### `info.getNodeID` - -Get the ID, the BLS key, and the proof of possession(BLS signature) of this node. - - - -This endpoint set is for a specific node, it is unavailable on the [public server](/tooling/rpc-providers). - -**Signature**: - -``` -info.getNodeID() -> { - nodeID: string, - nodePOP: { - publicKey: string, - proofOfPossession: string - } -} -``` - -- `nodeID` Node ID is the unique identifier of the node that you set to act as a validator on the Primary Network. -- `nodePOP` is this node's BLS key and proof of possession. Nodes must register a BLS key to act as a validator on the Primary Network. Your node's POP is logged on startup and is accessible over this endpoint. - - `publicKey` is the 48 byte hex representation of the BLS key. - - `proofOfPossession` is the 96 byte hex representation of the BLS signature. - -**Example Call**: - -``` -curl -X POST --data '{ - "jsonrpc":"2.0", - "id" :1, - "method" :"info.getNodeID" -}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/info -``` - -**Example Response**: - -``` -{ - "jsonrpc": "2.0", - "result": { - "nodeID": "NodeID-5mb46qkSBj81k9g9e4VFjGGSbaaSLFRzD", - "nodePOP": { - "publicKey": "0x8f95423f7142d00a48e1014a3de8d28907d420dc33b3052a6dee03a3f2941a393c2351e354704ca66a3fc29870282e15", - "proofOfPossession": "0x86a3ab4c45cfe31cae34c1d06f212434ac71b1be6cfe046c80c162e057614a94a5bc9f1ded1a7029deb0ba4ca7c9b71411e293438691be79c2dbf19d1ca7c3eadb9c756246fc5de5b7b89511c7d7302ae051d9e03d7991138299b5ed6a570a98" - } - }, - "id": 1 -} -``` - -### `info.getNodeIP` - -Get the IP of this node. - - -This endpoint set is for a specific node, it is unavailable on the [public server](/tooling/rpc-providers). - - -**Signature**: - -``` -info.getNodeIP() -> {ip: string} -``` - -**Example Call**: - -``` -curl -X POST --data '{ - "jsonrpc":"2.0", - "id" :1, - "method" :"info.getNodeIP" -}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/info -``` - -**Example Response**: - -``` -{ - "jsonrpc": "2.0", - "result": { - "ip": "192.168.1.1:9651" - }, - "id": 1 -} -``` - -### `info.getNodeVersion` - -Get the version of this node. - -**Signature**: - -``` -info.getNodeVersion() -> { - version: string, - databaseVersion: string, - gitCommit: string, - vmVersions: map[string]string, - rpcProtocolVersion: string, -} -``` - -where: - -- `version` is this node's version -- `databaseVersion` is the version of the database this node is using -- `gitCommit` is the Git commit that this node was built from -- `vmVersions` is map where each key/value pair is the name of a VM, and the version of that VM this node runs -- `rpcProtocolVersion` is the RPCChainVM protocol version - -**Example Call**: - -``` -curl -X POST --data '{ - "jsonrpc":"2.0", - "id" :1, - "method" :"info.getNodeVersion" -}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/info -``` - -**Example Response**: - -``` -{ - "jsonrpc": "2.0", - "result": { - "version": "avalanche/1.9.1", - "databaseVersion": "v1.4.5", - "rpcProtocolVersion": "18", - "gitCommit": "79cd09ba728e1cecef40acd60702f0a2d41ea404", - "vmVersions": { - "avm": "v1.9.1", - "evm": "v0.11.1", - "platform": "v1.9.1" - } - }, - "id": 1 -} -``` - -### `info.getTxFee` - -Get the fees of the network. - -**Signature**: - -``` -info.getTxFee() -> -{ - txFee: uint64, - createAssetTxFee: uint64, - createSubnetTxFee: uint64, - transformSubnetTxFee: uint64, - createBlockchainTxFee: uint64, - addPrimaryNetworkValidatorFee: uint64, - addPrimaryNetworkDelegatorFee: uint64, - addSubnetValidatorFee: uint64, - addSubnetDelegatorFee: uint64 -} -``` - -- `txFee` is the default fee for making transactions. -- `createAssetTxFee` is the fee for creating a new asset. -- `createSubnetTxFee` is the fee for creating a new Avalanche L1. -- `transformSubnetTxFee` is the fee for converting a PoA Avalanche L1 into a PoS Avalanche L1. -- `createBlockchainTxFee` is the fee for creating a new blockchain. -- `addPrimaryNetworkValidatorFee` is the fee for adding a new primary network validator. -- `addPrimaryNetworkDelegatorFee` is the fee for adding a new primary network delegator. -- `addSubnetValidatorFee` is the fee for adding a new Avalanche L1 validator. -- `addSubnetDelegatorFee` is the fee for adding a new Avalanche L1 delegator. - -All fees are denominated in nAVAX. - -**Example Call**: - -``` -curl -X POST --data '{ - "jsonrpc":"2.0", - "id" :1, - "method" :"info.getTxFee" -}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/info -``` - -**Example Response**: - -``` -{ - "jsonrpc": "2.0", - "id": 1, - "result": { - "txFee": "1000000", - "createAssetTxFee": "10000000", - "createSubnetTxFee": "1000000000", - "transformSubnetTxFee": "10000000000", - "createBlockchainTxFee": "1000000000", - "addPrimaryNetworkValidatorFee": "0", - "addPrimaryNetworkDelegatorFee": "0", - "addSubnetValidatorFee": "1000000", - "addSubnetDelegatorFee": "1000000" - } -} -``` - -### `info.getVMs` - -Get the virtual machines installed on this node. - - -This endpoint set is for a specific node, it is unavailable on the [public server](/tooling/rpc-providers). - - -**Signature**: - -``` -info.getVMs() -> { - vms: map[string][]string -} -``` - -**Example Call**: - -``` -curl -X POST --data '{ - "jsonrpc":"2.0", - "id" :1, - "method" :"info.getVMs", - "params" :{} -}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/info -``` - -**Example Response**: - -``` -{ - "jsonrpc": "2.0", - "result": { - "vms": { - "jvYyfQTxGMJLuGWa55kdP2p2zSUYsQ5Raupu4TW34ZAUBAbtq": ["avm"], - "mgj786NP7uDwBCcq6YwThhaN8FLyybkCa4zBWTQbNgmK6k9A6": ["evm"], - "qd2U4HDWUvMrVUeTcCHp6xH3Qpnn1XbU5MDdnBoiifFqvgXwT": ["nftfx"], - "rWhpuQPF1kb72esV2momhMuTYGkEb1oL29pt2EBXWmSy4kxnT": ["platform"], - "rXJsCSEYXg2TehWxCEEGj6JU2PWKTkd6cBdNLjoe2SpsKD9cy": ["propertyfx"], - "spdxUxVJQbX85MGxMHbKw1sHxMnSqJ3QBzDyDYEP3h6TLuxqQ": ["secp256k1fx"] - } - }, - "id": 1 -} -``` - -### `info.peers` - -Get a description of peer connections. - -**Signature**: - -``` -info.peers({ - nodeIDs: string[] // optional -}) -> -{ - numPeers: int, - peers:[]{ - ip: string, - publicIP: string, - nodeID: string, - version: string, - lastSent: string, - lastReceived: string, - benched: string[], - observedUptime: int, - observedSubnetUptime: map[string]int, - } -} -``` - -- `nodeIDs` is an optional parameter to specify what NodeID's descriptions should be returned. If this parameter is left empty, descriptions for all active connections will be returned. If the node is not connected to a specified NodeID, it will be omitted from the response. -- `ip` is the remote IP of the peer. -- `publicIP` is the public IP of the peer. -- `nodeID` is the prefixed Node ID of the peer. -- `version` shows which version the peer runs on. -- `lastSent` is the timestamp of last message sent to the peer. -- `lastReceived` is the timestamp of last message received from the peer. -- `benched` shows chain IDs that the peer is being benched. -- `observedUptime` is this node's primary network uptime, observed by the peer. -- `observedSubnetUptime` is a map of Avalanche L1 IDs (SubnetIDs) to this node's Avalanche L1 uptimes, observed by the peer. - -**Example Call**: - -``` -curl -X POST --data '{ - "jsonrpc":"2.0", - "id" :1, - "method" :"info.peers", - "params": { - "nodeIDs": [] - } -}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/info -``` - -**Example Response**: - -``` -{ - "jsonrpc": "2.0", - "id": 1, - "result": { - "numPeers": 3, - "peers": [ - { - "ip": "206.189.137.87:9651", - "publicIP": "206.189.137.87:9651", - "nodeID": "NodeID-8PYXX47kqLDe2wD4oPbvRRchcnSzMA4J4", - "version": "avalanche/1.9.4", - "lastSent": "2020-06-01T15:23:02Z", - "lastReceived": "2020-06-01T15:22:57Z", - "benched": [], - "observedUptime": "99", - "observedSubnetUptimes": {}, - "trackedSubnets": [], - "benched": [] - }, - { - "ip": "158.255.67.151:9651", - "publicIP": "158.255.67.151:9651", - "nodeID": "NodeID-C14fr1n8EYNKyDfYixJ3rxSAVqTY3a8BP", - "version": "avalanche/1.9.4", - "lastSent": "2020-06-01T15:23:02Z", - "lastReceived": "2020-06-01T15:22:34Z", - "benched": [], - "observedUptime": "75", - "observedSubnetUptimes": { - "29uVeLPJB1eQJkzRemU8g8wZDw5uJRqpab5U2mX9euieVwiEbL": "100" - }, - "trackedSubnets": [ - "29uVeLPJB1eQJkzRemU8g8wZDw5uJRqpab5U2mX9euieVwiEbL" - ], - "benched": [] - }, - { - "ip": "83.42.13.44:9651", - "publicIP": "83.42.13.44:9651", - "nodeID": "NodeID-LPbcSMGJ4yocxYxvS2kBJ6umWeeFbctYZ", - "version": "avalanche/1.9.3", - "lastSent": "2020-06-01T15:23:02Z", - "lastReceived": "2020-06-01T15:22:55Z", - "benched": [], - "observedUptime": "95", - "observedSubnetUptimes": {}, - "trackedSubnets": [], - "benched": [] - } - ] - } -} -``` - -### `info.uptime` - -Returns the network's observed uptime of this node. This is the only reliable source of data for your node's uptime. Other sources may be using data gathered with incomplete (limited) information. - -**Signature**: - -``` -info.uptime({ - subnetID: string // optional -}) -> -{ - rewardingStakePercentage: float64, - weightedAveragePercentage: float64 -} -``` - -- `subnetID` is the Avalanche L1 to get the uptime of. If not provided, returns the uptime of the node on the primary network. -- `rewardingStakePercentage` is the percent of stake which thinks this node is above the uptime requirement. -- `weightedAveragePercentage` is the stake-weighted average of all observed uptimes for this node. - -**Example Call**: - -``` -curl -X POST --data '{ - "jsonrpc":"2.0", - "id" :1, - "method" :"info.uptime" -}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/info -``` - -**Example Response**: - -``` -{ - "jsonrpc": "2.0", - "id": 1, - "result": { - "rewardingStakePercentage": "100.0000", - "weightedAveragePercentage": "99.0000" - } -} -``` - -#### Example Avalanche L1 Call - -``` -curl -X POST --data '{ - "jsonrpc":"2.0", - "id" :1, - "method" :"info.uptime", - "params" :{ - "subnetID":"29uVeLPJB1eQJkzRemU8g8wZDw5uJRqpab5U2mX9euieVwiEbL" - } -}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/info -``` - -#### Example Avalanche L1 Response - -``` -{ - "jsonrpc": "2.0", - "id": 1, - "result": { - "rewardingStakePercentage": "74.0741", - "weightedAveragePercentage": "72.4074" - } -} -``` - diff --git a/content/docs/api-reference/keystore-api.mdx b/content/docs/api-reference/keystore-api.mdx deleted file mode 100644 index 580aa38b750..00000000000 --- a/content/docs/api-reference/keystore-api.mdx +++ /dev/null @@ -1,254 +0,0 @@ ---- -title: Keystore API ---- - -} > -This page was generated by a plugin that directly references this [file](https://github.com/ava-labs/avalanchego/tree/master/api/keystore/service.md) in the AvalancheGo GitHub repository. - - - -Because the node operator has access to your plain-text password, you should only create a keystore user on a node that you operate. If that node is breached, you could lose all your tokens. Keystore APIs are not recommended for use on Mainnet. - - -Every node has a built-in keystore. Clients create users on the keystore, which act as identities to be used when interacting with blockchains. A keystore exists at the node level, so if you create a user on a node it exists _only_ on that node. However, users may be imported and exported using this API. - -For validation and cross-chain transfer on the Mainnet, you should issue transactions through [AvalancheJS](/tooling/avalanche-js). That way control keys for your funds won't be stored on the node, which significantly lowers the risk should a computer running a node be compromised. See following docs for details: - -1. Transfer AVAX Tokens Between Chains: - - C-Chain: [export](https://github.com/ava-labs/avalanchejs/blob/master/examples/c-chain/export.ts) and [import](https://github.com/ava-labs/avalanchejs/blob/master/examples/c-chain/import.ts) - - P-Chain: [export](https://github.com/ava-labs/avalanchejs/blob/master/examples/p-chain/export.ts) and [import](https://github.com/ava-labs/avalanchejs/blob/master/examples/p-chain/import.ts) - - X-Chain: [export](https://github.com/ava-labs/avalanchejs/blob/master/examples/x-chain/export.ts) and [import](https://github.com/ava-labs/avalanchejs/blob/master/examples/x-chain/import.ts) -2. [Add a Node to the Validator Set](/nodes/validate/node-validator) - - -This API set is for a specific node, it is unavailable on the [public server](/tooling/rpc-providers). - - -## Format - -This API uses the `json 2.0` API format. For more information on making JSON RPC calls, see [here](/api-reference/standards/guides/issuing-api-calls). - -## Endpoint - -``` -/ext/keystore -``` - -## Methods - -### keystore.createUser - -Create a new user with the specified username and password. - -**Signature**: - -``` -keystore.createUser( - { - username:string, - password:string - } -) -> {} -``` - -- `username` and `password` can be at most 1024 characters. -- Your request will be rejected if `password` is too weak. `password` should be at least 8 characters and contain upper and lower case letters as well as numbers and symbols. - -**Example Call**: - -``` -curl -X POST --data '{ - "jsonrpc":"2.0", - "id" :1, - "method" :"keystore.createUser", - "params" :{ - "username":"myUsername", - "password":"myPassword" - } -}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/keystore -``` - -**Example Response**: - -``` -{ - "jsonrpc": "2.0", - "id": 1, - "result": {} -} -``` - -### keystore.deleteUser - - - Deprecated as of [v1.9.12](https://github.com/ava-labs/avalanchego/releases/tag/v1.9.12). - - -Delete a user. - -**Signature**: - -``` -keystore.deleteUser({username: string, password:string}) -> {} -``` - -**Example Call**: - -``` -curl -X POST --data '{ - "jsonrpc":"2.0", - "id" :1, - "method" :"keystore.deleteUser", - "params" : { - "username":"myUsername", - "password":"myPassword" - } -}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/keystore -``` - -**Example Response**: - -``` -{ - "jsonrpc": "2.0", - "id": 1, - "result": {} -} -``` - -### keystore.exportUser - - -Deprecated as of [v1.9.12](https://github.com/ava-labs/avalanchego/releases/tag/v1.9.12). - - -Export a user. The user can be imported to another node with [`keystore.importUser`](/api-reference/keystore-api#keystoreimportuser). The user's password remains encrypted. - -**Signature**: - -``` -keystore.exportUser( - { - username:string, - password:string, - encoding:string //optional - } -) -> { - user:string, - encoding:string -} -``` - -`encoding` specifies the format of the string encoding user data. Can only be `hex` when a value is provided. - -**Example Call**: - -``` -curl -X POST --data '{ - "jsonrpc":"2.0", - "id" :1, - "method" :"keystore.exportUser", - "params" :{ - "username":"myUsername", - "password":"myPassword" - } -}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/keystore -``` - -**Example Response**: - -``` -{ - "jsonrpc": "2.0", - "id": 1, - "result": { - "user": "7655a29df6fc2747b0874e1148b423b954a25fcdb1f170d0ec8eb196430f7001942ce55b02a83b1faf50a674b1e55bfc00000000", - "encoding": "hex" - } -} -``` - -### keystore.importUser - - -Deprecated as of [v1.9.12](https://github.com/ava-labs/avalanchego/releases/tag/v1.9.12). - - -Import a user. `password` must match the user's password. `username` doesn't have to match the username `user` had when it was exported. - -**Signature**: - -``` -keystore.importUser( - { - username:string, - password:string, - user:string, - encoding:string //optional - } -) -> {} -``` - -`encoding` specifies the format of the string encoding user data. Can only be `hex` when a value is provided. - -**Example Call**: - -``` -curl -X POST --data '{ - "jsonrpc":"2.0", - "id" :1, - "method" :"keystore.importUser", - "params" :{ - "username":"myUsername", - "password":"myPassword", - "user" :"0x7655a29df6fc2747b0874e1148b423b954a25fcdb1f170d0ec8eb196430f7001942ce55b02a83b1faf50a674b1e55bfc000000008cf2d869" - } -}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/keystore -``` - -**Example Response**: - -``` -{ - "jsonrpc": "2.0", - "id": 1, - "result": {} -} -``` - -### keystore.listUsers - - -Deprecated as of [v1.9.12](https://github.com/ava-labs/avalanchego/releases/tag/v1.9.12). - - -List the users in this keystore. - -**Signature**: - -``` -keystore.ListUsers() -> {users:[]string} -``` - -**Example Call**: - -``` -curl -X POST --data '{ - "jsonrpc":"2.0", - "id" :1, - "method" :"keystore.listUsers" -}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/keystore -``` - -**Example Response**: - -``` -{ - "jsonrpc": "2.0", - "id": 1, - "result": { - "users": ["myUsername"] - } -} -``` - diff --git a/content/docs/api-reference/metrics-api.mdx b/content/docs/api-reference/metrics-api.mdx deleted file mode 100644 index 64986673c62..00000000000 --- a/content/docs/api-reference/metrics-api.mdx +++ /dev/null @@ -1,36 +0,0 @@ ---- -title: Metrics API ---- - -} > -This page was generated by a plugin that directly references this [file](https://github.com/ava-labs/avalanchego/tree/master/api/metrics/service.md) in the AvalancheGo GitHub repository. - - -The API allows clients to get statistics about a node's health and performance. - - -This API set is for a specific node, it is unavailable on the [public server](/tooling/rpc-providers). - - -Endpoint[​](#endpoint "Direct link to heading") ------------------------------------------------ - -``` -/ext/metrics -``` - -Usage[​](#usage "Direct link to heading") ------------------------------------------ - -To get the node metrics: - -``` -curl -X POST 127.0.0.1:9650/ext/metrics -``` - -Format[​](#format "Direct link to heading") -------------------------------------------- - -This API produces Prometheus compatible metrics. See [here](https://github.com/prometheus/docs/blob/master/content/docs/instrumenting/exposition_formats.md) for information on Prometheus' formatting. - -[Here](/nodes/maintain/monitoring) is a tutorial that shows how to set up Prometheus and Grafana to monitor AvalancheGo node using the Metrics API. diff --git a/content/docs/api-reference/p-chain/api.mdx b/content/docs/api-reference/p-chain/api.mdx deleted file mode 100644 index 156f196e75a..00000000000 --- a/content/docs/api-reference/p-chain/api.mdx +++ /dev/null @@ -1,2036 +0,0 @@ ---- -title: API ---- - -} > -This page was generated by a plugin that directly references this [file](https://github.com/ava-labs/avalanchego/tree/master/vms/platformvm/service.md) in the AvalancheGo GitHub repository. - - -This API allows clients to interact with the -[P-Chain](/learn/primary-network#p-chain), which -maintains Avalanche's [validator](/nodes/validate/how-to-stake#validators) set and handles -blockchain creation. - -## Endpoint - -```sh -/ext/bc/P -``` - -## Format - -This API uses the `json 2.0` RPC format. - -## Methods - -### `platform.exportKey` - - - -Deprecated as of [**v1.9.12**](https://github.com/ava-labs/avalanchego/releases/tag/v1.9.12). - - - - - -Not recommended for use on Mainnet. See warning notice in [Keystore API](/api-reference/keystore-api). - - - -Get the private key that controls a given address. - -**Signature:** - -```sh -platform.exportKey({ - username: string, - password: string, - address: string -}) -> {privateKey: string} -``` - -- `username` is the user that controls `address`. -- `password` is `username`‘s password. -- `privateKey` is the string representation of the private key that controls `address`. - -**Example Call:** - -```sh -curl -X POST --data '{ - "jsonrpc":"2.0", - "id" :1, - "method" :"platform.exportKey", - "params" :{ - "username" :"myUsername", - "password": "myPassword", - "address": "P-avax18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5" - } -}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P -``` - -**Example Response:** - -```json -{ - "jsonrpc": "2.0", - "id": 1, - "result": { - "privateKey": "PrivateKey-Lf49kAJw3CbaL783vmbeAJvhscJqC7vi5yBYLxw2XfbzNS5RS" - } -} -``` - -### `platform.getBalance` - - - -Deprecated as of [**v1.9.12**](https://github.com/ava-labs/avalanchego/releases/tag/v1.9.12). - - - -Get the balance of AVAX controlled by a given address. - -**Signature:** - -```sh -platform.getBalance({ - addresses: []string -}) -> { - balances: string -> int, - unlockeds: string -> int, - lockedStakeables: string -> int, - lockedNotStakeables: string -> int, - utxoIDs: []{ - txID: string, - outputIndex: int - } -} -``` - -- `addresses` are the addresses to get the balance of. -- `balances` is a map from assetID to the total balance. -- `unlockeds` is a map from assetID to the unlocked balance. -- `lockedStakeables` is a map from assetID to the locked stakeable balance. -- `lockedNotStakeables` is a map from assetID to the locked and not stakeable balance. -- `utxoIDs` are the IDs of the UTXOs that reference `address`. - -**Example Call:** - -```sh -curl -X POST --data '{ - "jsonrpc":"2.0", - "id" : 1, - "method" :"platform.getBalance", - "params" :{ - "addresses":["P-custom18jma8ppw3nhx5r4ap8clazz0dps7rv5u9xde7p"] - } -}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P -``` - -**Example Response:** - -```json -{ - "jsonrpc": "2.0", - "result": { - "balance": "30000000000000000", - "unlocked": "20000000000000000", - "lockedStakeable": "10000000000000000", - "lockedNotStakeable": "0", - "balances": { - "BUuypiq2wyuLMvyhzFXcPyxPMCgSp7eeDohhQRqTChoBjKziC": "30000000000000000" - }, - "unlockeds": { - "BUuypiq2wyuLMvyhzFXcPyxPMCgSp7eeDohhQRqTChoBjKziC": "20000000000000000" - }, - "lockedStakeables": { - "BUuypiq2wyuLMvyhzFXcPyxPMCgSp7eeDohhQRqTChoBjKziC": "10000000000000000" - }, - "lockedNotStakeables": {}, - "utxoIDs": [ - { - "txID": "11111111111111111111111111111111LpoYY", - "outputIndex": 1 - }, - { - "txID": "11111111111111111111111111111111LpoYY", - "outputIndex": 0 - } - ] - }, - "id": 1 -} -``` - -### `platform.getBlock` - -Get a block by its ID. - -**Signature:** - -```sh -platform.getBlock({ - blockID: string - encoding: string // optional -}) -> { - block: string, - encoding: string -} -``` - -**Request:** - -- `blockID` is the block ID. It should be in cb58 format. -- `encoding` is the encoding format to use. Can be either `hex` or `json`. Defaults to `hex`. - -**Response:** - -- `block` is the block encoded to `encoding`. -- `encoding` is the `encoding`. - -#### Hex Example - -**Example Call:** - -```sh -curl -X POST --data '{ - "jsonrpc": "2.0", - "method": "platform.getBlock", - "params": { - "blockID": "d7WYmb8VeZNHsny3EJCwMm6QA37s1EHwMxw1Y71V3FqPZ5EFG", - "encoding": "hex" - }, - "id": 1 -}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P -``` - -**Example Response:** - -```json -{ - "jsonrpc": "2.0", - "result": { - "block": "0x00000000000309473dc99a0851a29174d84e522da8ccb1a56ac23f7b0ba79f80acce34cf576900000000000f4241000000010000001200000001000000000000000000000000000000000000000000000000000000000000000000000000000000011c4c57e1bcb3c567f9f03caa75563502d1a21393173c06d9d79ea247b20e24800000000021e67317cbc4be2aeb00677ad6462778a8f52274b9d605df2591b23027a87dff000000050000000338e0465f0000000100000000000000000427d4b22a2a78bcddd456742caf91b56badbff985ee19aef14573e7343fd6520000000121e67317cbc4be2aeb00677ad6462778a8f52274b9d605df2591b23027a87dff000000070000000338d1041f0000000000000000000000010000000195a4467dd8f939554ea4e6501c08294386938cbf000000010000000900000001c79711c4b48dcde205b63603efef7c61773a0eb47efb503fcebe40d21962b7c25ebd734057400a12cce9cf99aceec8462923d5d91fffe1cb908372281ed738580119286dde", - "encoding": "hex" - }, - "id": 1 -} -``` - -#### JSON Example - -**Example Call:** - -```sh -curl -X POST --data '{ - "jsonrpc": "2.0", - "method": "platform.getBlock", - "params": { - "blockID": "d7WYmb8VeZNHsny3EJCwMm6QA37s1EHwMxw1Y71V3FqPZ5EFG", - "encoding": "json" - }, - "id": 1 -}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P -``` - -**Example Response:** - -```json -{ - "jsonrpc": "2.0", - "result": { - "block": { - "parentID": "5615di9ytxujackzaXNrVuWQy5y8Yrt8chPCscMr5Ku9YxJ1S", - "height": 1000001, - "txs": [ - { - "unsignedTx": { - "inputs": { - "networkID": 1, - "blockchainID": "11111111111111111111111111111111LpoYY", - "outputs": [], - "inputs": [ - { - "txID": "DTqiagiMFdqbNQ62V2Gt1GddTVLkKUk2caGr4pyza9hTtsfta", - "outputIndex": 0, - "assetID": "FvwEAhmxKfeiG8SnEvq42hc6whRyY3EFYAvebMqDNDGCgxN5Z", - "fxID": "spdxUxVJQbX85MGxMHbKw1sHxMnSqJ3QBzDyDYEP3h6TLuxqQ", - "input": { - "amount": 13839124063, - "signatureIndices": [0] - } - } - ], - "memo": "0x" - }, - "destinationChain": "2q9e4r6Mu3U68nU1fYjgbR6JvwrRx36CohpAX5UQxse55x1Q5", - "exportedOutputs": [ - { - "assetID": "FvwEAhmxKfeiG8SnEvq42hc6whRyY3EFYAvebMqDNDGCgxN5Z", - "fxID": "spdxUxVJQbX85MGxMHbKw1sHxMnSqJ3QBzDyDYEP3h6TLuxqQ", - "output": { - "addresses": [ - "P-avax1jkjyvlwclyu42n4yuegpczpfgwrf8r9lyj0d3c" - ], - "amount": 13838124063, - "locktime": 0, - "threshold": 1 - } - } - ] - }, - "credentials": [ - { - "signatures": [ - "0xc79711c4b48dcde205b63603efef7c61773a0eb47efb503fcebe40d21962b7c25ebd734057400a12cce9cf99aceec8462923d5d91fffe1cb908372281ed7385801" - ] - } - ] - } - ] - }, - "encoding": "json" - }, - "id": 1 -} -``` - -### `platform.getBlockByHeight` - -Get a block by its height. - -**Signature:** - -```sh -platform.getBlockByHeight({ - height: int - encoding: string // optional -}) -> { - block: string, - encoding: string -} -``` - -**Request:** - -- `height` is the block height. -- `encoding` is the encoding format to use. Can be either `hex` or `json`. Defaults to `hex`. - -**Response:** - -- `block` is the block encoded to `encoding`. -- `encoding` is the `encoding`. - -#### Hex Example - -**Example Call:** - -```sh -curl -X POST --data '{ - "jsonrpc": "2.0", - "method": "platform.getBlockByHeight", - "params": { - "height": 1000001, - "encoding": "hex" - }, - "id": 1 -}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P -``` - -**Example Response:** - -```json -{ - "jsonrpc": "2.0", - "result": { - "block": "0x00000000000309473dc99a0851a29174d84e522da8ccb1a56ac23f7b0ba79f80acce34cf576900000000000f4241000000010000001200000001000000000000000000000000000000000000000000000000000000000000000000000000000000011c4c57e1bcb3c567f9f03caa75563502d1a21393173c06d9d79ea247b20e24800000000021e67317cbc4be2aeb00677ad6462778a8f52274b9d605df2591b23027a87dff000000050000000338e0465f0000000100000000000000000427d4b22a2a78bcddd456742caf91b56badbff985ee19aef14573e7343fd6520000000121e67317cbc4be2aeb00677ad6462778a8f52274b9d605df2591b23027a87dff000000070000000338d1041f0000000000000000000000010000000195a4467dd8f939554ea4e6501c08294386938cbf000000010000000900000001c79711c4b48dcde205b63603efef7c61773a0eb47efb503fcebe40d21962b7c25ebd734057400a12cce9cf99aceec8462923d5d91fffe1cb908372281ed738580119286dde", - "encoding": "hex" - }, - "id": 1 -} -``` - -#### JSON Example - -**Example Call:** - -```sh -curl -X POST --data '{ - "jsonrpc": "2.0", - "method": "platform.getBlockByHeight", - "params": { - "height": 1000001, - "encoding": "json" - }, - "id": 1 -}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P -``` - -**Example Response:** - -```json -{ - "jsonrpc": "2.0", - "result": { - "block": { - "parentID": "5615di9ytxujackzaXNrVuWQy5y8Yrt8chPCscMr5Ku9YxJ1S", - "height": 1000001, - "txs": [ - { - "unsignedTx": { - "inputs": { - "networkID": 1, - "blockchainID": "11111111111111111111111111111111LpoYY", - "outputs": [], - "inputs": [ - { - "txID": "DTqiagiMFdqbNQ62V2Gt1GddTVLkKUk2caGr4pyza9hTtsfta", - "outputIndex": 0, - "assetID": "FvwEAhmxKfeiG8SnEvq42hc6whRyY3EFYAvebMqDNDGCgxN5Z", - "fxID": "spdxUxVJQbX85MGxMHbKw1sHxMnSqJ3QBzDyDYEP3h6TLuxqQ", - "input": { - "amount": 13839124063, - "signatureIndices": [0] - } - } - ], - "memo": "0x" - }, - "destinationChain": "2q9e4r6Mu3U68nU1fYjgbR6JvwrRx36CohpAX5UQxse55x1Q5", - "exportedOutputs": [ - { - "assetID": "FvwEAhmxKfeiG8SnEvq42hc6whRyY3EFYAvebMqDNDGCgxN5Z", - "fxID": "spdxUxVJQbX85MGxMHbKw1sHxMnSqJ3QBzDyDYEP3h6TLuxqQ", - "output": { - "addresses": [ - "P-avax1jkjyvlwclyu42n4yuegpczpfgwrf8r9lyj0d3c" - ], - "amount": 13838124063, - "locktime": 0, - "threshold": 1 - } - } - ] - }, - "credentials": [ - { - "signatures": [ - "0xc79711c4b48dcde205b63603efef7c61773a0eb47efb503fcebe40d21962b7c25ebd734057400a12cce9cf99aceec8462923d5d91fffe1cb908372281ed7385801" - ] - } - ] - } - ] - }, - "encoding": "json" - }, - "id": 1 -} -``` - -### `platform.getBlockchains` - - - -Deprecated as of [**v1.9.12**](https://github.com/ava-labs/avalanchego/releases/tag/v1.9.12). - - - -Get all the blockchains that exist (excluding the P-Chain). - -**Signature:** - -```sh -platform.getBlockchains() -> -{ - blockchains: []{ - id: string, - name:string, - subnetID: string, - vmID: string - } -} -``` - -- `blockchains` is all of the blockchains that exists on the Avalanche network. -- `name` is the human-readable name of this blockchain. -- `id` is the blockchain's ID. -- `subnetID` is the ID of the Avalanche L1 that validates this blockchain. -- `vmID` is the ID of the Virtual Machine the blockchain runs. - -**Example Call:** - -```sh -curl -X POST --data '{ - "jsonrpc": "2.0", - "method": "platform.getBlockchains", - "params": {}, - "id": 1 -}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P -``` - -**Example Response:** - -```json -{ - "jsonrpc": "2.0", - "result": { - "blockchains": [ - { - "id": "2oYMBNV4eNHyqk2fjjV5nVQLDbtmNJzq5s3qs3Lo6ftnC6FByM", - "name": "X-Chain", - "subnetID": "11111111111111111111111111111111LpoYY", - "vmID": "jvYyfQTxGMJLuGWa55kdP2p2zSUYsQ5Raupu4TW34ZAUBAbtq" - }, - { - "id": "2q9e4r6Mu3U68nU1fYjgbR6JvwrRx36CohpAX5UQxse55x1Q5", - "name": "C-Chain", - "subnetID": "11111111111111111111111111111111LpoYY", - "vmID": "mgj786NP7uDwBCcq6YwThhaN8FLyybkCa4zBWTQbNgmK6k9A6" - }, - { - "id": "CqhF97NNugqYLiGaQJ2xckfmkEr8uNeGG5TQbyGcgnZ5ahQwa", - "name": "Simple DAG Payments", - "subnetID": "11111111111111111111111111111111LpoYY", - "vmID": "sqjdyTKUSrQs1YmKDTUbdUhdstSdtRTGRbUn8sqK8B6pkZkz1" - }, - { - "id": "VcqKNBJsYanhVFxGyQE5CyNVYxL3ZFD7cnKptKWeVikJKQkjv", - "name": "Simple Chain Payments", - "subnetID": "11111111111111111111111111111111LpoYY", - "vmID": "sqjchUjzDqDfBPGjfQq2tXW1UCwZTyvzAWHsNzF2cb1eVHt6w" - }, - { - "id": "2SMYrx4Dj6QqCEA3WjnUTYEFSnpqVTwyV3GPNgQqQZbBbFgoJX", - "name": "Simple Timestamp Server", - "subnetID": "11111111111111111111111111111111LpoYY", - "vmID": "tGas3T58KzdjLHhBDMnH2TvrddhqTji5iZAMZ3RXs2NLpSnhH" - }, - { - "id": "KDYHHKjM4yTJTT8H8qPs5KXzE6gQH5TZrmP1qVr1P6qECj3XN", - "name": "My new timestamp", - "subnetID": "2bRCr6B4MiEfSjidDwxDpdCyviwnfUVqB2HGwhm947w9YYqb7r", - "vmID": "tGas3T58KzdjLHhBDMnH2TvrddhqTji5iZAMZ3RXs2NLpSnhH" - }, - { - "id": "2TtHFqEAAJ6b33dromYMqfgavGPF3iCpdG3hwNMiart2aB5QHi", - "name": "My new AVM", - "subnetID": "2bRCr6B4MiEfSjidDwxDpdCyviwnfUVqB2HGwhm947w9YYqb7r", - "vmID": "jvYyfQTxGMJLuGWa55kdP2p2zSUYsQ5Raupu4TW34ZAUBAbtq" - } - ] - }, - "id": 1 -} -``` - -### `platform.getBlockchainStatus` - -Get the status of a blockchain. - -**Signature:** - -```sh -platform.getBlockchainStatus( - { - blockchainID: string - } -) -> {status: string} -``` - -`status` is one of: - -- `Validating`: The blockchain is being validated by this node. -- `Created`: The blockchain exists but isn't being validated by this node. -- `Preferred`: The blockchain was proposed to be created and is likely to be created but the - transaction isn't yet accepted. -- `Syncing`: This node is participating in this blockchain as a non-validating node. -- `Unknown`: The blockchain either wasn't proposed or the proposal to create it isn't preferred. The - proposal may be resubmitted. - -**Example Call:** - -```sh -curl -X POST --data '{ - "jsonrpc": "2.0", - "method": "platform.getBlockchainStatus", - "params":{ - "blockchainID":"2NbS4dwGaf2p1MaXb65PrkZdXRwmSX4ZzGnUu7jm3aykgThuZE" - }, - "id": 1 -}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P -``` - -**Example Response:** - -```json -{ - "jsonrpc": "2.0", - "result": { - "status": "Created" - }, - "id": 1 -} -``` - -### `platform.getCurrentSupply` - -Returns an upper bound on amount of tokens that exist that can stake the requested Avalanche L1. This is -an upper bound because it does not account for burnt tokens, including transaction fees. - -**Signature:** - -```sh -platform.getCurrentSupply({ - subnetID: string // optional -}) -> {supply: int} -``` - -- `supply` is an upper bound on the number of tokens that exist. - -**Example Call:** - -```sh -curl -X POST --data '{ - "jsonrpc": "2.0", - "method": "platform.getCurrentSupply", - "params": { - "subnetID": "11111111111111111111111111111111LpoYY" - }, - "id": 1 -}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P -``` - -**Example Response:** - -```json -{ - "jsonrpc": "2.0", - "result": { - "supply": "365865167637779183" - }, - "id": 1 -} -``` - -The response in this example indicates that AVAX's supply is at most 365.865 million. - -### `platform.getCurrentValidators` - -List the current validators of the given Avalanche L1. - -**Signature:** - -```sh -platform.getCurrentValidators({ - subnetID: string, // optional - nodeIDs: string[], // optional -}) -> { - validators: []{ - txID: string, - startTime: string, - endTime: string, - stakeAmount: string, - nodeID: string, - weight: string, - validationRewardOwner: { - locktime: string, - threshold: string, - addresses: string[] - }, - delegationRewardOwner: { - locktime: string, - threshold: string, - addresses: string[] - }, - potentialReward: string, - delegationFee: string, - uptime: string, - connected: bool, - signer: { - publicKey: string, - proofOfPosession: string - }, - delegatorCount: string, - delegatorWeight: string, - delegators: []{ - txID: string, - startTime: string, - endTime: string, - stakeAmount: string, - nodeID: string, - rewardOwner: { - locktime: string, - threshold: string, - addresses: string[] - }, - potentialReward: string, - } - } -} -``` - -- `subnetID` is the Avalanche L1 whose current validators are returned. If omitted, returns the current - validators of the Primary Network. -- `nodeIDs` is a list of the NodeIDs of current validators to request. If omitted, all current - validators are returned. If a specified NodeID is not in the set of current validators, it will - not be included in the response. -- `validators`: - - `txID` is the validator transaction. - - `startTime` is the Unix time when the validator starts validating the Avalanche L1. - - `endTime` is the Unix time when the validator stops validating the Avalanche L1. - - `stakeAmount` is the amount of tokens this validator staked. Omitted if `subnetID` is not a PoS - Avalanche L1. - - `nodeID` is the validator's node ID. - - `weight` is the validator's weight when sampling validators. Omitted if `subnetID` is a PoS - Avalanche L1. - - `validationRewardOwner` is an `OutputOwners` output which includes `locktime`, `threshold` and - array of `addresses`. Specifies the owner of the potential reward earned from staking. Omitted - if `subnetID` is not a PoS Avalanche L1. - - `delegationRewardOwner` is an `OutputOwners` output which includes `locktime`, `threshold` and - array of `addresses`. Specifies the owner of the potential reward earned from delegations. - Omitted if `subnetID` is not a PoS Avalanche L1. - - `potentialReward` is the potential reward earned from staking. Omitted if `subnetID` is not a - PoS Avalanche L1. - - `delegationFeeRate` is the percent fee this validator charges when others delegate stake to - them. Omitted if `subnetID` is not a PoS Avalanche L1. - - `uptime` is the % of time the queried node has reported the peer as online and validating the - Avalanche L1. Omitted if `subnetID` is not a PoS Avalanche L1. - - `connected` is if the node is connected and tracks the Avalanche L1. - - `signer` is the node's BLS public key and proof of possession. Omitted if the validator doesn't - have a BLS public key. - - `delegatorCount` is the number of delegators on this validator. - Omitted if `subnetID` is not a PoS Avalanche L1. - - `delegatorWeight` is total weight of delegators on this validator. - Omitted if `subnetID` is not a PoS Avalanche L1. - - `delegators` is the list of delegators to this validator. - Omitted if `subnetID` is not a PoS Avalanche L1. - Omitted unless `nodeIDs` specifies a single NodeID. - - `txID` is the delegator transaction. - - `startTime` is the Unix time when the delegator started. - - `endTime` is the Unix time when the delegator stops. - - `stakeAmount` is the amount of nAVAX this delegator staked. - - `nodeID` is the validating node's node ID. - - `rewardOwner` is an `OutputOwners` output which includes `locktime`, `threshold` and array of - `addresses`. - - `potentialReward` is the potential reward earned from staking - -**Example Call:** - -```sh -curl -X POST --data '{ - "jsonrpc": "2.0", - "method": "platform.getCurrentValidators", - "params": { - "nodeIDs": ["NodeID-5mb46qkSBj81k9g9e4VFjGGSbaaSLFRzD"] - }, - "id": 1 -}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P -``` - -**Example Response:** - -```json -{ - "jsonrpc": "2.0", - "result": { - "validators": [ - { - "txID": "2NNkpYTGfTFLSGXJcHtVv6drwVU2cczhmjK2uhvwDyxwsjzZMm", - "startTime": "1600368632", - "endTime": "1602960455", - "stakeAmount": "2000000000000", - "nodeID": "NodeID-5mb46qkSBj81k9g9e4VFjGGSbaaSLFRzD", - "validationRewardOwner": { - "locktime": "0", - "threshold": "1", - "addresses": ["P-avax18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"] - }, - "delegationRewardOwner": { - "locktime": "0", - "threshold": "1", - "addresses": ["P-avax18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"] - }, - "potentialReward": "117431493426", - "delegationFee": "10.0000", - "uptime": "0.0000", - "connected": false, - "delegatorCount": "1", - "delegatorWeight": "25000000000", - "delegators": [ - { - "txID": "Bbai8nzGVcyn2VmeYcbS74zfjJLjDacGNVuzuvAQkHn1uWfoV", - "startTime": "1600368523", - "endTime": "1602960342", - "stakeAmount": "25000000000", - "nodeID": "NodeID-5mb46qkSBj81k9g9e4VFjGGSbaaSLFRzD", - "rewardOwner": { - "locktime": "0", - "threshold": "1", - "addresses": ["P-avax18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"] - }, - "potentialReward": "11743144774" - } - ] - } - ] - }, - "id": 1 -} -``` - -### `platform.getHeight` - -Returns the height of the last accepted block. - -**Signature:** - -```sh -platform.getHeight() -> -{ - height: int, -} -``` - -**Example Call:** - -```sh -curl -X POST --data '{ - "jsonrpc": "2.0", - "method": "platform.getHeight", - "params": {}, - "id": 1 -}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P -``` - -**Example Response:** - -```json -{ - "jsonrpc": "2.0", - "result": { - "height": "56" - }, - "id": 1 -} -``` - -### `platform.getMaxStakeAmount` - - - -Deprecated as of [**v1.9.12**](https://github.com/ava-labs/avalanchego/releases/tag/v1.9.12). - - - -Returns the maximum amount of nAVAX staking to the named node during a particular time period. - -**Signature:** - -```sh -platform.getMaxStakeAmount( - { - subnetID: string, - nodeID: string, - startTime: int, - endTime: int - } -) -> -{ - amount: uint64 -} -``` - -- `subnetID` is a Buffer or cb58 string representing Avalanche L1 -- `nodeID` is a string representing ID of the node whose stake amount is required during the given - duration -- `startTime` is a big number denoting start time of the duration during which stake amount of the - node is required. -- `endTime` is a big number denoting end time of the duration during which stake amount of the node - is required. - -**Example Call:** - -```sh -curl -X POST --data '{ - "jsonrpc": "2.0", - "method": "platform.getMaxStakeAmount", - "params": { - "subnetID":"11111111111111111111111111111111LpoYY", - "nodeID":"NodeID-7Xhw2mDxuDS44j42TCB6U5579esbSt3Lg", - "startTime": 1644240334, - "endTime": 1644240634 - }, - "id": 1 -}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P -``` - -**Example Response:** - -```json -{ - "jsonrpc": "2.0", - "result": { - "amount": "2000000000000000" - }, - "id": 1 -} -``` - -### `platform.getMinStake` - -Get the minimum amount of tokens required to validate the requested Avalanche L1 and the minimum amount of -tokens that can be delegated. - -**Signature:** - -```sh -platform.getMinStake({ - subnetID: string // optional -}) -> -{ - minValidatorStake : uint64, - minDelegatorStake : uint64 -} -``` - -**Example Call:** - -```sh -curl -X POST --data '{ - "jsonrpc":"2.0", - "id" :1, - "method" :"platform.getMinStake", - "params": { - "subnetID":"11111111111111111111111111111111LpoYY" - }, -}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P -``` - -**Example Response:** - -```json -{ - "jsonrpc": "2.0", - "result": { - "minValidatorStake": "2000000000000", - "minDelegatorStake": "25000000000" - }, - "id": 1 -} -``` - -### `platform.getPendingValidators` - -List the validators in the pending validator set of the specified Avalanche L1. Each validator is not -currently validating the Avalanche L1 but will in the future. - -**Signature:** - -```sh -platform.getPendingValidators({ - subnetID: string, // optional - nodeIDs: string[], // optional -}) -> { - validators: []{ - txID: string, - startTime: string, - endTime: string, - stakeAmount: string, - nodeID: string, - delegationFee: string, - connected: bool, - signer: { - publicKey: string, - proofOfPosession: string - }, - weight: string, - }, - delegators: []{ - txID: string, - startTime: string, - endTime: string, - stakeAmount: string, - nodeID: string - } -} -``` - -- `subnetID` is the Avalanche L1 whose current validators are returned. If omitted, returns the current - validators of the Primary Network. -- `nodeIDs` is a list of the NodeIDs of pending validators to request. If omitted, all pending - validators are returned. If a specified NodeID is not in the set of pending validators, it will - not be included in the response. -- `validators`: - - `txID` is the validator transaction. - - `startTime` is the Unix time when the validator starts validating the Avalanche L1. - - `endTime` is the Unix time when the validator stops validating the Avalanche L1. - - `stakeAmount` is the amount of tokens this validator staked. Omitted if `subnetID` is not a PoS - Avalanche L1. - - `nodeID` is the validator's node ID. - - `connected` if the node is connected and tracks the Avalanche L1. - - `signer` is the node's BLS public key and proof of possession. Omitted if the validator doesn't - have a BLS public key. - - `weight` is the validator's weight when sampling validators. Omitted if `subnetID` is a PoS - Avalanche L1. -- `delegators`: - - `txID` is the delegator transaction. - - `startTime` is the Unix time when the delegator starts. - - `endTime` is the Unix time when the delegator stops. - - `stakeAmount` is the amount of tokens this delegator staked. - - `nodeID` is the validating node's node ID. - -**Example Call:** - -```sh -curl -X POST --data '{ - "jsonrpc": "2.0", - "method": "platform.getPendingValidators", - "params": {}, - "id": 1 -}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P -``` - -**Example Response:** - -```json -{ - "jsonrpc": "2.0", - "result": { - "validators": [ - { - "txID": "2NNkpYTGfTFLSGXJcHtVv6drwVU2cczhmjK2uhvwDyxwsjzZMm", - "startTime": "1600368632", - "endTime": "1602960455", - "stakeAmount": "200000000000", - "nodeID": "NodeID-5mb46qkSBj81k9g9e4VFjGGSbaaSLFRzD", - "delegationFee": "10.0000", - "connected": false - } - ], - "delegators": [ - { - "txID": "Bbai8nzGVcyn2VmeYcbS74zfjJLjDacGNVuzuvAQkHn1uWfoV", - "startTime": "1600368523", - "endTime": "1602960342", - "stakeAmount": "20000000000", - "nodeID": "NodeID-7Xhw2mDxuDS44j42TCB6U5579esbSt3Lg" - } - ] - }, - "id": 1 -} -``` - -### `platform.getRewardUTXOs` - - - -Deprecated as of [**v1.9.12**](https://github.com/ava-labs/avalanchego/releases/tag/v1.9.12). - - - -Returns the UTXOs that were rewarded after the provided transaction's staking or delegation period -ended. - -**Signature:** - -```sh -platform.getRewardUTXOs({ - txID: string, - encoding: string // optional -}) -> { - numFetched: integer, - utxos: []string, - encoding: string -} -``` - -- `txID` is the ID of the staking or delegating transaction -- `numFetched` is the number of returned UTXOs -- `utxos` is an array of encoded reward UTXOs -- `encoding` specifies the format for the returned UTXOs. Can only be `hex` when a value is - provided. - -**Example Call:** - -```sh -curl -X POST --data '{ - "jsonrpc": "2.0", - "method": "platform.getRewardUTXOs", - "params": { - "txID": "2nmH8LithVbdjaXsxVQCQfXtzN9hBbmebrsaEYnLM9T32Uy2Y5" - }, - "id": 1 -}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P -``` - -**Example Response:** - -```json -{ - "jsonrpc": "2.0", - "result": { - "numFetched": "2", - "utxos": [ - "0x0000a195046108a85e60f7a864bb567745a37f50c6af282103e47cc62f036cee404700000000345aa98e8a990f4101e2268fab4c4e1f731c8dfbcffa3a77978686e6390d624f000000070000000000000001000000000000000000000001000000018ba98dabaebcd83056799841cfbc567d8b10f216c1f01765", - "0x0000ae8b1b94444eed8de9a81b1222f00f1b4133330add23d8ac288bffa98b85271100000000345aa98e8a990f4101e2268fab4c4e1f731c8dfbcffa3a77978686e6390d624f000000070000000000000001000000000000000000000001000000018ba98dabaebcd83056799841cfbc567d8b10f216473d042a" - ], - "encoding": "hex" - }, - "id": 1 -} -``` - -### `platform.getStake` - - - -Deprecated as of [**v1.9.12**](https://github.com/ava-labs/avalanchego/releases/tag/v1.9.12). - - - -Get the amount of nAVAX staked by a set of addresses. The amount returned does not include staking -rewards. - -**Signature:** - -```sh -platform.getStake({ - addresses: []string, - validatorsOnly: true or false -}) -> -{ - stakeds: string -> int, - stakedOutputs: []string, - encoding: string -} -``` - -- `addresses` are the addresses to get information about. -- `validatorsOnly` can be either `true` or `false`. If `true`, will skip checking delegators for stake. -- `stakeds` is a map from assetID to the amount staked by addresses provided. -- `stakedOutputs` are the string representation of staked outputs. -- `encoding` specifies the format for the returned outputs. - -**Example Call:** - -```sh -curl -X POST --data '{ - "jsonrpc": "2.0", - "method": "platform.getStake", - "params": { - "addresses": [ - "P-avax1pmgmagjcljjzuz2ve339dx82khm7q8getlegte" - ], - "validatorsOnly": true - }, - "id": 1 -} -}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P -``` - -**Example Response:** - -```json -{ - "jsonrpc": "2.0", - "result": { - "staked": "6500000000000", - "stakeds": { - "FvwEAhmxKfeiG8SnEvq42hc6whRyY3EFYAvebMqDNDGCgxN5Z": "6500000000000" - }, - "stakedOutputs": [ - "0x000021e67317cbc4be2aeb00677ad6462778a8f52274b9d605df2591b23027a87dff00000007000005e96630e800000000000000000000000001000000011f1c933f38da6ba0ba46f8c1b0a7040a9a991a80dd338ed1" - ], - "encoding": "hex" - }, - "id": 1 -} -``` - -### `platform.getStakingAssetID` - -Retrieve an assetID for an Avalanche L1's staking asset. - -**Signature:** - -```sh -platform.getStakingAssetID({ - subnetID: string // optional -}) -> { - assetID: string -} -``` - -- `subnetID` is the Avalanche L1 whose assetID is requested. -- `assetID` is the assetID for an Avalanche L1's staking asset. - -**Example Call:** - -```sh -curl -X POST --data '{ - "jsonrpc": "2.0", - "method": "platform.getStakingAssetID", - "params": { - "subnetID": "11111111111111111111111111111111LpoYY" - }, - "id": 1 -}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P -``` - -**Example Response:** - -```json -{ - "jsonrpc": "2.0", - "result": { - "assetID": "2fombhL7aGPwj3KH4bfrmJwW6PVnMobf9Y2fn9GwxiAAJyFDbe" - }, - "id": 1 -} -``` - - - -The AssetID for AVAX differs depending on the network you are on. - -Mainnet: FvwEAhmxKfeiG8SnEvq42hc6whRyY3EFYAvebMqDNDGCgxN5Z - -Testnet: U8iRqJoiJm8xZHAacmvYyZVwqQx6uDNtQeP3CQ6fcgQk3JqnK - - - -### `platform.getSubnet` - -Get owners and elastic info about the Avalanche L1. - -**Signature:** - -```sh -platform.getSubnet({ - subnetID: string -}) -> -{ - isPermissioned: bool, - controlKeys: []string, - threshold: string, - locktime: string, - subnetTransformationTxID: string -} -``` - -- `subnetID` is the ID of the Avalanche L1 to get information about. If omitted, fails. -- `threshold` signatures from addresses in `controlKeys` are needed to make changes to - a permissioned avalanche-l1. If the Avalanche L1 is a PoS Avalanche L1, then `threshold` will be `0` and `controlKeys` - will be empty. -- changes can not be made into the avalanche-l1 until `locktime` is in the past. -- `subnetTransformationTxID` is the ID of the transaction that changed the Avalanche L1 into an elastic one, - for when this change was performed. - -**Example Call:** - -```sh -curl -X POST --data '{ - "jsonrpc": "2.0", - "method": "platform.getSubnet", - "params": {"subnetID":"Vz2ArUpigHt7fyE79uF3gAXvTPLJi2LGgZoMpgNPHowUZJxBb"}, - "id": 1 -}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P -``` - -**Example Response:** - -```json -{ - "jsonrpc": "2.0", - "result": { - "isPermissioned": true, - "controlKeys": ["P-fuji1ztvstx6naeg6aarfd047fzppdt8v4gsah88e0c","P-fuji193kvt4grqewv6ce2x59wnhydr88xwdgfcedyr3"], - "threshold": "1", - "locktime": "0", - "subnetTransformationTxID": "11111111111111111111111111111111LpoYY" - }, - "id": 1 -} -``` - -### `platform.getSubnets` - - - -Deprecated as of [**v1.9.12**](https://github.com/ava-labs/avalanchego/releases/tag/v1.9.12). - - - -Get info about the Avalanche L1s. - -**Signature:** - -```sh -platform.getSubnets({ - ids: []string -}) -> -{ - subnets: [] - id: string, - controlKeys: []string, - threshold: string - } -} -``` - -- `ids` are the IDs of the Avalanche L1s to get information about. If omitted, gets information about all - Avalanche L1s. -- `id` is the Avalanche L1's ID. -- `threshold` signatures from addresses in `controlKeys` are needed to add a validator to the - Avalanche L1. If the Avalanche L1 is a PoS Avalanche L1, then `threshold` will be `0` and `controlKeys` will be - empty. - -See [here](/nodes/validate/node-validator) for information on adding a validator to a -Avalanche L1. - -**Example Call:** - -```sh -curl -X POST --data '{ - "jsonrpc": "2.0", - "method": "platform.getSubnets", - "params": {"ids":["hW8Ma7dLMA7o4xmJf3AXBbo17bXzE7xnThUd3ypM4VAWo1sNJ"]}, - "id": 1 -}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P -``` - -**Example Response:** - -```json -{ - "jsonrpc": "2.0", - "result": { - "subnets": [ - { - "id": "hW8Ma7dLMA7o4xmJf3AXBbo17bXzE7xnThUd3ypM4VAWo1sNJ", - "controlKeys": [ - "KNjXsaA1sZsaKCD1cd85YXauDuxshTes2", - "Aiz4eEt5xv9t4NCnAWaQJFNz5ABqLtJkR" - ], - "threshold": "2" - } - ] - }, - "id": 1 -} -``` - -### `platform.getTimestamp` - -Get the current P-Chain timestamp. - -**Signature:** - -```sh -platform.getTimestamp() -> {time: string} -``` - -**Example Call:** - -```sh -curl -X POST --data '{ - "jsonrpc": "2.0", - "method": "platform.getTimestamp", - "params": {}, - "id": 1 -} -}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P -``` - -**Example Response:** - -```json -{ - "jsonrpc": "2.0", - "result": { - "timestamp": "2021-09-07T00:00:00-04:00" - }, - "id": 1 -} -``` - -### `platform.getTotalStake` - -Get the total amount of tokens staked on the requested Avalanche L1. - -**Signature:** - -```sh -platform.getTotalStake({ - subnetID: string -}) -> { - stake: int - weight: int -} -``` - -#### Primary Network Example - -**Example Call:** - -```sh -curl -X POST --data '{ - "jsonrpc": "2.0", - "method": "platform.getTotalStake", - "params": { - "subnetID": "11111111111111111111111111111111LpoYY" - }, - "id": 1 -} -}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P -``` - -**Example Response:** - -```json -{ - "jsonrpc": "2.0", - "result": { - "stake": "279825917679866811", - "weight": "279825917679866811" - }, - "id": 1 -} -``` - -#### Avalanche L1 Example - -**Example Call:** - -```sh -curl -X POST --data '{ - "jsonrpc": "2.0", - "method": "platform.getTotalStake", - "params": { - "subnetID": "2bRCr6B4MiEfSjidDwxDpdCyviwnfUVqB2HGwhm947w9YYqb7r", - }, - "id": 1 -} -}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/P -``` - -**Example Response:** - -```json -{ - "jsonrpc": "2.0", - "result": { - "weight": "100000" - }, - "id": 1 -} -``` - -### `platform.getTx` - -Gets a transaction by its ID. - -Optional `encoding` parameter to specify the format for the returned transaction. Can be either -`hex` or `json`. Defaults to `hex`. - -**Signature:** - -```sh -platform.getTx({ - txID: string, - encoding: string // optional -}) -> { - tx: string, - encoding: string, -} -``` - -**Example Call:** - -```sh -curl -X POST --data '{ - "jsonrpc": "2.0", - "method": "platform.getTx", - "params": { - "txID":"28KVjSw5h3XKGuNpJXWY74EdnGq4TUWvCgEtJPymgQTvudiugb", - "encoding": "json" - }, - "id": 1 -}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P -``` - -**Example Response:** - -```json -{ - "jsonrpc": "2.0", - "result": { - "tx": { - "unsignedTx": { - "networkID": 1, - "blockchainID": "11111111111111111111111111111111LpoYY", - "outputs": [], - "inputs": [ - { - "txID": "NXNJHKeaJyjjWVSq341t6LGQP5UNz796o1crpHPByv1TKp9ZP", - "outputIndex": 0, - "assetID": "FvwEAhmxKfeiG8SnEvq42hc6whRyY3EFYAvebMqDNDGCgxN5Z", - "fxID": "spdxUxVJQbX85MGxMHbKw1sHxMnSqJ3QBzDyDYEP3h6TLuxqQ", - "input": { - "amount": 20824279595, - "signatureIndices": [0] - } - }, - { - "txID": "2ahK5SzD8iqi5KBqpKfxrnWtrEoVwQCqJsMoB9kvChCaHgAQC9", - "outputIndex": 1, - "assetID": "FvwEAhmxKfeiG8SnEvq42hc6whRyY3EFYAvebMqDNDGCgxN5Z", - "fxID": "spdxUxVJQbX85MGxMHbKw1sHxMnSqJ3QBzDyDYEP3h6TLuxqQ", - "input": { - "amount": 28119890783, - "signatureIndices": [0] - } - } - ], - "memo": "0x", - "validator": { - "nodeID": "NodeID-VT3YhgFaWEzy4Ap937qMeNEDscCammzG", - "start": 1682945406, - "end": 1684155006, - "weight": 48944170378 - }, - "stake": [ - { - "assetID": "FvwEAhmxKfeiG8SnEvq42hc6whRyY3EFYAvebMqDNDGCgxN5Z", - "fxID": "spdxUxVJQbX85MGxMHbKw1sHxMnSqJ3QBzDyDYEP3h6TLuxqQ", - "output": { - "addresses": ["P-avax1tnuesf6cqwnjw7fxjyk7lhch0vhf0v95wj5jvy"], - "amount": 48944170378, - "locktime": 0, - "threshold": 1 - } - } - ], - "rewardsOwner": { - "addresses": ["P-avax19zfygxaf59stehzedhxjesads0p5jdvfeedal0"], - "locktime": 0, - "threshold": 1 - } - }, - "credentials": [ - { - "signatures": [ - "0x6954e90b98437646fde0c1d54c12190fc23ae5e319c4d95dda56b53b4a23e43825251289cdc3728f1f1e0d48eac20e5c8f097baa9b49ea8a3cb6a41bb272d16601" - ] - }, - { - "signatures": [ - "0x6954e90b98437646fde0c1d54c12190fc23ae5e319c4d95dda56b53b4a23e43825251289cdc3728f1f1e0d48eac20e5c8f097baa9b49ea8a3cb6a41bb272d16601" - ] - } - ], - "id": "28KVjSw5h3XKGuNpJXWY74EdnGq4TUWvCgEtJPymgQTvudiugb" - }, - "encoding": "json" - }, - "id": 1 -} -``` - -### `platform.getTxStatus` - -Gets a transaction's status by its ID. If the transaction was dropped, response will include a -`reason` field with more information why the transaction was dropped. - -**Signature:** - -```sh -platform.getTxStatus({ - txID: string -}) -> {status: string} -``` - -`status` is one of: - -- `Committed`: The transaction is (or will be) accepted by every node -- `Processing`: The transaction is being voted on by this node -- `Dropped`: The transaction will never be accepted by any node in the network, check `reason` field - for more information -- `Unknown`: The transaction hasn't been seen by this node - -**Example Call:** - -```sh -curl -X POST --data '{ - "jsonrpc": "2.0", - "method": "platform.getTxStatus", - "params": { - "txID":"TAG9Ns1sa723mZy1GSoGqWipK6Mvpaj7CAswVJGM6MkVJDF9Q" - }, - "id": 1 -}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P -``` - -**Example Response:** - -```json -{ - "jsonrpc": "2.0", - "result": { - "status": "Committed" - }, - "id": 1 -} -``` - -### `platform.getUTXOs` - -Gets the UTXOs that reference a given set of addresses. - -**Signature:** - -```sh -platform.getUTXOs( - { - addresses: []string, - limit: int, // optional - startIndex: { // optional - address: string, - utxo: string - }, - sourceChain: string, // optional - encoding: string, // optional - }, -) -> -{ - numFetched: int, - utxos: []string, - endIndex: { - address: string, - utxo: string - }, - encoding: string, -} -``` - -- `utxos` is a list of UTXOs such that each UTXO references at least one address in `addresses`. -- At most `limit` UTXOs are returned. If `limit` is omitted or greater than 1024, it is set to 1024. -- This method supports pagination. `endIndex` denotes the last UTXO returned. To get the next set of - UTXOs, use the value of `endIndex` as `startIndex` in the next call. -- If `startIndex` is omitted, will fetch all UTXOs up to `limit`. -- When using pagination (that is when `startIndex` is provided), UTXOs are not guaranteed to be unique - across multiple calls. That is, a UTXO may appear in the result of the first call, and then again - in the second call. -- When using pagination, consistency is not guaranteed across multiple calls. That is, the UTXO set - of the addresses may have changed between calls. -- `encoding` specifies the format for the returned UTXOs. Can only be `hex` when a value is - provided. - -#### **Example** - -Suppose we want all UTXOs that reference at least one of -`P-avax18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5` and `P-avax1d09qn852zcy03sfc9hay2llmn9hsgnw4tp3dv6`. - -```sh -curl -X POST --data '{ - "jsonrpc":"2.0", - "id" :1, - "method" :"platform.getUTXOs", - "params" :{ - "addresses":["P-avax18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5", "P-avax1d09qn852zcy03sfc9hay2llmn9hsgnw4tp3dv6"], - "limit":5, - "encoding": "hex" - } -}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P -``` - -This gives response: - -```json -{ - "jsonrpc": "2.0", - "result": { - "numFetched": "5", - "utxos": [ - "0x0000a195046108a85e60f7a864bb567745a37f50c6af282103e47cc62f036cee404700000000345aa98e8a990f4101e2268fab4c4e1f731c8dfbcffa3a77978686e6390d624f000000070000000000000001000000000000000000000001000000018ba98dabaebcd83056799841cfbc567d8b10f216c1f01765", - "0x0000ae8b1b94444eed8de9a81b1222f00f1b4133330add23d8ac288bffa98b85271100000000345aa98e8a990f4101e2268fab4c4e1f731c8dfbcffa3a77978686e6390d624f000000070000000000000001000000000000000000000001000000018ba98dabaebcd83056799841cfbc567d8b10f216473d042a", - "0x0000731ce04b1feefa9f4291d869adc30a33463f315491e164d89be7d6d2d7890cfc00000000345aa98e8a990f4101e2268fab4c4e1f731c8dfbcffa3a77978686e6390d624f000000070000000000000001000000000000000000000001000000018ba98dabaebcd83056799841cfbc567d8b10f21600dd3047", - "0x0000b462030cc4734f24c0bc224cf0d16ee452ea6b67615517caffead123ab4fbf1500000000345aa98e8a990f4101e2268fab4c4e1f731c8dfbcffa3a77978686e6390d624f000000070000000000000001000000000000000000000001000000018ba98dabaebcd83056799841cfbc567d8b10f216c71b387e", - "0x000054f6826c39bc957c0c6d44b70f961a994898999179cc32d21eb09c1908d7167b00000000345aa98e8a990f4101e2268fab4c4e1f731c8dfbcffa3a77978686e6390d624f000000070000000000000001000000000000000000000001000000018ba98dabaebcd83056799841cfbc567d8b10f2166290e79d" - ], - "endIndex": { - "address": "P-avax18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5", - "utxo": "kbUThAUfmBXUmRgTpgD6r3nLj7rJUGho6xyht5nouNNypH45j" - }, - "encoding": "hex" - }, - "id": 1 -} -``` - -Since `numFetched` is the same as `limit`, we can tell that there may be more UTXOs that were not -fetched. We call the method again, this time with `startIndex`: - -```sh -curl -X POST --data '{ - "jsonrpc":"2.0", - "id" :1, - "method" :"platform.getUTXOs", - "params" :{ - "addresses":["P-avax18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"], - "limit":5, - "startIndex": { - "address": "P-avax18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5", - "utxo": "0x62fc816bb209857923770c286192ab1f9e3f11e4a7d4ba0943111c3bbfeb9e4a5ea72fae" - }, - "encoding": "hex" - } -}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P -``` - -This gives response: - -```json -{ - "jsonrpc": "2.0", - "result": { - "numFetched": "4", - "utxos": [ - "0x000020e182dd51ee4dcd31909fddd75bb3438d9431f8e4efce86a88a684f5c7fa09300000000345aa98e8a990f4101e2268fab4c4e1f731c8dfbcffa3a77978686e6390d624f000000070000000000000001000000000000000000000001000000018ba98dabaebcd83056799841cfbc567d8b10f21662861d59", - "0x0000a71ba36c475c18eb65dc90f6e85c4fd4a462d51c5de3ac2cbddf47db4d99284e00000000345aa98e8a990f4101e2268fab4c4e1f731c8dfbcffa3a77978686e6390d624f000000070000000000000001000000000000000000000001000000018ba98dabaebcd83056799841cfbc567d8b10f21665f6f83f", - "0x0000925424f61cb13e0fbdecc66e1270de68de9667b85baa3fdc84741d048daa69fa00000000345aa98e8a990f4101e2268fab4c4e1f731c8dfbcffa3a77978686e6390d624f000000070000000000000001000000000000000000000001000000018ba98dabaebcd83056799841cfbc567d8b10f216afecf76a", - "0x000082f30327514f819da6009fad92b5dba24d27db01e29ad7541aa8e6b6b554615c00000000345aa98e8a990f4101e2268fab4c4e1f731c8dfbcffa3a77978686e6390d624f000000070000000000000001000000000000000000000001000000018ba98dabaebcd83056799841cfbc567d8b10f216779c2d59" - ], - "endIndex": { - "address": "P-avax18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5", - "utxo": "21jG2RfqyHUUgkTLe2tUp6ETGLriSDTW3th8JXFbPRNiSZ11jK" - }, - "encoding": "hex" - }, - "id": 1 -} -``` - -Since `numFetched` is less than `limit`, we know that we are done fetching UTXOs and don't need to -call this method again. - -Suppose we want to fetch the UTXOs exported from the X Chain to the P Chain in order to build an -ImportTx. Then we need to call GetUTXOs with the `sourceChain` argument in order to retrieve the -atomic UTXOs: - -```sh -curl -X POST --data '{ - "jsonrpc":"2.0", - "id" :1, - "method" :"platform.getUTXOs", - "params" :{ - "addresses":["P-avax18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"], - "sourceChain": "X", - "encoding": "hex" - } -}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P -``` - -This gives response: - -```json -{ - "jsonrpc": "2.0", - "result": { - "numFetched": "1", - "utxos": [ - "0x00001f989ffaf18a18a59bdfbf209342aa61c6a62a67e8639d02bb3c8ddab315c6fa0000000139c33a499ce4c33a3b09cdd2cfa01ae70dbf2d18b2d7d168524440e55d55008800000007000000746a528800000000000000000000000001000000013cb7d3842e8cee6a0ebd09f1fe884f6861e1b29cd704fe76" - ], - "endIndex": { - "address": "P-avax18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5", - "utxo": "S5UKgWoVpoGFyxfisebmmRf8WqC7ZwcmYwS7XaDVZqoaFcCwK" - }, - "encoding": "hex" - }, - "id": 1 -} -``` - -### `platform.getValidatorsAt` - -Get the validators and their weights of an Avalanche L1 or the Primary Network at a given P-Chain height. - -**Signature:** - -```sh -platform.getValidatorsAt( - { - height: int, - subnetID: string, // optional - } -) -``` - -- `height` is the P-Chain height to get the validator set at. -- `subnetID` is the Avalanche L1 ID (SubnetID) to get the validator set of. If not given, gets validator set of the - Primary Network. - -**Example Call:** - -```bash -curl -X POST --data '{ - "jsonrpc": "2.0", - "method": "platform.getValidatorsAt", - "params": { - "height":1 - }, - "id": 1 -}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P -``` - -**Example Response:** - -```json -{ - "jsonrpc": "2.0", - "result": { - "validators": { - "NodeID-7Xhw2mDxuDS44j42TCB6U5579esbSt3Lg": 2000000000000000, - "NodeID-GWPcbFJZFfZreETSoWjPimr846mXEKCtu": 2000000000000000, - "NodeID-MFrZFVCXPv5iCn6M9K6XduxGTYp891xXZ": 2000000000000000, - "NodeID-NFBbbJ4qCmNaCzeW7sxErhvWqvEQMnYcN": 2000000000000000, - "NodeID-P7oB2McjBGgW2NXXWVYjV8JEDFoW9xDE5": 2000000000000000 - } - }, - "id": 1 -} -``` - -### `platform.issueTx` - -Issue a transaction to the Platform Chain. - -**Signature:** - -```sh -platform.issueTx({ - tx: string, - encoding: string, // optional -}) -> {txID: string} -``` - -- `tx` is the byte representation of a transaction. -- `encoding` specifies the encoding format for the transaction bytes. Can only be `hex` when a value - is provided. -- `txID` is the transaction's ID. - -**Example Call:** - -```sh -curl -X POST --data '{ - "jsonrpc": "2.0", - "method": "platform.issueTx", - "params": { - "tx":"0x00000009de31b4d8b22991d51aa6aa1fc733f23a851a8c9400000000000186a0000000005f041280000000005f9ca900000030390000000000000001fceda8f90fcb5d30614b99d79fc4baa29307762668f16eb0259a57c2d3b78c875c86ec2045792d4df2d926c40f829196e0bb97ee697af71f5b0a966dabff749634c8b729855e937715b0e44303fd1014daedc752006011b730", - "encoding": "hex" - }, - "id": 1 -}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P -``` - -**Example Response:** - -```json -{ - "jsonrpc": "2.0", - "result": { - "txID": "G3BuH6ytQ2averrLxJJugjWZHTRubzCrUZEXoheG5JMqL5ccY" - }, - "id": 1 -} -``` - -### `platform.listAddresses` - - - -Deprecated as of [**v1.9.12**](https://github.com/ava-labs/avalanchego/releases/tag/v1.9.12). - - - - - -Not recommended for use on Mainnet. See warning notice in [Keystore API](/api-reference/keystore-api). - - - -List addresses controlled by the given user. - -**Signature:** - -```sh -platform.listAddresses({ - username: string, - password: string -}) -> {addresses: []string} -``` - -**Example Call:** - -```sh -curl -X POST --data '{ - "jsonrpc": "2.0", - "method": "platform.listAddresses", - "params": { - "username":"myUsername", - "password":"myPassword" - }, - "id": 1 -}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P -``` - -**Example Response:** - -```json -{ - "jsonrpc": "2.0", - "result": { - "addresses": ["P-avax18jma8ppw3nhx5r4ap8clazz0dps7rv5ukulre5"] - }, - "id": 1 -} -``` - -### `platform.sampleValidators` - -Sample validators from the specified Avalanche L1. - -**Signature:** - -```sh -platform.sampleValidators( - { - size: int, - subnetID: string, // optional - } -) -> -{ - validators: []string -} -``` - -- `size` is the number of validators to sample. -- `subnetID` is the Avalanche L1 to sampled from. If omitted, defaults to the Primary Network. -- Each element of `validators` is the ID of a validator. - -**Example Call:** - -```sh -curl -X POST --data '{ - "jsonrpc":"2.0", - "id" :1, - "method" :"platform.sampleValidators", - "params" :{ - "size":2 - } -}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P -``` - -**Example Response:** - -```json -{ - "jsonrpc": "2.0", - "id": 1, - "result": { - "validators": [ - "NodeID-MFrZFVCXPv5iCn6M9K6XduxGTYp891xXZ", - "NodeID-NFBbbJ4qCmNaCzeW7sxErhvWqvEQMnYcN" - ] - } -} -``` - -### `platform.validatedBy` - -Get the `SubnetID` of the Avalanche L1 that validates a given blockchain. - -**Signature:** - -```sh -platform.validatedBy( - { - blockchainID: string - } -) -> {subnetID: string} -``` - -- `blockchainID` is the blockchain's ID. -- `subnetID` is the ID of the Avalanche L1 that validates the blockchain. - -**Example Call:** - -```sh -curl -X POST --data '{ - "jsonrpc": "2.0", - "method": "platform.validatedBy", - "params": { - "blockchainID": "KDYHHKjM4yTJTT8H8qPs5KXzE6gQH5TZrmP1qVr1P6qECj3XN" - }, - "id": 1 -}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P -``` - -**Example Response:** - -```json -{ - "jsonrpc": "2.0", - "result": { - "subnetID": "2bRCr6B4MiEfSjidDwxDpdCyviwnfUVqB2HGwhm947w9YYqb7r" - }, - "id": 1 -} -``` - -### `platform.validates` - -Get the IDs of the blockchains an Avalanche L1 validates. - -**Signature:** - -```sh -platform.validates( - { - subnetID: string - } -) -> {blockchainIDs: []string} -``` - -- `subnetID` is the Avalanche L1's ID. -- Each element of `blockchainIDs` is the ID of a blockchain the Avalanche L1 validates. - -**Example Call:** - -```sh -curl -X POST --data '{ - "jsonrpc": "2.0", - "method": "platform.validates", - "params": { - "subnetID":"2bRCr6B4MiEfSjidDwxDpdCyviwnfUVqB2HGwhm947w9YYqb7r" - }, - "id": 1 -}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P -``` - -**Example Response:** - -```json -{ - "jsonrpc": "2.0", - "result": { - "blockchainIDs": [ - "KDYHHKjM4yTJTT8H8qPs5KXzE6gQH5TZrmP1qVr1P6qECj3XN", - "2TtHFqEAAJ6b33dromYMqfgavGPF3iCpdG3hwNMiart2aB5QHi" - ] - }, - "id": 1 -} -``` diff --git a/utils/remote-content.mts b/utils/remote-content.mts index c886e3b34c1..8bc141de883 100644 --- a/utils/remote-content.mts +++ b/utils/remote-content.mts @@ -133,6 +133,55 @@ async function main(): Promise { description: "Avalanche Warp Messaging provides a basic primitive for signing and verifying messages between Avalanche L1s.", contentUrl: "https://github.com/ava-labs/coreth/blob/master/precompile/contracts/warp/", }, + { + sourceUrl: "https://raw.githubusercontent.com/ava-labs/avalanchego/master/api/admin/service.md", + outputPath: "content/docs/api-reference/admin-api.mdx", + title: "Admin API", + description: "This page is an overview of the Admin API associated with AvalancheGo.", + contentUrl: "https://github.com/ava-labs/avalanchego/blob/master/api/admin/", + }, + { + sourceUrl: "https://raw.githubusercontent.com/ava-labs/avalanchego/master/api/health/service.md", + outputPath: "content/docs/api-reference/health-api.mdx", + title: "Health API", + description: "This page is an overview of the Health API associated with AvalancheGo.", + contentUrl: "https://github.com/ava-labs/avalanchego/blob/master/api/health/", + }, + { + sourceUrl: "https://raw.githubusercontent.com/ava-labs/avalanchego/master/api/info/service.md", + outputPath: "content/docs/api-reference/info-api.mdx", + title: "Info API", + description: "This page is an overview of the Info API associated with AvalancheGo.", + contentUrl: "https://github.com/ava-labs/avalanchego/blob/master/api/info/", + }, + { + sourceUrl: "https://raw.githubusercontent.com/ava-labs/avalanchego/master/api/keystore/service.md", + outputPath: "content/docs/api-reference/keystore-api.mdx", + title: "Keystore API", + description: "This page is an overview of the Keystore API associated with AvalancheGo.", + contentUrl: "https://github.com/ava-labs/avalanchego/blob/master/api/keystore/", + }, + { + sourceUrl: "https://raw.githubusercontent.com/ava-labs/avalanchego/master/api/metrics/service.md", + outputPath: "content/docs/api-reference/metrics-api.mdx", + title: "Metrics API", + description: "This page is an overview of the Metrics API associated with AvalancheGo.", + contentUrl: "https://github.com/ava-labs/avalanchego/blob/master/api/metrics/", + }, + { + sourceUrl: "https://raw.githubusercontent.com/ava-labs/avalanchego/master/indexer/service.md", + outputPath: "content/docs/api-reference/index-api.mdx", + title: "Index API", + description: "This page is an overview of the Index API associated with AvalancheGo.", + contentUrl: "https://github.com/ava-labs/avalanchego/blob/master/indexer/", + }, + { + sourceUrl: "https://raw.githubusercontent.com/ava-labs/avalanchego/master/vms/platformvm/service.md", + outputPath: "content/docs/api-reference/p-chain/api.mdx", + title: "API", + description: "This page is an overview of the P-Chain API associated with AvalancheGo.", + contentUrl: "https://github.com/ava-labs/avalanchego/blob/master/vms/platformvm/", + }, ]; for (const fileConfig of fileConfigs) {