From 0e5d762aa17364c9ef14852c9851500bbc84301a Mon Sep 17 00:00:00 2001 From: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> Date: Thu, 21 Nov 2024 15:12:08 +0530 Subject: [PATCH 01/28] update service.md for p-chain api Signed-off-by: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> --- vms/platformvm/service.md | 103 +++++++++++++++++++++++++++++++++++--- 1 file changed, 97 insertions(+), 6 deletions(-) diff --git a/vms/platformvm/service.md b/vms/platformvm/service.md index 1d803744bda6..a576f7abbd5c 100644 --- a/vms/platformvm/service.md +++ b/vms/platformvm/service.md @@ -1,12 +1,8 @@ --- -tags: [P-Chain, Platform Chain, AvalancheGo APIs] +title: API description: This page is an overview of the P-Chain API associated with AvalancheGo. -sidebar_label: API -pagination_label: P-Chain Transaction Format --- -# Platform Chain API - This API allows clients to interact with the [P-Chain](/learn/avalanche/avalanche-platform.md#p-chain), which maintains Avalanche’s [validator](/nodes/validate/how-to-stake#validators) set and handles @@ -446,7 +442,7 @@ platform.getBlockchains() -> { blockchains: []{ id: string, - name:string, + name: string, subnetID: string, vmID: string } @@ -780,6 +776,101 @@ curl -X POST --data '{ } ``` +### `platform.getFeeConfig` + +Returns the dynamic fees configuration of the P-chain. + +**Signature:** + +```sh +platform.getFeeConfig() -> { + weights: []uint64, + maxCapacity: uint64, + maxPerSecond: uint64, + targetPerSecond: uint64, + minPrice: uint64, + excessConversionConstant: uint64 +} +``` + +- `weights` to merge fee dimensions into a single gas value +- `maxCapacity` is the amount of gas the chain is allowed to store for future use +- `maxPerSecond` is the amount of gas the chain is allowed to consume per second +- `targetPerSecond` is the target amount of gas the chain should consume per second to keep fees stable +- `minPrice` is the minimum price per unit of gas +- `excessConversionConstant` is used to convert excess gas to a gas price + +**Example Call:** + +```sh +curl -X POST --data '{ + "jsonrpc": "2.0", + "method": "platform.getFeeConfig", + "params": {}, + "id": 1 +}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P +``` + +**Example Response:** + +```json +{ + "jsonrpc": "2.0", + "result": { + "weights": [1,1000,1000,4], + "maxCapacity": 1000000, + "maxPerSecond": 100000, + "targetPerSecond": 50000, + "minPrice": 1, + "excessConversionConstant": 2164043 + }, + "id": 1 +} +``` + +### `platform.getFeeState` + +Returns the current fee state of the P-chain. + +**Signature:** + +```sh +platform.getFeeState() -> { + capacity: uint64, + excess: uint64, + price: uint64, + timestamp: string +} +``` + +**Example Call:** + +```sh +curl -X POST --data '{ + "jsonrpc": "2.0", + "method": "platform.getFeeConfig", + "params": {}, + "id": 1 +}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/bc/P +``` + +**Example Response:** + +```json +{ + "jsonrpc": "2.0", + "result": { + "weights": [1,1000,1000,4], + "maxCapacity": 1000000, + "maxPerSecond": 100000, + "targetPerSecond": 50000, + "minPrice": 1, + "excessConversionConstant": 2164043 + }, + "id": 1 +} +``` + ### `platform.getL1Validator` Returns a current L1 validator. From a3d0537eca0691594b752dd86753235380d76d45 Mon Sep 17 00:00:00 2001 From: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> Date: Thu, 21 Nov 2024 15:15:39 +0530 Subject: [PATCH 02/28] Update service.md for info api Signed-off-by: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> --- api/info/service.md | 279 +++++++++++++++++++++++++------------------- 1 file changed, 157 insertions(+), 122 deletions(-) diff --git a/api/info/service.md b/api/info/service.md index 9beaabdf217d..600b3778a935 100644 --- a/api/info/service.md +++ b/api/info/service.md @@ -1,22 +1,17 @@ --- -tags: [AvalancheGo APIs] +title: Info API description: This page is an overview of the Info API associated with AvalancheGo. -sidebar_label: Info API -pagination_label: Info API --- -# Info API - -This API can be used to access basic information about the node. +This API can be used to access basic information about an Avalanche node. ## Format -This API uses the `json 2.0` RPC format. For more information on making JSON RPC calls, see -[here](/reference/standards/guides/issuing-api-calls.md). +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 -```text +``` /ext/info ``` @@ -26,9 +21,9 @@ This API uses the `json 2.0` RPC format. For more information on making JSON RPC Returns peer preferences for Avalanche Community Proposals (ACPs) -**Signature:** +**Signature**: -```go +``` info.acps() -> { acps: map[uint32]{ supportWeight: uint64 @@ -40,9 +35,9 @@ info.acps() -> { } ``` -**Example Call:** +**Example Call**: -```sh +``` curl -sX POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -51,9 +46,9 @@ curl -sX POST --data '{ }' -H 'content-type:application/json;' 127.0.0.1:9650/ext/info ``` -**Example Response:** +**Example Response**: -```json +``` { "jsonrpc": "2.0", "result": { @@ -117,17 +112,17 @@ curl -sX POST --data '{ Check whether a given chain is done bootstrapping -**Signature:** +**Signature**: -```sh +``` info.isBootstrapped({chain: string}) -> {isBootstrapped: bool} ``` `chain` is the ID or alias of a chain. -**Example Call:** +**Example Call**: -```sh +``` curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -138,9 +133,9 @@ curl -X POST --data '{ }' -H 'content-type:application/json;' 127.0.0.1:9650/ext/info ``` -**Example Response:** +**Example Response**: -```json +``` { "jsonrpc": "2.0", "result": { @@ -152,17 +147,17 @@ curl -X POST --data '{ ### `info.getBlockchainID` -Given a blockchain’s alias, get its ID. (See [`admin.aliasChain`](/reference/avalanchego/admin-api.md#adminaliaschain).) +Given a blockchain's alias, get its ID. (See [`admin.aliasChain`](/api-reference/admin-api#adminaliaschain).) -**Signature:** +**Signature**: -```sh +``` info.getBlockchainID({alias:string}) -> {blockchainID:string} ``` -**Example Call:** +**Example Call**: -```sh +``` curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -173,9 +168,9 @@ curl -X POST --data '{ }' -H 'content-type:application/json;' 127.0.0.1:9650/ext/info ``` -**Example Response:** +**Example Response**: -```json +``` { "jsonrpc": "2.0", "id": 1, @@ -189,15 +184,15 @@ curl -X POST --data '{ Get the ID of the network this node is participating in. -**Signature:** +**Signature**: -```sh -info.getNetworkID() -> {networkID:int} +``` +info.getNetworkID() -> { networkID: int } ``` -**Example Call:** +**Example Call**: -```sh +``` curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -205,9 +200,9 @@ curl -X POST --data '{ }' -H 'content-type:application/json;' 127.0.0.1:9650/ext/info ``` -**Example Response:** +**Example Response**: -```json +``` { "jsonrpc": "2.0", "id": 1, @@ -217,22 +212,21 @@ curl -X POST --data '{ } ``` -Network ID of 1 = Mainnet -Network ID of 5 = Fuji (testnet) +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:** +**Signature**: -```sh -info.getNetworkName() -> {networkName:string} +``` +info.getNetworkName() -> { networkName:string } ``` -**Example Call:** +**Example Call**: -```sh +``` curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -240,9 +234,9 @@ curl -X POST --data '{ }' -H 'content-type:application/json;' 127.0.0.1:9650/ext/info ``` -**Example Response:** +**Example Response**: -```json +``` { "jsonrpc": "2.0", "id": 1, @@ -256,13 +250,13 @@ curl -X POST --data '{ Get the ID, the BLS key, and the proof of possession(BLS signature) of this node. -:::info -This endpoint set is for a specific node, it is unavailable on the [public server](/tooling/rpc-providers.md). -::: -**Signature:** + +This endpoint set is for a specific node, it is unavailable on the [public server](/tooling/rpc-providers). + +**Signature**: -```sh +``` info.getNodeID() -> { nodeID: string, nodePOP: { @@ -272,16 +266,14 @@ info.getNodeID() -> { } ``` -- `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. +- `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:** +**Example Call**: -```sh +``` curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -289,9 +281,9 @@ curl -X POST --data '{ }' -H 'content-type:application/json;' 127.0.0.1:9650/ext/info ``` -**Example Response:** +**Example Response**: -```json +``` { "jsonrpc": "2.0", "result": { @@ -309,19 +301,19 @@ curl -X POST --data '{ Get the IP of this node. -:::info -This endpoint set is for a specific node, it is unavailable on the [public server](/tooling/rpc-providers.md). -::: + +This endpoint set is for a specific node, it is unavailable on the [public server](/tooling/rpc-providers). + -**Signature:** +**Signature**: -```text +``` info.getNodeIP() -> {ip: string} ``` -**Example Call:** +**Example Call**: -```sh +``` curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -329,9 +321,9 @@ curl -X POST --data '{ }' -H 'content-type:application/json;' 127.0.0.1:9650/ext/info ``` -**Example Response:** +**Example Response**: -```json +``` { "jsonrpc": "2.0", "result": { @@ -345,9 +337,9 @@ curl -X POST --data '{ Get the version of this node. -**Signature:** +**Signature**: -```sh +``` info.getNodeVersion() -> { version: string, databaseVersion: string, @@ -362,13 +354,12 @@ 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 +- `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:** +**Example Call**: -```sh +``` curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -376,9 +367,9 @@ curl -X POST --data '{ }' -H 'content-type:application/json;' 127.0.0.1:9650/ext/info ``` -**Example Response:** +**Example Response**: -```json +``` { "jsonrpc": "2.0", "result": { @@ -400,9 +391,9 @@ curl -X POST --data '{ Get the fees of the network. -**Signature:** +**Signature**: -```sh +``` info.getTxFee() -> { txFee: uint64, @@ -419,19 +410,19 @@ info.getTxFee() -> - `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 Subnet. -- `transformSubnetTxFee` is the fee for converting a PoA Subnet into a PoS Subnet. +- `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 Subnet validator. -- `addSubnetDelegatorFee` is the fee for adding a new Subnet 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:** +**Example Call**: -```sh +``` curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -439,9 +430,9 @@ curl -X POST --data '{ }' -H 'content-type:application/json;' 127.0.0.1:9650/ext/info ``` -**Example Response:** +**Example Response**: -```json +``` { "jsonrpc": "2.0", "id": 1, @@ -463,21 +454,21 @@ curl -X POST --data '{ Get the virtual machines installed on this node. -:::info -This endpoint set is for a specific node, it is unavailable on the [public server](/tooling/rpc-providers.md). -::: + +This endpoint set is for a specific node, it is unavailable on the [public server](/tooling/rpc-providers). + -**Signature:** +**Signature**: -```sh +``` info.getVMs() -> { vms: map[string][]string } ``` -**Example Call:** +**Example Call**: -```bash +``` curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -486,9 +477,9 @@ curl -X POST --data '{ }' -H 'content-type:application/json;' 127.0.0.1:9650/ext/info ``` -**Example Response:** +**Example Response**: -```json +``` { "jsonrpc": "2.0", "result": { @@ -509,9 +500,9 @@ curl -X POST --data '{ Get a description of peer connections. -**Signature:** +**Signature**: -```sh +``` info.peers({ nodeIDs: string[] // optional }) -> @@ -526,25 +517,25 @@ info.peers({ 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. +- `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 currently benched on. +- `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:** +**Example Call**: -```sh +``` curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -555,9 +546,9 @@ curl -X POST --data '{ }' -H 'content-type:application/json;' 127.0.0.1:9650/ext/info ``` -**Example Response:** +**Example Response**: -```json +``` { "jsonrpc": "2.0", "id": 1, @@ -573,6 +564,7 @@ curl -X POST --data '{ "lastReceived": "2020-06-01T15:22:57Z", "benched": [], "observedUptime": "99", + "observedSubnetUptimes": {}, "trackedSubnets": [], "benched": [] }, @@ -585,6 +577,9 @@ curl -X POST --data '{ "lastReceived": "2020-06-01T15:22:34Z", "benched": [], "observedUptime": "75", + "observedSubnetUptimes": { + "29uVeLPJB1eQJkzRemU8g8wZDw5uJRqpab5U2mX9euieVwiEbL": "100" + }, "trackedSubnets": [ "29uVeLPJB1eQJkzRemU8g8wZDw5uJRqpab5U2mX9euieVwiEbL" ], @@ -599,6 +594,7 @@ curl -X POST --data '{ "lastReceived": "2020-06-01T15:22:55Z", "benched": [], "observedUptime": "95", + "observedSubnetUptimes": {}, "trackedSubnets": [], "benched": [] } @@ -609,27 +605,27 @@ curl -X POST --data '{ ### `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. +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:** +**Signature**: -```sh -info.uptime() -> +``` +info.uptime({ + subnetID: string // optional +}) -> { rewardingStakePercentage: float64, weightedAveragePercentage: float64 } ``` -- `rewardingStakePercentage` is the percent of stake which thinks this node is above the uptime - requirement. +- `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**: -**Example Call:** - -```sh +``` curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -637,9 +633,9 @@ curl -X POST --data '{ }' -H 'content-type:application/json;' 127.0.0.1:9650/ext/info ``` -**Example Response:** +**Example Response**: -```json +``` { "jsonrpc": "2.0", "id": 1, @@ -650,9 +646,9 @@ curl -X POST --data '{ } ``` -#### **Example Subnet Call** +#### Example Avalanche L1 Call -```sh +``` curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -663,9 +659,9 @@ curl -X POST --data '{ }' -H 'content-type:application/json;' 127.0.0.1:9650/ext/info ``` -#### **Example Subnet Response** +#### Example Avalanche L1 Response -```json +``` { "jsonrpc": "2.0", "id": 1, @@ -675,3 +671,42 @@ curl -X POST --data '{ } } ``` + +### `info.upgrades` + +Returns the upgrade history and configuration of the network. + +**Example Call**: + +```sh +curl -X POST --data '{ + "jsonrpc":"2.0", + "id" :1, + "method" :"info.upgrades" +}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/info +``` + +**Example Response**: + +```json +{ + "jsonrpc": "2.0", + "result": { + "apricotPhase1Time": "2020-12-05T05:00:00Z", + "apricotPhase2Time": "2020-12-05T05:00:00Z", + "apricotPhase3Time": "2020-12-05T05:00:00Z", + "apricotPhase4Time": "2020-12-05T05:00:00Z", + "apricotPhase4MinPChainHeight": 0, + "apricotPhase5Time": "2020-12-05T05:00:00Z", + "apricotPhasePre6Time": "2020-12-05T05:00:00Z", + "apricotPhase6Time": "2020-12-05T05:00:00Z", + "apricotPhasePost6Time": "2020-12-05T05:00:00Z", + "banffTime": "2020-12-05T05:00:00Z", + "cortinaTime": "2020-12-05T05:00:00Z", + "cortinaXChainStopVertexID": "11111111111111111111111111111111LpoYY", + "durangoTime": "2020-12-05T05:00:00Z", + "etnaTime": "2024-10-09T20:00:00Z" + }, + "id": 1 +} +``` From dfe2216458f328d92921b83fea81e18716805af3 Mon Sep 17 00:00:00 2001 From: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> Date: Thu, 21 Nov 2024 15:21:14 +0530 Subject: [PATCH 03/28] add recent changes Signed-off-by: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> --- api/info/service.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/api/info/service.md b/api/info/service.md index 600b3778a935..5db9cfb39584 100644 --- a/api/info/service.md +++ b/api/info/service.md @@ -529,9 +529,8 @@ info.peers({ - `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. +- `benched` shows chain IDs that the peer is currently benched on. - `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**: From 11892fb1a2ad611de9bea8a5d0f166b555044163 Mon Sep 17 00:00:00 2001 From: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> Date: Thu, 21 Nov 2024 15:23:52 +0530 Subject: [PATCH 04/28] Update service.md Signed-off-by: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> --- api/info/service.md | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/api/info/service.md b/api/info/service.md index 5db9cfb39584..f215064d16f2 100644 --- a/api/info/service.md +++ b/api/info/service.md @@ -576,9 +576,6 @@ curl -X POST --data '{ "lastReceived": "2020-06-01T15:22:34Z", "benched": [], "observedUptime": "75", - "observedSubnetUptimes": { - "29uVeLPJB1eQJkzRemU8g8wZDw5uJRqpab5U2mX9euieVwiEbL": "100" - }, "trackedSubnets": [ "29uVeLPJB1eQJkzRemU8g8wZDw5uJRqpab5U2mX9euieVwiEbL" ], @@ -593,7 +590,6 @@ curl -X POST --data '{ "lastReceived": "2020-06-01T15:22:55Z", "benched": [], "observedUptime": "95", - "observedSubnetUptimes": {}, "trackedSubnets": [], "benched": [] } @@ -608,17 +604,14 @@ Returns the network's observed uptime of this node. This is the only reliable so **Signature**: -``` -info.uptime({ - subnetID: string // optional -}) -> +```sh +info.uptime() -> { 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. From 4931258ec3c72ed1a8cba2febd305e3af7b09c09 Mon Sep 17 00:00:00 2001 From: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> Date: Thu, 21 Nov 2024 16:04:47 +0530 Subject: [PATCH 05/28] Update admin api doc Signed-off-by: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> --- api/admin/service.md | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/api/admin/service.md b/api/admin/service.md index 4a2a97c29e13..7f7e1f7bb469 100644 --- a/api/admin/service.md +++ b/api/admin/service.md @@ -1,21 +1,15 @@ --- -tags: [AvalancheGo APIs] +title: Admin API description: This page is an overview of the Admin API associated with AvalancheGo. -sidebar_label: Admin API -pagination_label: Admin API --- -# Admin API - This API can be used for measuring node health and debugging. -:::info -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/avalanchego-config-flags.md#--api-admin-enabled-boolean). - -This API set is for a specific node, it is unavailable on the [public server](/tooling/rpc-providers.md). + +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 @@ -23,7 +17,7 @@ This API uses the `json 2.0` RPC format. For details, see [here](/reference/stan ## Endpoint -```text +``` /ext/admin ``` @@ -36,7 +30,7 @@ work. This change only affects this node; other nodes will not know about this a **Signature:** -```text +``` admin.alias({endpoint:string, alias:string}) -> {} ``` @@ -75,12 +69,11 @@ Now, calls to the X-Chain can be made to either `/ext/bc/X` or, equivalently, to Give a blockchain an alias, a different name that can be used any place the blockchain’s ID is used. -:::note Aliasing a chain can also be done via the [Node API](/nodes/configure/avalanchego-config-flags.md#--chain-aliases-file-string). -Note that the alias is set for each chain on each node individually. In a multi-node Subnet, the -same alias should be configured on each node to use an alias across a Subnet successfully. Setting -an alias for a chain on one node does not register that alias with other nodes automatically. + +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:** @@ -417,7 +410,7 @@ Stop the CPU profile that was previously started. **Signature:** -```text +``` admin.stopCPUProfiler() -> {} ``` From b7ab3af7813654bcc9ed30d581c9401154e4fba3 Mon Sep 17 00:00:00 2001 From: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> Date: Thu, 21 Nov 2024 16:10:03 +0530 Subject: [PATCH 06/28] Update health api Signed-off-by: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> --- api/health/service.md | 125 +++++++++++++++++------------------------- 1 file changed, 51 insertions(+), 74 deletions(-) diff --git a/api/health/service.md b/api/health/service.md index 7f6a787f44fe..345c906f531d 100644 --- a/api/health/service.md +++ b/api/health/service.md @@ -1,64 +1,47 @@ --- -tags: [AvalancheGo APIs] +title: Health API description: This page is an overview of the Health API associated with AvalancheGo. This API can be used for measuring node health. -sidebar_label: Health API -pagination_label: Health API --- -# 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. -:::info - -This API set is for a specific node; it is unavailable on the [public server](/tooling/rpc-providers.md). - -::: + +This API set is for a specific node; it is unavailable on the [public server](/tooling/rpc-providers). + ## Health Checks 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/avalanchego-config-flags.md) flag. +The frequency at which health checks are run can be specified with the [\--health-check-frequency](/nodes/configure/configs-flags) flag. ## Filterable Health Checks -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. +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 -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. +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 -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: +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: -```sh +``` 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`. +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/Subnets. +**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: +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: -```sh +``` curl 'http://localhost:9650/ext/health?tag=29uVeLPJB1eQJkzRemU8g8wZDw5uJRqpab5U2mX9euieVwiEbL&tag=28nrH5T2BMvNrWecFcV3mfccjs6axM1TVyqe79MCv2Mhs8kxiY' ``` @@ -68,34 +51,28 @@ The returned results will include health checks for both subnetIDs as well as gl 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` 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 -### Format - -This API uses the `json 2.0` RPC format. For more information on making JSON RPC calls, see -[here](/reference/standards/guides/issuing-api-calls.md). +### Format[​] -### Endpoint +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). -```text -/ext/health -``` +### Endpoint[​] -### Methods +### Methods[​] -#### `health.health` +#### `health.health`[​] This method returns the last set of health check results. -**Example Call:** +**Example Call**: -```sh +``` curl -H 'Content-Type: application/json' --data '{ "jsonrpc":"2.0", "id" :1, @@ -106,9 +83,9 @@ curl -H 'Content-Type: application/json' --data '{ }' 'http://localhost:9650/ext/health' ``` -**Example Response:** +**Example Response**: -```json +``` { "jsonrpc": "2.0", "result": { @@ -210,24 +187,24 @@ curl -H 'Content-Type: application/json' --data '{ In this example response, every check has passed. So, the node is healthy. -**Response Explanation:** +**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. + - 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` +#### `health.readiness`[​] This method returns the last evaluation of the startup health check results. -**Example Call:** +**Example Call**: -```sh +``` curl -H 'Content-Type: application/json' --data '{ "jsonrpc":"2.0", "id" :1, @@ -238,9 +215,9 @@ curl -H 'Content-Type: application/json' --data '{ }' 'http://localhost:9650/ext/health' ``` -**Example Response:** +**Example Response**: -```json +``` { "jsonrpc": "2.0", "result": { @@ -259,24 +236,24 @@ curl -H 'Content-Type: application/json' --data '{ In this example response, every check has passed. So, the node has finished the startup process. -**Response Explanation:** +**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. + - 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` +#### `health.liveness`[​] This method returns healthy. -**Example Call:** +**Example Call**: -```sh +``` curl -H 'Content-Type: application/json' --data '{ "jsonrpc":"2.0", "id" :1, @@ -284,9 +261,9 @@ curl -H 'Content-Type: application/json' --data '{ }' 'http://localhost:9650/ext/health' ``` -**Example Response:** +**Example Response**: -```json +``` { "jsonrpc": "2.0", "result": { @@ -299,7 +276,7 @@ curl -H 'Content-Type: application/json' --data '{ In this example response, the node was able to handle the request and mark the service as healthy. -**Response Explanation:** +**Response Explanation**: - `checks` is an empty list. - `healthy` is true. From 6f02873505cbee2bf7d2e888dcae55c372102c37 Mon Sep 17 00:00:00 2001 From: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> Date: Thu, 21 Nov 2024 16:12:30 +0530 Subject: [PATCH 07/28] Update admin api file Signed-off-by: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> --- api/admin/service.md | 154 ++++++++++++++++++++----------------------- 1 file changed, 72 insertions(+), 82 deletions(-) diff --git a/api/admin/service.md b/api/admin/service.md index 7f7e1f7bb469..f1540442b8ae 100644 --- a/api/admin/service.md +++ b/api/admin/service.md @@ -13,7 +13,7 @@ This API set is for a specific node, it is unavailable on the [public server](/t ## Format -This API uses the `json 2.0` RPC format. For details, see [here](/reference/standards/guides/issuing-api-calls.md). +This API uses the `json 2.0` RPC format. For details, see [here](/api-reference/standards/guides/issuing-api-calls). ## Endpoint @@ -25,23 +25,21 @@ This API uses the `json 2.0` RPC format. For details, see [here](/reference/stan ### `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. +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:** +**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/`. +- `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:** +**Example Call**: -```bash +``` curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -53,9 +51,9 @@ curl -X POST --data '{ }' -H 'content-type:application/json;' 127.0.0.1:9650/ext/admin ``` -**Example Response:** +**Example Response**: -```json +``` { "jsonrpc": "2.0", "id": 1, @@ -67,7 +65,7 @@ Now, calls to the X-Chain can be made to either `/ext/bc/X` or, equivalently, to ### `admin.aliasChain` -Give a blockchain an alias, a different name that can be used any place the blockchain’s ID is used. +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). @@ -75,9 +73,9 @@ Aliasing a chain can also be done via the [Node API](/nodes/configure/configs-fl 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:** +**Signature**: -```text +``` admin.aliasChain( { chain:string, @@ -86,12 +84,12 @@ admin.aliasChain( ) -> {} ``` -- `chain` is the blockchain’s ID. -- `alias` can now be used in place of the blockchain’s ID (in API endpoints, for example.) +- `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:** +**Example Call**: -```bash +``` curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -103,9 +101,9 @@ curl -X POST --data '{ }' -H 'content-type:application/json;' 127.0.0.1:9650/ext/admin ``` -**Example Response:** +**Example Response**: -```json +``` { "jsonrpc": "2.0", "id": 1, @@ -113,18 +111,15 @@ curl -X POST --data '{ } ``` -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`. +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` +### admin.getChainAliases Returns the aliases of the chain -**Signature:** +**Signature**: -```text +``` admin.getChainAliases( { chain:string @@ -132,11 +127,11 @@ admin.getChainAliases( ) -> {aliases:string[]} ``` -- `chain` is the blockchain’s ID. +- `chain` is the blockchain's ID. -**Example Call:** +**Example Call**: -```bash +``` curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -147,9 +142,9 @@ curl -X POST --data '{ }' -H 'content-type:application/json;' 127.0.0.1:9650/ext/admin ``` -**Example Response:** +**Example Response**: -```json +``` { "jsonrpc": "2.0", "result": { @@ -163,13 +158,13 @@ curl -X POST --data '{ } ``` -### `admin.getLoggerLevel` +### admin.getLoggerLevel Returns log and display levels of loggers. -**Signature:** +**Signature**: -```text +``` admin.getLoggerLevel( { loggerName:string // optional @@ -184,12 +179,11 @@ admin.getLoggerLevel( } ``` -- `loggerName` is the name of the logger to be returned. This is an optional argument. If not - specified, it returns all possible loggers. +- `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:** +**Example Call**: -```bash +``` curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -200,9 +194,9 @@ curl -X POST --data '{ }' -H 'content-type:application/json;' 127.0.0.1:9650/ext/admin ``` -**Example Response:** +**Example Response**: -```json +``` { "jsonrpc": "2.0", "result": { @@ -219,13 +213,11 @@ curl -X POST --data '{ ### `admin.loadVMs` -Dynamically loads any virtual machines installed on the node as plugins. See -[here](/build/vm/intro#installing-a-vm) for more information on how to install a -virtual machine on a node. +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:** +**Signature**: -```sh +``` admin.loadVMs() -> { newVMs: map[string][]string failedVMs: map[string]string, @@ -234,9 +226,9 @@ admin.loadVMs() -> { - `failedVMs` is only included in the response if at least one virtual machine fails to be loaded. -**Example Call:** +**Example Call**: -```bash +``` curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -245,9 +237,9 @@ curl -X POST --data '{ }' -H 'content-type:application/json;' 127.0.0.1:9650/ext/admin ``` -**Example Response:** +**Example Response**: -```json +``` { "jsonrpc": "2.0", "result": { @@ -266,15 +258,15 @@ curl -X POST --data '{ Writes a profile of mutex statistics to `lock.profile`. -**Signature:** +**Signature**: -```text +``` admin.lockProfile() -> {} ``` -**Example Call:** +**Example Call**: -```bash +``` curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -283,9 +275,9 @@ curl -X POST --data '{ }' -H 'content-type:application/json;' 127.0.0.1:9650/ext/admin ``` -**Example Response:** +**Example Response**: -```json +``` { "jsonrpc": "2.0", "id": 1, @@ -297,15 +289,15 @@ curl -X POST --data '{ Writes a memory profile of the to `mem.profile`. -**Signature:** +**Signature**: -```text +``` admin.memoryProfile() -> {} ``` -**Example Call:** +**Example Call**: -```bash +``` curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -314,9 +306,9 @@ curl -X POST --data '{ }' -H 'content-type:application/json;' 127.0.0.1:9650/ext/admin ``` -**Example Response:** +**Example Response**: -```json +``` { "jsonrpc": "2.0", "id": 1, @@ -328,9 +320,9 @@ curl -X POST --data '{ Sets log and display levels of loggers. -**Signature:** +**Signature**: -```text +``` admin.setLoggerLevel( { loggerName: string, // optional @@ -340,16 +332,15 @@ admin.setLoggerLevel( ) -> {} ``` -- `loggerName` is the logger's name to be changed. This is an optional parameter. If not specified, - it changes all possible loggers. +- `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:** +**Example Call**: -```bash +``` curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -362,9 +353,9 @@ curl -X POST --data '{ }' -H 'content-type:application/json;' 127.0.0.1:9650/ext/admin ``` -**Example Response:** +**Example Response**: -```json +``` { "jsonrpc": "2.0", "id": 1, @@ -374,18 +365,17 @@ curl -X POST --data '{ ### `admin.startCPUProfiler` -Start profiling the CPU utilization of the node. To stop, call `admin.stopCPUProfiler`. On stop, -writes the profile to `cpu.profile`. +Start profiling the CPU utilization of the node. To stop, call `admin.stopCPUProfiler`. On stop, writes the profile to `cpu.profile`. -**Signature:** +**Signature**: -```text +``` admin.startCPUProfiler() -> {} ``` -**Example Call:** +**Example Call**: -```bash +``` curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -394,9 +384,9 @@ curl -X POST --data '{ }' -H 'content-type:application/json;' 127.0.0.1:9650/ext/admin ``` -**Example Response:** +**Example Response**: -```json +``` { "jsonrpc": "2.0", "id": 1, @@ -408,15 +398,15 @@ curl -X POST --data '{ Stop the CPU profile that was previously started. -**Signature:** +**Signature**: ``` admin.stopCPUProfiler() -> {} ``` -**Example Call:** +**Example Call**: -```bash +``` curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -424,9 +414,9 @@ curl -X POST --data '{ }' -H 'content-type:application/json;' 127.0.0.1:9650/ext/admin ``` -**Example Response:** +**Example Response**: -```json +``` { "jsonrpc": "2.0", "id": 1, From 34565260e451818edf987332bd46b7bc155519b3 Mon Sep 17 00:00:00 2001 From: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> Date: Thu, 21 Nov 2024 16:15:57 +0530 Subject: [PATCH 08/28] Update keystore api doc Signed-off-by: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> --- api/keystore/service.md | 168 +++++++++++++++------------------------- 1 file changed, 64 insertions(+), 104 deletions(-) diff --git a/api/keystore/service.md b/api/keystore/service.md index 76cc2ce69a56..f1e6079fda09 100644 --- a/api/keystore/service.md +++ b/api/keystore/service.md @@ -1,53 +1,33 @@ --- -tags: [AvalancheGo APIs] +title: Keystore API description: This page is an overview of the Keystore API associated with AvalancheGo. -sidebar_label: Keystore API -pagination_label: Keystore API --- -# Keystore API + +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. + -:::warning -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. -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: -For validation and cross-chain transfer on the Mainnet, you should issue transactions through -[AvalancheJS](/tooling/avalanchejs-overview). 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: - -- 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) - -- [Add a Node to the Validator Set](/nodes/validate/add-a-validator) - -:::info - -This API set is for a specific node, it is unavailable on the [public server](/tooling/rpc-providers.md). - -::: +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](/reference/standards/guides/issuing-api-calls.md). +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 -```text +``` /ext/keystore ``` @@ -55,17 +35,11 @@ This API uses the `json 2.0` API format. For more information on making JSON RPC ### keystore.createUser -:::caution - -Deprecated as of [**v1.9.12**](https://github.com/ava-labs/avalanchego/releases/tag/v1.9.12). - -::: - Create a new user with the specified username and password. -**Signature:** +**Signature**: -```sh +``` keystore.createUser( { username:string, @@ -75,12 +49,11 @@ keystore.createUser( ``` - `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. +- 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:** +**Example Call**: -```sh +``` curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -92,9 +65,9 @@ curl -X POST --data '{ }' -H 'content-type:application/json;' 127.0.0.1:9650/ext/keystore ``` -**Example Response:** +**Example Response**: -```json +``` { "jsonrpc": "2.0", "id": 1, @@ -104,23 +77,21 @@ curl -X POST --data '{ ### keystore.deleteUser -:::caution - -Deprecated as of [**v1.9.12**](https://github.com/ava-labs/avalanchego/releases/tag/v1.9.12). - -::: + + Deprecated as of [v1.9.12](https://github.com/ava-labs/avalanchego/releases/tag/v1.9.12). + Delete a user. -**Signature:** +**Signature**: -```sh +``` keystore.deleteUser({username: string, password:string}) -> {} ``` -**Example Call:** +**Example Call**: -```sh +``` curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -132,9 +103,9 @@ curl -X POST --data '{ }' -H 'content-type:application/json;' 127.0.0.1:9650/ext/keystore ``` -**Example Response:** +**Example Response**: -```json +``` { "jsonrpc": "2.0", "id": 1, @@ -144,19 +115,15 @@ curl -X POST --data '{ ### keystore.exportUser -:::caution - -Deprecated as of [**v1.9.12**](https://github.com/ava-labs/avalanchego/releases/tag/v1.9.12). + +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. -Export a user. The user can be imported to another node with -[`keystore.importUser`](/reference/avalanchego/keystore-api.md#keystoreimportuser). The user’s password -remains encrypted. +**Signature**: -**Signature:** - -```sh +``` keystore.exportUser( { username:string, @@ -169,12 +136,11 @@ keystore.exportUser( } ``` -`encoding` specifies the format of the string encoding user data. Can only be `hex` when a value is -provided. +`encoding` specifies the format of the string encoding user data. Can only be `hex` when a value is provided. -**Example Call:** +**Example Call**: -```sh +``` curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -186,9 +152,9 @@ curl -X POST --data '{ }' -H 'content-type:application/json;' 127.0.0.1:9650/ext/keystore ``` -**Example Response:** +**Example Response**: -```json +``` { "jsonrpc": "2.0", "id": 1, @@ -201,18 +167,15 @@ curl -X POST --data '{ ### keystore.importUser -:::caution - -Deprecated as of [**v1.9.12**](https://github.com/ava-labs/avalanchego/releases/tag/v1.9.12). - -::: + +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. +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:** +**Signature**: -```sh +``` keystore.importUser( { username:string, @@ -223,12 +186,11 @@ keystore.importUser( ) -> {} ``` -`encoding` specifies the format of the string encoding user data. Can only be `hex` when a value is -provided. +`encoding` specifies the format of the string encoding user data. Can only be `hex` when a value is provided. -**Example Call:** +**Example Call**: -```sh +``` curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -241,9 +203,9 @@ curl -X POST --data '{ }' -H 'content-type:application/json;' 127.0.0.1:9650/ext/keystore ``` -**Example Response:** +**Example Response**: -```json +``` { "jsonrpc": "2.0", "id": 1, @@ -253,23 +215,21 @@ curl -X POST --data '{ ### keystore.listUsers -:::caution - -Deprecated as of [**v1.9.12**](https://github.com/ava-labs/avalanchego/releases/tag/v1.9.12). - -::: + +Deprecated as of [v1.9.12](https://github.com/ava-labs/avalanchego/releases/tag/v1.9.12). + List the users in this keystore. -**Signature:** +**Signature**: -```sh +``` keystore.ListUsers() -> {users:[]string} ``` -**Example Call:** +**Example Call**: -```sh +``` curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -277,9 +237,9 @@ curl -X POST --data '{ }' -H 'content-type:application/json;' 127.0.0.1:9650/ext/keystore ``` -**Example Response:** +**Example Response**: -```json +``` { "jsonrpc": "2.0", "id": 1, From 49d23f4a3c63cc188cfbc4c48eb353874197e334 Mon Sep 17 00:00:00 2001 From: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> Date: Thu, 21 Nov 2024 16:17:54 +0530 Subject: [PATCH 09/28] Update service.md Signed-off-by: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> --- api/metrics/service.md | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/api/metrics/service.md b/api/metrics/service.md index 08b211d33dde..29376266f5c8 100644 --- a/api/metrics/service.md +++ b/api/metrics/service.md @@ -1,23 +1,17 @@ --- -tags: [AvalancheGo APIs] +title: Metrics API description: This page is an overview of the Metrics API associated with AvalancheGo. -sidebar_label: Metrics API -pagination_label: Metrics API --- -# Metrics API +The API allows clients to get statistics about a node's health and performance. -The API allows clients to get statistics about a node’s health and performance. - -:::info - -This API set is for a specific node, it is unavailable on the [public server](/tooling/rpc-providers.md). - -::: + +This API set is for a specific node, it is unavailable on the [public server](/tooling/rpc-providers). + ## Endpoint -```text +``` /ext/metrics ``` @@ -25,16 +19,12 @@ This API set is for a specific node, it is unavailable on the [public server](/t To get the node metrics: -```sh +``` curl -X POST 127.0.0.1:9650/ext/metrics ``` ## Format -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. +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/setting-up-node-monitoring) is a tutorial that -shows how to set up Prometheus and Grafana to monitor AvalancheGo node using the -Metrics API. +[Here](/nodes/maintain/monitoring) is a tutorial that shows how to set up Prometheus and Grafana to monitor AvalancheGo node using the Metrics API. From 583073a954ac99aa8da84fcb1fd8a0d3d961ab2c Mon Sep 17 00:00:00 2001 From: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> Date: Thu, 21 Nov 2024 16:19:15 +0530 Subject: [PATCH 10/28] Update service.md Signed-off-by: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> --- api/health/service.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/api/health/service.md b/api/health/service.md index 345c906f531d..a9b07c6e64ba 100644 --- a/api/health/service.md +++ b/api/health/service.md @@ -58,15 +58,15 @@ The available endpoints for GET requests are: ## JSON RPC Request -### Format[​] +### 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[​] +### Endpoint -### Methods[​] +### Methods -#### `health.health`[​] +#### `health.health` This method returns the last set of health check results. @@ -198,7 +198,7 @@ In this example response, every check has passed. So, the node is healthy. - `timeOfFirstFailure` is the time this check first failed. - `healthy` is true all the health checks are passing. -#### `health.readiness`[​] +#### `health.readiness` This method returns the last evaluation of the startup health check results. @@ -247,7 +247,7 @@ In this example response, every check has passed. So, the node has finished the - `timeOfFirstFailure` is the time this check first failed. - `healthy` is true all the health checks are passing. -#### `health.liveness`[​] +#### `health.liveness` This method returns healthy. From a8aa8ad0a2a555b21f5d6a750960b22bc4b18224 Mon Sep 17 00:00:00 2001 From: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> Date: Thu, 21 Nov 2024 16:23:33 +0530 Subject: [PATCH 11/28] Update service.md Signed-off-by: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> --- indexer/service.md | 189 ++++++++++++++++++--------------------------- 1 file changed, 76 insertions(+), 113 deletions(-) diff --git a/indexer/service.md b/indexer/service.md index 416cc4e2055b..2ea24e27311d 100644 --- a/indexer/service.md +++ b/indexer/service.md @@ -1,55 +1,31 @@ --- -tags: [AvalancheGo APIs] +title: Index API description: This page is an overview of the Index API associated with AvalancheGo. -sidebar_label: Index API -pagination_label: Index API --- -# Index API - -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/avalanchego-config-flags.md#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`. +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 -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. +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 -This API uses the `json 2.0` RPC format. For more information on making JSON RPC calls, see -[here](/reference/standards/guides/issuing-api-calls.md). +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 -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. +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 @@ -75,13 +51,9 @@ call to the X-Chain vertex index. /ext/index/X/block ``` -:::caution - -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. - -::: + +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 @@ -89,9 +61,9 @@ If you are using `V1.10.0` or higher, you need to migrate to using the `/ext/ind Get container by ID. -**Signature:** +**Signature**: -```sh +```json index.getContainerByID({ id: string, encoding: string @@ -104,12 +76,12 @@ index.getContainerByID({ } ``` -**Request:** +**Request**: - `id` is the container's ID - `encoding` is `"hex"` only. -**Response:** +**Response**: - `id` is the container's ID - `bytes` is the byte representation of the container @@ -117,9 +89,9 @@ index.getContainerByID({ - `encoding` is `"hex"` only. - `index` is how many containers were accepted in this index before this one -**Example Call:** +**Example Call**: -```sh +``` curl --location --request POST 'localhost:9650/ext/index/X/tx' \ --header 'Content-Type: application/json' \ --data-raw '{ @@ -133,7 +105,7 @@ curl --location --request POST 'localhost:9650/ext/index/X/tx' \ }' ``` -**Example Response:** +**Example Response**: ```json { @@ -153,9 +125,9 @@ curl --location --request POST 'localhost:9650/ext/index/X/tx' \ Get container by index. The first container accepted is at index 0, the second is at index 1, etc. -**Signature:** +**Signature**: -```sh +``` index.getContainerByIndex({ index: uint64, encoding: string @@ -168,12 +140,12 @@ index.getContainerByIndex({ } ``` -**Request:** +**Request**: - `index` is how many containers were accepted in this index before this one - `encoding` is `"hex"` only. -**Response:** +**Response**: - `id` is the container's ID - `bytes` is the byte representation of the container @@ -181,9 +153,9 @@ index.getContainerByIndex({ - `index` is how many containers were accepted in this index before this one - `encoding` is `"hex"` only. -**Example Call:** +**Example Call**: -```sh +``` curl --location --request POST 'localhost:9650/ext/index/X/tx' \ --header 'Content-Type: application/json' \ --data-raw '{ @@ -197,9 +169,9 @@ curl --location --request POST 'localhost:9650/ext/index/X/tx' \ }' ``` -**Example Response:** +**Example Response**: -```json +``` { "jsonrpc": "2.0", "id": 1, @@ -215,17 +187,17 @@ curl --location --request POST 'localhost:9650/ext/index/X/tx' \ ### `index.getContainerRange` -Returns the transactions at index [`startIndex`], [`startIndex+1`], ... , [`startIndex+n-1`] +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 \[`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:** +**Signature**: -```sh +``` index.getContainerRange({ startIndex: uint64, numToFetch: uint64, @@ -239,13 +211,13 @@ index.getContainerRange({ } ``` -**Request:** +**Request**: - `startIndex` is the beginning index - `numToFetch` is the number of containers to fetch - `encoding` is `"hex"` only. -**Response:** +**Response**: - `id` is the container's ID - `bytes` is the byte representation of the container @@ -253,9 +225,9 @@ index.getContainerRange({ - `encoding` is `"hex"` only. - `index` is how many containers were accepted in this index before this one -**Example Call:** +**Example Call**: -```sh +``` curl --location --request POST 'localhost:9650/ext/index/X/tx' \ --header 'Content-Type: application/json' \ --data-raw '{ @@ -270,9 +242,9 @@ curl --location --request POST 'localhost:9650/ext/index/X/tx' \ }' ``` -**Example Response:** +**Example Response**: -```json +``` { "jsonrpc": "2.0", "id": 1, @@ -292,9 +264,9 @@ curl --location --request POST 'localhost:9650/ext/index/X/tx' \ Get a container's index. -**Signature:** +**Signature**: -```sh +``` index.getIndex({ id: string, encoding: string @@ -303,18 +275,18 @@ index.getIndex({ } ``` -**Request:** +**Request**: - `id` is the ID of the container to fetch - `encoding` is `"hex"` only. -**Response:** +**Response**: - `index` is how many containers were accepted in this index before this one -**Example Call:** +**Example Call**: -```sh +``` curl --location --request POST 'localhost:9650/ext/index/X/tx' \ --header 'Content-Type: application/json' \ --data-raw '{ @@ -328,9 +300,9 @@ curl --location --request POST 'localhost:9650/ext/index/X/tx' \ }' ``` -**Example Response:** +**Example Response**: -```json +``` { "jsonrpc": "2.0", "result": { @@ -344,9 +316,9 @@ curl --location --request POST 'localhost:9650/ext/index/X/tx' \ Get the most recently accepted container. -**Signature:** +**Signature**: -```sh +``` index.getLastAccepted({ encoding:string }) -> { @@ -358,20 +330,20 @@ index.getLastAccepted({ } ``` -**Request:** +**Request**: - `encoding` is `"hex"` only. -**Response:** +**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:** +**Example Call**: -```sh +``` curl --location --request POST 'localhost:9650/ext/index/X/tx' \ --header 'Content-Type: application/json' \ --data-raw '{ @@ -384,9 +356,9 @@ curl --location --request POST 'localhost:9650/ext/index/X/tx' \ }' ``` -**Example Response:** +**Example Response**: -```json +``` { "jsonrpc": "2.0", "id": 1, @@ -404,9 +376,9 @@ curl --location --request POST 'localhost:9650/ext/index/X/tx' \ Returns true if the container is in this index. -**Signature:** +**Signature**: -```sh +``` index.isAccepted({ id: string, encoding: string @@ -415,18 +387,18 @@ index.isAccepted({ } ``` -**Request:** +**Request**: - `id` is the ID of the container to fetch - `encoding` is `"hex"` only. -**Response:** +**Response**: - `isAccepted` displays if the container has been accepted -**Example Call:** +**Example Call**: -```sh +``` curl --location --request POST 'localhost:9650/ext/index/X/tx' \ --header 'Content-Type: application/json' \ --data-raw '{ @@ -440,9 +412,9 @@ curl --location --request POST 'localhost:9650/ext/index/X/tx' \ }' ``` -**Example Response:** +**Example Response**: -```json +``` { "jsonrpc": "2.0", "result": { @@ -456,22 +428,14 @@ curl --location --request POST 'localhost:9650/ext/index/X/tx' \ Here is an example of how to iterate through all transactions on the X-Chain. -:::warning -To help users to try out this example and other index APIs, we have set up a testing -indexer node located at [https://indexer-demo.avax.network](https://indexer-demo.avax.network). This -indexer node is not for production use. We may change or shut it down at any time without notice. -::: -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. +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). +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: -```sh +``` curl --location --request POST 'https://indexer-demo.avax.network/ext/index/X/tx' \ --header 'Content-Type: application/json' \ --data-raw '{ @@ -485,12 +449,11 @@ curl --location --request POST 'https://indexer-demo.avax.network/ext/index/X/tx }' ``` -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. +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: -```json +``` { "jsonrpc": "2.0", "result": { @@ -508,7 +471,7 @@ The ID of this transaction is `ZGYTSU8w3zUP6VFseGC798vA2Vnxnfj6fz1QPfA9N93bhjJvo To get the transaction by its ID, use API method `avm.getTx`: -```sh +``` curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -522,7 +485,7 @@ curl -X POST --data '{ Response: -```json +``` { "jsonrpc": "2.0", "result": { From df3a0fbf29f7006dd6f743a58ffdc0a22e1da393 Mon Sep 17 00:00:00 2001 From: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> Date: Thu, 21 Nov 2024 16:24:19 +0530 Subject: [PATCH 12/28] Update service.md Signed-off-by: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> --- api/health/service.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/api/health/service.md b/api/health/service.md index a9b07c6e64ba..76039ecb4c81 100644 --- a/api/health/service.md +++ b/api/health/service.md @@ -3,10 +3,6 @@ title: Health API description: This page is an overview of the Health API associated with AvalancheGo. This API can be used for measuring node health. --- -} > -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. From f69545bc1c1a8831a4bd8795ba60c8fb3729d95f Mon Sep 17 00:00:00 2001 From: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> Date: Thu, 21 Nov 2024 16:25:21 +0530 Subject: [PATCH 13/28] Update service.md Signed-off-by: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> --- vms/platformvm/service.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vms/platformvm/service.md b/vms/platformvm/service.md index a576f7abbd5c..99f9582e7d53 100644 --- a/vms/platformvm/service.md +++ b/vms/platformvm/service.md @@ -1,5 +1,5 @@ --- -title: API +title: P-Chain API description: This page is an overview of the P-Chain API associated with AvalancheGo. --- From b7066dbe2b4e13058d46aad12b111097d90c30d3 Mon Sep 17 00:00:00 2001 From: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> Date: Thu, 21 Nov 2024 16:33:53 +0530 Subject: [PATCH 14/28] Update service.md Signed-off-by: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> --- api/admin/service.md | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/api/admin/service.md b/api/admin/service.md index f1540442b8ae..463c43b84839 100644 --- a/api/admin/service.md +++ b/api/admin/service.md @@ -1,9 +1,4 @@ ---- -title: Admin API -description: This page is an overview of the Admin API associated with AvalancheGo. ---- - -This API can be used for measuring node health and debugging. +The Admin 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). From cfca3085ac79b38bf8c4f59b49db86c712bb9dbe Mon Sep 17 00:00:00 2001 From: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> Date: Thu, 21 Nov 2024 16:34:16 +0530 Subject: [PATCH 15/28] Update service.md Signed-off-by: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> --- api/health/service.md | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/api/health/service.md b/api/health/service.md index 76039ecb4c81..117fa12497e8 100644 --- a/api/health/service.md +++ b/api/health/service.md @@ -1,9 +1,4 @@ ---- -title: Health API -description: This page is an overview of the Health API associated with AvalancheGo. This API can be used for measuring node health. ---- - -This API can be used for measuring node health. +The Health 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). From 5ce4c349c426253a5b8e39f4608d8af8d200cf36 Mon Sep 17 00:00:00 2001 From: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> Date: Thu, 21 Nov 2024 16:34:36 +0530 Subject: [PATCH 16/28] Update service.md Signed-off-by: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> --- api/info/service.md | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/api/info/service.md b/api/info/service.md index f215064d16f2..ad232bc7fd43 100644 --- a/api/info/service.md +++ b/api/info/service.md @@ -1,9 +1,4 @@ ---- -title: Info API -description: This page is an overview of the Info API associated with AvalancheGo. ---- - -This API can be used to access basic information about an Avalanche node. +The Info API can be used to access basic information about an Avalanche node. ## Format From 8ff3c33b7e6641c753010568d586bd71c2715d96 Mon Sep 17 00:00:00 2001 From: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> Date: Thu, 21 Nov 2024 16:35:00 +0530 Subject: [PATCH 17/28] Update service.md Signed-off-by: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> --- api/keystore/service.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/api/keystore/service.md b/api/keystore/service.md index f1e6079fda09..d8ff73f83d3a 100644 --- a/api/keystore/service.md +++ b/api/keystore/service.md @@ -1,8 +1,3 @@ ---- -title: Keystore API -description: This page is an overview of the Keystore API associated with AvalancheGo. ---- - 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. From 12e0d104f3b82bc327d076c785c6d6839e758edd Mon Sep 17 00:00:00 2001 From: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> Date: Thu, 21 Nov 2024 16:35:35 +0530 Subject: [PATCH 18/28] Update service.md Signed-off-by: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> --- api/metrics/service.md | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/api/metrics/service.md b/api/metrics/service.md index 29376266f5c8..661256110c56 100644 --- a/api/metrics/service.md +++ b/api/metrics/service.md @@ -1,9 +1,4 @@ ---- -title: Metrics API -description: This page is an overview of the Metrics API associated with AvalancheGo. ---- - -The API allows clients to get statistics about a node's health and performance. +The Metrics 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). From 39de50b5af76271ecb889a1c7a510c4c67267250 Mon Sep 17 00:00:00 2001 From: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> Date: Thu, 21 Nov 2024 16:35:54 +0530 Subject: [PATCH 19/28] Update service.md Signed-off-by: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> --- indexer/service.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/indexer/service.md b/indexer/service.md index 2ea24e27311d..711f32318a66 100644 --- a/indexer/service.md +++ b/indexer/service.md @@ -1,8 +1,3 @@ ---- -title: Index API -description: This page is an overview of the Index API associated with AvalancheGo. ---- - 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. From 1137f933b63ad9647bf2ff1872d63f7e7a4be31a Mon Sep 17 00:00:00 2001 From: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> Date: Thu, 21 Nov 2024 16:36:41 +0530 Subject: [PATCH 20/28] Update service.md Signed-off-by: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> --- vms/platformvm/service.md | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/vms/platformvm/service.md b/vms/platformvm/service.md index 99f9582e7d53..aa3cf9121604 100644 --- a/vms/platformvm/service.md +++ b/vms/platformvm/service.md @@ -1,12 +1,4 @@ ---- -title: P-Chain API -description: This page is an overview of the P-Chain API associated with AvalancheGo. ---- - -This API allows clients to interact with the -[P-Chain](/learn/avalanche/avalanche-platform.md#p-chain), which -maintains Avalanche’s [validator](/nodes/validate/how-to-stake#validators) set and handles -blockchain creation. +The P-Chain API allows clients to interact with the [P-Chain](/learn/avalanche/avalanche-platform.md#p-chain), which maintains Avalanche’s validator set and handles blockchain creation. ## Endpoint From fdbd24adbf08e937d79316dc589b2c2e41a9499b Mon Sep 17 00:00:00 2001 From: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> Date: Thu, 21 Nov 2024 16:41:35 +0530 Subject: [PATCH 21/28] Update service.md Signed-off-by: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> --- vms/platformvm/service.md | 48 +++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/vms/platformvm/service.md b/vms/platformvm/service.md index aa3cf9121604..bdb1a1a0ff3c 100644 --- a/vms/platformvm/service.md +++ b/vms/platformvm/service.md @@ -14,17 +14,17 @@ This API uses the `json 2.0` RPC format. ### `platform.exportKey` -:::caution + Deprecated as of [**v1.9.12**](https://github.com/ava-labs/avalanchego/releases/tag/v1.9.12). -::: + -:::warning + -Not recommended for use on Mainnet. See warning notice in [Keystore API](/reference/avalanchego/keystore-api.md). +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. @@ -71,11 +71,11 @@ curl -X POST --data '{ ### `platform.getBalance` -:::caution + 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. @@ -419,11 +419,11 @@ curl -X POST --data '{ ### `platform.getBlockchains` -:::caution + 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). @@ -1021,11 +1021,11 @@ curl -X POST --data '{ ### `platform.getMaxStakeAmount` -:::caution + 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. @@ -1228,11 +1228,11 @@ curl -X POST --data '{ ### `platform.getRewardUTXOs` -:::caution + 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. @@ -1288,11 +1288,11 @@ curl -X POST --data '{ ### `platform.getStake` -:::caution + 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. @@ -1395,7 +1395,7 @@ curl -X POST --data '{ } ``` -:::note + The AssetID for AVAX differs depending on the network you are on. @@ -1403,7 +1403,7 @@ Mainnet: FvwEAhmxKfeiG8SnEvq42hc6whRyY3EFYAvebMqDNDGCgxN5Z Testnet: U8iRqJoiJm8xZHAacmvYyZVwqQx6uDNtQeP3CQ6fcgQk3JqnK -::: + ### `platform.getSubnet` @@ -1469,11 +1469,11 @@ curl -X POST --data '{ ### `platform.getSubnets` -:::caution + Deprecated as of [**v1.9.12**](https://github.com/ava-labs/avalanchego/releases/tag/v1.9.12). -::: + Get info about the Subnets. @@ -2062,17 +2062,17 @@ curl -X POST --data '{ ### `platform.listAddresses` -:::caution + Deprecated as of [**v1.9.12**](https://github.com/ava-labs/avalanchego/releases/tag/v1.9.12). -::: + -:::warning + -Not recommended for use on Mainnet. See warning notice in [Keystore API](/reference/avalanchego/keystore-api.md). +Not recommended for use on Mainnet. See warning notice in [Keystore API](/api-reference/keystore-api). -::: + List addresses controlled by the given user. From 6c60adcfb757174775e8dc78056a08c2637c7ca1 Mon Sep 17 00:00:00 2001 From: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> Date: Fri, 22 Nov 2024 16:38:01 +0530 Subject: [PATCH 22/28] Update service.md Signed-off-by: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> --- api/health/service.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/api/health/service.md b/api/health/service.md index 117fa12497e8..44fce27f49c8 100644 --- a/api/health/service.md +++ b/api/health/service.md @@ -22,7 +22,7 @@ To get an HTTP status code response that indicates the node's health, make a `GE 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: -``` +```sh curl 'http://localhost:9650/ext/health?tag=29uVeLPJB1eQJkzRemU8g8wZDw5uJRqpab5U2mX9euieVwiEbL' ``` @@ -32,7 +32,7 @@ In this example returned results will contain global health checks and health ch 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: -``` +```sh curl 'http://localhost:9650/ext/health?tag=29uVeLPJB1eQJkzRemU8g8wZDw5uJRqpab5U2mX9euieVwiEbL&tag=28nrH5T2BMvNrWecFcV3mfccjs6axM1TVyqe79MCv2Mhs8kxiY' ``` @@ -63,7 +63,7 @@ This method returns the last set of health check results. **Example Call**: -``` +```sh curl -H 'Content-Type: application/json' --data '{ "jsonrpc":"2.0", "id" :1, @@ -76,7 +76,7 @@ curl -H 'Content-Type: application/json' --data '{ **Example Response**: -``` +```json { "jsonrpc": "2.0", "result": { @@ -195,7 +195,7 @@ This method returns the last evaluation of the startup health check results. **Example Call**: -``` +```sh curl -H 'Content-Type: application/json' --data '{ "jsonrpc":"2.0", "id" :1, @@ -208,7 +208,7 @@ curl -H 'Content-Type: application/json' --data '{ **Example Response**: -``` +```json { "jsonrpc": "2.0", "result": { @@ -244,7 +244,7 @@ This method returns healthy. **Example Call**: -``` +```sh curl -H 'Content-Type: application/json' --data '{ "jsonrpc":"2.0", "id" :1, @@ -254,7 +254,7 @@ curl -H 'Content-Type: application/json' --data '{ **Example Response**: -``` +```json { "jsonrpc": "2.0", "result": { From 2905ffe5843d22f9f5834fc84e1fa2256b8df8f1 Mon Sep 17 00:00:00 2001 From: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> Date: Fri, 22 Nov 2024 16:48:27 +0530 Subject: [PATCH 23/28] Update service.md Signed-off-by: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> --- api/admin/service.md | 66 ++++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/api/admin/service.md b/api/admin/service.md index 463c43b84839..924b9523d66d 100644 --- a/api/admin/service.md +++ b/api/admin/service.md @@ -12,7 +12,7 @@ This API uses the `json 2.0` RPC format. For details, see [here](/api-reference/ ## Endpoint -``` +```sh /ext/admin ``` @@ -24,7 +24,7 @@ Assign an API endpoint an alias, a different endpoint for the API. The original **Signature**: -``` +```sh admin.alias({endpoint:string, alias:string}) -> {} ``` @@ -34,7 +34,7 @@ admin.alias({endpoint:string, alias:string}) -> {} **Example Call**: -``` +```sh curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -48,7 +48,7 @@ curl -X POST --data '{ **Example Response**: -``` +```json { "jsonrpc": "2.0", "id": 1, @@ -70,7 +70,7 @@ Note that the alias is set for each chain on each node individually. In a multi- **Signature**: -``` +```sh admin.aliasChain( { chain:string, @@ -84,7 +84,7 @@ admin.aliasChain( **Example Call**: -``` +```sh curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -98,7 +98,7 @@ curl -X POST --data '{ **Example Response**: -``` +```json { "jsonrpc": "2.0", "id": 1, @@ -108,13 +108,13 @@ curl -X POST --data '{ 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 +### `admin.getChainAliases` Returns the aliases of the chain **Signature**: -``` +```sh admin.getChainAliases( { chain:string @@ -126,7 +126,7 @@ admin.getChainAliases( **Example Call**: -``` +```sh curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -139,7 +139,7 @@ curl -X POST --data '{ **Example Response**: -``` +```json { "jsonrpc": "2.0", "result": { @@ -153,13 +153,13 @@ curl -X POST --data '{ } ``` -### admin.getLoggerLevel +### `admin.getLoggerLevel` Returns log and display levels of loggers. **Signature**: -``` +```sh admin.getLoggerLevel( { loggerName:string // optional @@ -178,7 +178,7 @@ admin.getLoggerLevel( **Example Call**: -``` +```sh curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -191,7 +191,7 @@ curl -X POST --data '{ **Example Response**: -``` +```json { "jsonrpc": "2.0", "result": { @@ -212,7 +212,7 @@ Dynamically loads any virtual machines installed on the node as plugins. See [he **Signature**: -``` +```sh admin.loadVMs() -> { newVMs: map[string][]string failedVMs: map[string]string, @@ -223,7 +223,7 @@ admin.loadVMs() -> { **Example Call**: -``` +```sh curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -234,7 +234,7 @@ curl -X POST --data '{ **Example Response**: -``` +```json { "jsonrpc": "2.0", "result": { @@ -255,13 +255,13 @@ Writes a profile of mutex statistics to `lock.profile`. **Signature**: -``` +```sh admin.lockProfile() -> {} ``` **Example Call**: -``` +```sh curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -272,7 +272,7 @@ curl -X POST --data '{ **Example Response**: -``` +```json { "jsonrpc": "2.0", "id": 1, @@ -286,13 +286,13 @@ Writes a memory profile of the to `mem.profile`. **Signature**: -``` +```sh admin.memoryProfile() -> {} ``` **Example Call**: -``` +```sh curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -303,7 +303,7 @@ curl -X POST --data '{ **Example Response**: -``` +```json { "jsonrpc": "2.0", "id": 1, @@ -317,7 +317,7 @@ Sets log and display levels of loggers. **Signature**: -``` +```sh admin.setLoggerLevel( { loggerName: string, // optional @@ -335,7 +335,7 @@ admin.setLoggerLevel( **Example Call**: -``` +```sh curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -350,7 +350,7 @@ curl -X POST --data '{ **Example Response**: -``` +```json { "jsonrpc": "2.0", "id": 1, @@ -364,13 +364,13 @@ Start profiling the CPU utilization of the node. To stop, call `admin.stopCPUPro **Signature**: -``` +```sh admin.startCPUProfiler() -> {} ``` **Example Call**: -``` +```sh curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -381,7 +381,7 @@ curl -X POST --data '{ **Example Response**: -``` +```json { "jsonrpc": "2.0", "id": 1, @@ -395,13 +395,13 @@ Stop the CPU profile that was previously started. **Signature**: -``` +```sh admin.stopCPUProfiler() -> {} ``` **Example Call**: -``` +```sh curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -411,7 +411,7 @@ curl -X POST --data '{ **Example Response**: -``` +```json { "jsonrpc": "2.0", "id": 1, From 66c54ec5810a3c9aa865af3b4666e9214ed99ff8 Mon Sep 17 00:00:00 2001 From: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> Date: Fri, 22 Nov 2024 16:51:15 +0530 Subject: [PATCH 24/28] Update service.md Signed-off-by: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> --- api/info/service.md | 78 ++++++++++++++++++++++----------------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/api/info/service.md b/api/info/service.md index ad232bc7fd43..4f6f3074175a 100644 --- a/api/info/service.md +++ b/api/info/service.md @@ -6,7 +6,7 @@ This API uses the `json 2.0` RPC format. For more information on making JSON RPC ## Endpoint -``` +```sh /ext/info ``` @@ -18,7 +18,7 @@ Returns peer preferences for Avalanche Community Proposals (ACPs) **Signature**: -``` +```sh info.acps() -> { acps: map[uint32]{ supportWeight: uint64 @@ -32,7 +32,7 @@ info.acps() -> { **Example Call**: -``` +```sh curl -sX POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -43,7 +43,7 @@ curl -sX POST --data '{ **Example Response**: -``` +```json { "jsonrpc": "2.0", "result": { @@ -109,7 +109,7 @@ Check whether a given chain is done bootstrapping **Signature**: -``` +```sh info.isBootstrapped({chain: string}) -> {isBootstrapped: bool} ``` @@ -117,7 +117,7 @@ info.isBootstrapped({chain: string}) -> {isBootstrapped: bool} **Example Call**: -``` +```sh curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -130,7 +130,7 @@ curl -X POST --data '{ **Example Response**: -``` +```json { "jsonrpc": "2.0", "result": { @@ -146,13 +146,13 @@ Given a blockchain's alias, get its ID. (See [`admin.aliasChain`](/api-reference **Signature**: -``` +```sh info.getBlockchainID({alias:string}) -> {blockchainID:string} ``` **Example Call**: -``` +```sh curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -165,7 +165,7 @@ curl -X POST --data '{ **Example Response**: -``` +```json { "jsonrpc": "2.0", "id": 1, @@ -181,13 +181,13 @@ Get the ID of the network this node is participating in. **Signature**: -``` +```sh info.getNetworkID() -> { networkID: int } ``` **Example Call**: -``` +```sh curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -197,7 +197,7 @@ curl -X POST --data '{ **Example Response**: -``` +```json { "jsonrpc": "2.0", "id": 1, @@ -215,13 +215,13 @@ Get the name of the network this node is participating in. **Signature**: -``` +```sh info.getNetworkName() -> { networkName:string } ``` **Example Call**: -``` +```sh curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -231,7 +231,7 @@ curl -X POST --data '{ **Example Response**: -``` +```json { "jsonrpc": "2.0", "id": 1, @@ -245,13 +245,13 @@ curl -X POST --data '{ 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**: -``` +```sh info.getNodeID() -> { nodeID: string, nodePOP: { @@ -268,7 +268,7 @@ info.getNodeID() -> { **Example Call**: -``` +```sh curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -278,7 +278,7 @@ curl -X POST --data '{ **Example Response**: -``` +```json { "jsonrpc": "2.0", "result": { @@ -302,13 +302,13 @@ This endpoint set is for a specific node, it is unavailable on the [public serve **Signature**: -``` +```sh info.getNodeIP() -> {ip: string} ``` **Example Call**: -``` +```sh curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -318,7 +318,7 @@ curl -X POST --data '{ **Example Response**: -``` +```json { "jsonrpc": "2.0", "result": { @@ -334,7 +334,7 @@ Get the version of this node. **Signature**: -``` +```sh info.getNodeVersion() -> { version: string, databaseVersion: string, @@ -354,7 +354,7 @@ where: **Example Call**: -``` +```sh curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -364,7 +364,7 @@ curl -X POST --data '{ **Example Response**: -``` +```json { "jsonrpc": "2.0", "result": { @@ -388,7 +388,7 @@ Get the fees of the network. **Signature**: -``` +```sh info.getTxFee() -> { txFee: uint64, @@ -417,7 +417,7 @@ All fees are denominated in nAVAX. **Example Call**: -``` +```sh curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -427,7 +427,7 @@ curl -X POST --data '{ **Example Response**: -``` +```json { "jsonrpc": "2.0", "id": 1, @@ -455,7 +455,7 @@ This endpoint set is for a specific node, it is unavailable on the [public serve **Signature**: -``` +```sh info.getVMs() -> { vms: map[string][]string } @@ -463,7 +463,7 @@ info.getVMs() -> { **Example Call**: -``` +```sh curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -474,7 +474,7 @@ curl -X POST --data '{ **Example Response**: -``` +```json { "jsonrpc": "2.0", "result": { @@ -497,7 +497,7 @@ Get a description of peer connections. **Signature**: -``` +```sh info.peers({ nodeIDs: string[] // optional }) -> @@ -529,7 +529,7 @@ info.peers({ **Example Call**: -``` +```sh curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -542,7 +542,7 @@ curl -X POST --data '{ **Example Response**: -``` +```json { "jsonrpc": "2.0", "id": 1, @@ -612,7 +612,7 @@ info.uptime() -> **Example Call**: -``` +```sh curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -622,7 +622,7 @@ curl -X POST --data '{ **Example Response**: -``` +```json { "jsonrpc": "2.0", "id": 1, @@ -635,7 +635,7 @@ curl -X POST --data '{ #### Example Avalanche L1 Call -``` +```sh curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -648,7 +648,7 @@ curl -X POST --data '{ #### Example Avalanche L1 Response -``` +```json { "jsonrpc": "2.0", "id": 1, From fe0be79a60af6629f5b78e65a60c4a4e8d35ca82 Mon Sep 17 00:00:00 2001 From: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> Date: Fri, 22 Nov 2024 16:53:02 +0530 Subject: [PATCH 25/28] Update service.md Signed-off-by: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> --- api/keystore/service.md | 44 ++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/api/keystore/service.md b/api/keystore/service.md index d8ff73f83d3a..dd76c6998734 100644 --- a/api/keystore/service.md +++ b/api/keystore/service.md @@ -22,19 +22,19 @@ This API uses the `json 2.0` API format. For more information on making JSON RPC ## Endpoint -``` +```sh /ext/keystore ``` ## Methods -### keystore.createUser +### `keystore.createUser` Create a new user with the specified username and password. **Signature**: -``` +```sh keystore.createUser( { username:string, @@ -48,7 +48,7 @@ keystore.createUser( **Example Call**: -``` +```sh curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -62,7 +62,7 @@ curl -X POST --data '{ **Example Response**: -``` +```json { "jsonrpc": "2.0", "id": 1, @@ -70,23 +70,23 @@ curl -X POST --data '{ } ``` -### keystore.deleteUser +### `keystore.deleteUser` - Deprecated as of [v1.9.12](https://github.com/ava-labs/avalanchego/releases/tag/v1.9.12). +Deprecated as of [v1.9.12](https://github.com/ava-labs/avalanchego/releases/tag/v1.9.12). Delete a user. **Signature**: -``` +```sh keystore.deleteUser({username: string, password:string}) -> {} ``` **Example Call**: -``` +```sh curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -100,7 +100,7 @@ curl -X POST --data '{ **Example Response**: -``` +```json { "jsonrpc": "2.0", "id": 1, @@ -108,7 +108,7 @@ curl -X POST --data '{ } ``` -### keystore.exportUser +### `keystore.exportUser` Deprecated as of [v1.9.12](https://github.com/ava-labs/avalanchego/releases/tag/v1.9.12). @@ -118,7 +118,7 @@ Export a user. The user can be imported to another node with [`keystore.importUs **Signature**: -``` +```sh keystore.exportUser( { username:string, @@ -135,7 +135,7 @@ keystore.exportUser( **Example Call**: -``` +```sh curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -149,7 +149,7 @@ curl -X POST --data '{ **Example Response**: -``` +```json { "jsonrpc": "2.0", "id": 1, @@ -160,7 +160,7 @@ curl -X POST --data '{ } ``` -### keystore.importUser +### `keystore.importUser` Deprecated as of [v1.9.12](https://github.com/ava-labs/avalanchego/releases/tag/v1.9.12). @@ -170,7 +170,7 @@ Import a user. `password` must match the user's password. `username` doesn't hav **Signature**: -``` +```sh keystore.importUser( { username:string, @@ -185,7 +185,7 @@ keystore.importUser( **Example Call**: -``` +```sh curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -200,7 +200,7 @@ curl -X POST --data '{ **Example Response**: -``` +```json { "jsonrpc": "2.0", "id": 1, @@ -208,7 +208,7 @@ curl -X POST --data '{ } ``` -### keystore.listUsers +### `keystore.listUsers` Deprecated as of [v1.9.12](https://github.com/ava-labs/avalanchego/releases/tag/v1.9.12). @@ -218,13 +218,13 @@ List the users in this keystore. **Signature**: -``` +```sh keystore.ListUsers() -> {users:[]string} ``` **Example Call**: -``` +```sh curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -234,7 +234,7 @@ curl -X POST --data '{ **Example Response**: -``` +```json { "jsonrpc": "2.0", "id": 1, From 85a60ea8fe05ecd3f2943b7ba1b2834e41731a0a Mon Sep 17 00:00:00 2001 From: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> Date: Fri, 22 Nov 2024 16:53:21 +0530 Subject: [PATCH 26/28] Update service.md Signed-off-by: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> --- api/metrics/service.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/metrics/service.md b/api/metrics/service.md index 661256110c56..1ac628348e27 100644 --- a/api/metrics/service.md +++ b/api/metrics/service.md @@ -6,7 +6,7 @@ This API set is for a specific node, it is unavailable on the [public server](/t ## Endpoint -``` +```sh /ext/metrics ``` @@ -14,7 +14,7 @@ This API set is for a specific node, it is unavailable on the [public server](/t To get the node metrics: -``` +```sh curl -X POST 127.0.0.1:9650/ext/metrics ``` From d0f05bedaba285de6188b621cda6b506690aae0e Mon Sep 17 00:00:00 2001 From: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> Date: Fri, 22 Nov 2024 16:56:08 +0530 Subject: [PATCH 27/28] Update service.md Signed-off-by: Ashutosh Tripathi <39340292+ashucoder9@users.noreply.github.com> --- indexer/service.md | 55 +++++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 28 deletions(-) diff --git a/indexer/service.md b/indexer/service.md index 711f32318a66..6f294cd95598 100644 --- a/indexer/service.md +++ b/indexer/service.md @@ -24,25 +24,25 @@ Each chain has one or more index. To see if a C-Chain block is accepted, for exa ### C-Chain Blocks -```text +```sh /ext/index/C/block ``` ### P-Chain Blocks -```text +```sh /ext/index/P/block ``` ### X-Chain Transactions -```text +```sh /ext/index/X/tx ``` ### X-Chain Blocks -```text +```sh /ext/index/X/block ``` @@ -58,7 +58,7 @@ Get container by ID. **Signature**: -```json +```sh index.getContainerByID({ id: string, encoding: string @@ -86,7 +86,7 @@ index.getContainerByID({ **Example Call**: -``` +```sh curl --location --request POST 'localhost:9650/ext/index/X/tx' \ --header 'Content-Type: application/json' \ --data-raw '{ @@ -122,7 +122,7 @@ Get container by index. The first container accepted is at index 0, the second i **Signature**: -``` +```sh index.getContainerByIndex({ index: uint64, encoding: string @@ -150,7 +150,7 @@ index.getContainerByIndex({ **Example Call**: -``` +```sh curl --location --request POST 'localhost:9650/ext/index/X/tx' \ --header 'Content-Type: application/json' \ --data-raw '{ @@ -166,7 +166,7 @@ curl --location --request POST 'localhost:9650/ext/index/X/tx' \ **Example Response**: -``` +```json { "jsonrpc": "2.0", "id": 1, @@ -192,7 +192,7 @@ Returns the transactions at index \[`startIndex`\], \[`startIndex+1`\], ... , \[ **Signature**: -``` +```sh index.getContainerRange({ startIndex: uint64, numToFetch: uint64, @@ -222,7 +222,7 @@ index.getContainerRange({ **Example Call**: -``` +```sh curl --location --request POST 'localhost:9650/ext/index/X/tx' \ --header 'Content-Type: application/json' \ --data-raw '{ @@ -239,7 +239,7 @@ curl --location --request POST 'localhost:9650/ext/index/X/tx' \ **Example Response**: -``` +```json { "jsonrpc": "2.0", "id": 1, @@ -261,7 +261,7 @@ Get a container's index. **Signature**: -``` +```sh index.getIndex({ id: string, encoding: string @@ -281,7 +281,7 @@ index.getIndex({ **Example Call**: -``` +```sh curl --location --request POST 'localhost:9650/ext/index/X/tx' \ --header 'Content-Type: application/json' \ --data-raw '{ @@ -297,7 +297,7 @@ curl --location --request POST 'localhost:9650/ext/index/X/tx' \ **Example Response**: -``` +```json { "jsonrpc": "2.0", "result": { @@ -313,7 +313,7 @@ Get the most recently accepted container. **Signature**: -``` +```sh index.getLastAccepted({ encoding:string }) -> { @@ -338,7 +338,7 @@ index.getLastAccepted({ **Example Call**: -``` +```sh curl --location --request POST 'localhost:9650/ext/index/X/tx' \ --header 'Content-Type: application/json' \ --data-raw '{ @@ -353,7 +353,7 @@ curl --location --request POST 'localhost:9650/ext/index/X/tx' \ **Example Response**: -``` +```json { "jsonrpc": "2.0", "id": 1, @@ -373,7 +373,7 @@ Returns true if the container is in this index. **Signature**: -``` +```sh index.isAccepted({ id: string, encoding: string @@ -393,7 +393,7 @@ index.isAccepted({ **Example Call**: -``` +```sh curl --location --request POST 'localhost:9650/ext/index/X/tx' \ --header 'Content-Type: application/json' \ --data-raw '{ @@ -409,7 +409,7 @@ curl --location --request POST 'localhost:9650/ext/index/X/tx' \ **Example Response**: -``` +```json { "jsonrpc": "2.0", "result": { @@ -423,14 +423,13 @@ curl --location --request POST 'localhost:9650/ext/index/X/tx' \ 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: +For example, to get the second transaction (note that `"index":1`) accepted on the X-Chain, do: -``` +```sh curl --location --request POST 'https://indexer-demo.avax.network/ext/index/X/tx' \ --header 'Content-Type: application/json' \ --data-raw '{ @@ -448,7 +447,7 @@ This returns the ID of the second transaction accepted in the X-Chain's history. The above API call gives the response below: -``` +```json { "jsonrpc": "2.0", "result": { @@ -466,7 +465,7 @@ The ID of this transaction is `ZGYTSU8w3zUP6VFseGC798vA2Vnxnfj6fz1QPfA9N93bhjJvo To get the transaction by its ID, use API method `avm.getTx`: -``` +```sh curl -X POST --data '{ "jsonrpc":"2.0", "id" :1, @@ -478,9 +477,9 @@ curl -X POST --data '{ }' -H 'content-type:application/json;' https://api.avax.network/ext/bc/X ``` -Response: +**Response**: -``` +```json { "jsonrpc": "2.0", "result": { From be76933c9228395d79716b70c5fe2fd0c704dd2d Mon Sep 17 00:00:00 2001 From: Ashutosh Tripathi Date: Sat, 23 Nov 2024 17:49:43 +0530 Subject: [PATCH 28/28] update files according to suggestions --- api/admin/service.md | 56 +++++++------- api/info/service.md | 100 ++++++++++++------------ api/keystore/service.md | 46 +++++------ api/metrics/service.md | 2 +- indexer/service.md | 20 ++--- vms/platformvm/service.md | 156 +++++++++++++++++++------------------- 6 files changed, 188 insertions(+), 192 deletions(-) diff --git a/api/admin/service.md b/api/admin/service.md index 924b9523d66d..3ad579921863 100644 --- a/api/admin/service.md +++ b/api/admin/service.md @@ -12,7 +12,7 @@ This API uses the `json 2.0` RPC format. For details, see [here](/api-reference/ ## Endpoint -```sh +``` /ext/admin ``` @@ -24,7 +24,7 @@ Assign an API endpoint an alias, a different endpoint for the API. The original **Signature**: -```sh +``` admin.alias({endpoint:string, alias:string}) -> {} ``` @@ -70,7 +70,7 @@ Note that the alias is set for each chain on each node individually. In a multi- **Signature**: -```sh +``` admin.aliasChain( { chain:string, @@ -114,11 +114,11 @@ Returns the aliases of the chain **Signature**: -```sh +``` admin.getChainAliases( - { - chain:string - } + { + chain:string + } ) -> {aliases:string[]} ``` @@ -159,17 +159,17 @@ Returns log and display levels of loggers. **Signature**: -```sh +``` admin.getLoggerLevel( - { - loggerName:string // optional - } + { + loggerName:string // optional + } ) -> { loggerLevels: { - loggerName: { - logLevel: string, - displayLevel: string - } + loggerName: { + logLevel: string, + displayLevel: string + } } } ``` @@ -212,10 +212,10 @@ Dynamically loads any virtual machines installed on the node as plugins. See [he **Signature**: -```sh +``` admin.loadVMs() -> { - newVMs: map[string][]string - failedVMs: map[string]string, + newVMs: map[string][]string + failedVMs: map[string]string, } ``` @@ -255,7 +255,7 @@ Writes a profile of mutex statistics to `lock.profile`. **Signature**: -```sh +``` admin.lockProfile() -> {} ``` @@ -286,7 +286,7 @@ Writes a memory profile of the to `mem.profile`. **Signature**: -```sh +``` admin.memoryProfile() -> {} ``` @@ -317,13 +317,13 @@ Sets log and display levels of loggers. **Signature**: -```sh +``` admin.setLoggerLevel( - { - loggerName: string, // optional - logLevel: string, // optional - displayLevel: string, // optional - } + { + loggerName: string, // optional + logLevel: string, // optional + displayLevel: string, // optional + } ) -> {} ``` @@ -364,7 +364,7 @@ Start profiling the CPU utilization of the node. To stop, call `admin.stopCPUPro **Signature**: -```sh +``` admin.startCPUProfiler() -> {} ``` @@ -395,7 +395,7 @@ Stop the CPU profile that was previously started. **Signature**: -```sh +``` admin.stopCPUProfiler() -> {} ``` diff --git a/api/info/service.md b/api/info/service.md index 4f6f3074175a..e2ee8380d0c8 100644 --- a/api/info/service.md +++ b/api/info/service.md @@ -6,7 +6,7 @@ This API uses the `json 2.0` RPC format. For more information on making JSON RPC ## Endpoint -```sh +``` /ext/info ``` @@ -18,15 +18,15 @@ Returns peer preferences for Avalanche Community Proposals (ACPs) **Signature**: -```sh +``` info.acps() -> { - acps: map[uint32]{ - supportWeight: uint64 - supporters: set[string] - objectWeight: uint64 - objectors: set[string] - abstainWeight: uint64 - } + acps: map[uint32]{ + supportWeight: uint64 + supporters: set[string] + objectWeight: uint64 + objectors: set[string] + abstainWeight: uint64 + } } ``` @@ -109,7 +109,7 @@ Check whether a given chain is done bootstrapping **Signature**: -```sh +``` info.isBootstrapped({chain: string}) -> {isBootstrapped: bool} ``` @@ -146,7 +146,7 @@ Given a blockchain's alias, get its ID. (See [`admin.aliasChain`](/api-reference **Signature**: -```sh +``` info.getBlockchainID({alias:string}) -> {blockchainID:string} ``` @@ -181,7 +181,7 @@ Get the ID of the network this node is participating in. **Signature**: -```sh +``` info.getNetworkID() -> { networkID: int } ``` @@ -215,7 +215,7 @@ Get the name of the network this node is participating in. **Signature**: -```sh +``` info.getNetworkName() -> { networkName:string } ``` @@ -251,7 +251,7 @@ This endpoint set is for a specific node, it is unavailable on the [public serve **Signature**: -```sh +``` info.getNodeID() -> { nodeID: string, nodePOP: { @@ -302,7 +302,7 @@ This endpoint set is for a specific node, it is unavailable on the [public serve **Signature**: -```sh +``` info.getNodeIP() -> {ip: string} ``` @@ -334,13 +334,13 @@ Get the version of this node. **Signature**: -```sh +``` info.getNodeVersion() -> { - version: string, - databaseVersion: string, - gitCommit: string, - vmVersions: map[string]string, - rpcProtocolVersion: string, + version: string, + databaseVersion: string, + gitCommit: string, + vmVersions: map[string]string, + rpcProtocolVersion: string, } ``` @@ -388,18 +388,18 @@ Get the fees of the network. **Signature**: -```sh +``` info.getTxFee() -> { - txFee: uint64, - createAssetTxFee: uint64, - createSubnetTxFee: uint64, - transformSubnetTxFee: uint64, - createBlockchainTxFee: uint64, - addPrimaryNetworkValidatorFee: uint64, - addPrimaryNetworkDelegatorFee: uint64, - addSubnetValidatorFee: uint64, - addSubnetDelegatorFee: uint64 + txFee: uint64, + createAssetTxFee: uint64, + createSubnetTxFee: uint64, + transformSubnetTxFee: uint64, + createBlockchainTxFee: uint64, + addPrimaryNetworkValidatorFee: uint64, + addPrimaryNetworkDelegatorFee: uint64, + addSubnetValidatorFee: uint64, + addSubnetDelegatorFee: uint64 } ``` @@ -455,9 +455,9 @@ This endpoint set is for a specific node, it is unavailable on the [public serve **Signature**: -```sh +``` info.getVMs() -> { - vms: map[string][]string + vms: map[string][]string } ``` @@ -497,23 +497,23 @@ Get a description of peer connections. **Signature**: -```sh +``` info.peers({ - nodeIDs: string[] // optional + 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, - } + numPeers: int, + peers:[]{ + ip: string, + publicIP: string, + nodeID: string, + version: string, + lastSent: string, + lastReceived: string, + benched: string[], + observedUptime: int, + observedSubnetUptime: map[string]int, + } } ``` @@ -599,11 +599,11 @@ Returns the network's observed uptime of this node. This is the only reliable so **Signature**: -```sh +``` info.uptime() -> { - rewardingStakePercentage: float64, - weightedAveragePercentage: float64 + rewardingStakePercentage: float64, + weightedAveragePercentage: float64 } ``` diff --git a/api/keystore/service.md b/api/keystore/service.md index dd76c6998734..62c593e26d47 100644 --- a/api/keystore/service.md +++ b/api/keystore/service.md @@ -22,7 +22,7 @@ This API uses the `json 2.0` API format. For more information on making JSON RPC ## Endpoint -```sh +``` /ext/keystore ``` @@ -34,12 +34,12 @@ Create a new user with the specified username and password. **Signature**: -```sh +``` keystore.createUser( - { - username:string, - password:string - } +{ + username:string, + password:string +} ) -> {} ``` @@ -80,8 +80,8 @@ Delete a user. **Signature**: -```sh -keystore.deleteUser({username: string, password:string}) -> {} +``` +keystore.deleteUser({ username: string, password:string }) -> {} ``` **Example Call**: @@ -118,13 +118,13 @@ Export a user. The user can be imported to another node with [`keystore.importUs **Signature**: -```sh +``` keystore.exportUser( - { - username:string, - password:string, - encoding:string //optional - } +{ + username:string, + password:string, + encoding:string //optional +} ) -> { user:string, encoding:string @@ -170,14 +170,14 @@ Import a user. `password` must match the user's password. `username` doesn't hav **Signature**: -```sh +``` keystore.importUser( - { - username:string, - password:string, - user:string, - encoding:string //optional - } +{ + username:string, + password:string, + user:string, + encoding:string //optional +} ) -> {} ``` @@ -218,8 +218,8 @@ List the users in this keystore. **Signature**: -```sh -keystore.ListUsers() -> {users:[]string} +``` +keystore.ListUsers() -> { users: []string } ``` **Example Call**: diff --git a/api/metrics/service.md b/api/metrics/service.md index 1ac628348e27..03a4ab8bc65b 100644 --- a/api/metrics/service.md +++ b/api/metrics/service.md @@ -6,7 +6,7 @@ This API set is for a specific node, it is unavailable on the [public server](/t ## Endpoint -```sh +``` /ext/metrics ``` diff --git a/indexer/service.md b/indexer/service.md index 6f294cd95598..afd31b6597aa 100644 --- a/indexer/service.md +++ b/indexer/service.md @@ -24,25 +24,25 @@ Each chain has one or more index. To see if a C-Chain block is accepted, for exa ### C-Chain Blocks -```sh +``` /ext/index/C/block ``` ### P-Chain Blocks -```sh +``` /ext/index/P/block ``` ### X-Chain Transactions -```sh +``` /ext/index/X/tx ``` ### X-Chain Blocks -```sh +``` /ext/index/X/block ``` @@ -58,7 +58,7 @@ Get container by ID. **Signature**: -```sh +``` index.getContainerByID({ id: string, encoding: string @@ -122,7 +122,7 @@ Get container by index. The first container accepted is at index 0, the second i **Signature**: -```sh +``` index.getContainerByIndex({ index: uint64, encoding: string @@ -192,7 +192,7 @@ Returns the transactions at index \[`startIndex`\], \[`startIndex+1`\], ... , \[ **Signature**: -```sh +``` index.getContainerRange({ startIndex: uint64, numToFetch: uint64, @@ -261,7 +261,7 @@ Get a container's index. **Signature**: -```sh +``` index.getIndex({ id: string, encoding: string @@ -313,7 +313,7 @@ Get the most recently accepted container. **Signature**: -```sh +``` index.getLastAccepted({ encoding:string }) -> { @@ -373,7 +373,7 @@ Returns true if the container is in this index. **Signature**: -```sh +``` index.isAccepted({ id: string, encoding: string diff --git a/vms/platformvm/service.md b/vms/platformvm/service.md index bdb1a1a0ff3c..4bb04e11099c 100644 --- a/vms/platformvm/service.md +++ b/vms/platformvm/service.md @@ -2,7 +2,7 @@ The P-Chain API allows clients to interact with the [P-Chain](/learn/avalanche/a ## Endpoint -```sh +``` /ext/bc/P ``` @@ -30,7 +30,7 @@ Get the private key that controls a given address. **Signature:** -```sh +``` platform.exportKey({ username: string, password: string, @@ -81,7 +81,7 @@ Get the balance of AVAX controlled by a given address. **Signature:** -```sh +``` platform.getBalance({ addresses: []string }) -> { @@ -157,7 +157,7 @@ Get a block by its ID. **Signature:** -```sh +``` platform.getBlock({ blockID: string encoding: string // optional @@ -290,7 +290,7 @@ Get a block by its height. **Signature:** -```sh +``` platform.getBlockByHeight({ height: int encoding: string // optional @@ -429,15 +429,15 @@ Get all the blockchains that exist (excluding the P-Chain). **Signature:** -```sh +``` platform.getBlockchains() -> { - blockchains: []{ - id: string, - name: string, - subnetID: string, - vmID: string - } + blockchains: []{ + id: string, + name: string, + subnetID: string, + vmID: string + } } ``` @@ -519,11 +519,11 @@ Get the status of a blockchain. **Signature:** -```sh +``` platform.getBlockchainStatus( - { - blockchainID: string - } + { + blockchainID: string + } ) -> {status: string} ``` @@ -569,10 +569,10 @@ an upper bound because it does not account for burnt tokens, including transacti **Signature:** -```sh -platform.getCurrentSupply({ - subnetID: string // optional -}) -> {supply: int} +``` +platform.getCurrentSupply ({ + subnetID: string // optional +}) -> { supply: int } ``` - `supply` is an upper bound on the number of tokens that exist. @@ -610,10 +610,10 @@ List the current validators of the given Subnet. **Signature:** -```sh +``` platform.getCurrentValidators({ - subnetID: string, // optional - nodeIDs: string[], // optional + subnetID: string, // optional + nodeIDs: string[], // optional }) -> { validators: []{ txID: string, @@ -774,14 +774,14 @@ Returns the dynamic fees configuration of the P-chain. **Signature:** -```sh +``` platform.getFeeConfig() -> { - weights: []uint64, - maxCapacity: uint64, - maxPerSecond: uint64, - targetPerSecond: uint64, - minPrice: uint64, - excessConversionConstant: uint64 + weights: []uint64, + maxCapacity: uint64, + maxPerSecond: uint64, + targetPerSecond: uint64, + minPrice: uint64, + excessConversionConstant: uint64 } ``` @@ -826,12 +826,12 @@ Returns the current fee state of the P-chain. **Signature:** -```sh +``` platform.getFeeState() -> { - capacity: uint64, - excess: uint64, - price: uint64, - timestamp: string + capacity: uint64, + excess: uint64, + price: uint64, + timestamp: string } ``` @@ -869,7 +869,7 @@ Returns a current L1 validator. **Signature:** -```sh +``` platform.getL1Validator({ validationID: string, }) -> { @@ -953,10 +953,10 @@ Returns the height of the last accepted block. **Signature:** -```sh +``` platform.getHeight() -> { - height: int, + height: int, } ``` @@ -989,10 +989,10 @@ Returns this node's current proposer VM height **Signature:** -```sh +``` platform.getProposedHeight() -> { - height: int, + height: int, } ``` @@ -1031,18 +1031,14 @@ Returns the maximum amount of nAVAX staking to the named node during a particula **Signature:** -```sh -platform.getMaxStakeAmount( - { - subnetID: string, - nodeID: string, - startTime: int, - endTime: int - } -) -> +``` +platform.getMaxStakeAmount ( { - amount: uint64 -} + subnetID: string, + nodeID: string, + startTime: int, + endTime: int +}) -> { amount: uint64 } ``` - `subnetID` is a Buffer or cb58 string representing Subnet @@ -1088,13 +1084,13 @@ tokens that can be delegated. **Signature:** -```sh +``` platform.getMinStake({ - subnetID: string // optional + subnetID: string // optional }) -> { - minValidatorStake : uint64, - minDelegatorStake : uint64 + minValidatorStake : uint64, + minDelegatorStake : uint64 } ``` @@ -1131,10 +1127,10 @@ currently validating the Subnet but will in the future. **Signature:** -```sh +``` platform.getPendingValidators({ - subnetID: string, // optional - nodeIDs: string[], // optional + subnetID: string, // optional + nodeIDs: string[], // optional }) -> { validators: []{ txID: string, @@ -1239,7 +1235,7 @@ ended. **Signature:** -```sh +``` platform.getRewardUTXOs({ txID: string, encoding: string // optional @@ -1299,7 +1295,7 @@ rewards. **Signature:** -```sh +``` platform.getStake({ addresses: []string, validatorsOnly: true or false @@ -1359,7 +1355,7 @@ Retrieve an assetID for a Subnet’s staking asset. **Signature:** -```sh +``` platform.getStakingAssetID({ subnetID: string // optional }) -> { @@ -1411,7 +1407,7 @@ Get owners and info about the Subnet or L1. **Signature:** -```sh +``` platform.getSubnet({ subnetID: string }) -> @@ -1479,7 +1475,7 @@ Get info about the Subnets. **Signature:** -```sh +``` platform.getSubnets({ ids: []string }) -> @@ -1540,7 +1536,7 @@ Get the current P-Chain timestamp. **Signature:** -```sh +``` platform.getTimestamp() -> {time: string} ``` @@ -1574,7 +1570,7 @@ Get the total amount of tokens staked on the requested Subnet. **Signature:** -```sh +``` platform.getTotalStake({ subnetID: string }) -> { @@ -1649,7 +1645,7 @@ Optional `encoding` parameter to specify the format for the returned transaction **Signature:** -```sh +``` platform.getTx({ txID: string, encoding: string // optional @@ -1758,10 +1754,10 @@ Gets a transaction’s status by its ID. If the transaction was dropped, respons **Signature:** -```sh +``` platform.getTxStatus({ - txID: string -}) -> {status: string} + txID: string +}) -> { status: string } ``` `status` is one of: @@ -1803,7 +1799,7 @@ Gets the UTXOs that reference a given set of addresses. **Signature:** -```sh +``` platform.getUTXOs( { addresses: []string, @@ -1971,7 +1967,7 @@ Get the validators and their weights of a Subnet or the Primary Network at a giv **Signature:** -```sh +``` platform.getValidatorsAt( { height: [int|string], @@ -2022,11 +2018,11 @@ Issue a transaction to the Platform Chain. **Signature:** -```sh +``` platform.issueTx({ tx: string, encoding: string, // optional -}) -> {txID: string} +}) -> { txID: string } ``` - `tx` is the byte representation of a transaction. @@ -2078,11 +2074,11 @@ List addresses controlled by the given user. **Signature:** -```sh +``` platform.listAddresses({ username: string, password: string -}) -> {addresses: []string} +}) -> { addresses: []string } ``` **Example Call:** @@ -2117,7 +2113,7 @@ Sample validators from the specified Subnet. **Signature:** -```sh +``` platform.sampleValidators( { size: int, @@ -2167,12 +2163,12 @@ Get the Subnet that validates a given blockchain. **Signature:** -```sh +``` platform.validatedBy( { blockchainID: string } -) -> {subnetID: string} +) -> { subnetID: string } ``` - `blockchainID` is the blockchain’s ID. @@ -2209,12 +2205,12 @@ Get the IDs of the blockchains a Subnet validates. **Signature:** -```sh +``` platform.validates( { subnetID: string } -) -> {blockchainIDs: []string} +) -> { blockchainIDs: []string } ``` - `subnetID` is the Subnet’s ID.