Connecting to Aptos Incentivized Testnet

Only do this if you have received a confirmation e-mail from the Aptos team that you are eligible. Nodes that do not qualify will not have enough tokens to participate in the testnet. In that case, you can still run a public full node if you want.

Initializing the Stacking Pool

In AIT3 we’ll have UI support allowing the owner to manage the stacking pool, details here. If you’ve already done this through the UI, you can ignore this step and go to «Load a validator node».

Alternatively, you can also use the CLI to initialize the stacking pool:

  • Initialize the CLI with your wallet’s private key, which you can get from Settings -> Credentials
aptos init --profile ait3-owner 
  --rest-url https://ait3.aptosdev.com
Enter fullscreen mode Exit fullscreen mode
  • Initialize the stacking pool using the CLI
aptos stake initialize-stake-owner 
  --initial-stake-amount 100000000000000 
  --operator-address <operator-address> 
  --voter-address <voter-address> 
  --profile ait3-owner
Enter fullscreen mode Exit fullscreen mode
  • Don’t forget to transfer some coins to your operator account to pay for gas, you can do this with Petra, or with the CLI
aptos account create --account <operator-account> --profile ait3-owner
aptos account transfer 
--account <operator-account> 
--amount 5000 
--profile ait3-owner
Enter fullscreen mode Exit fullscreen mode

Load a validator node
Before you join the test network, you need to load your node with the genesis blob and waypoint provided by the Aptos Labs team. This will take your node from test mode to prod mode.

Using source code

  • Stop your node and delete the data directory. Make sure you also delete the secure-data.json file, the path to which is defined here.
  • Download the genesis.blob and waypoint.txt files published by the Aptos Labs team.
  • Update account_address in validator-identity.yaml to the owner’s wallet address, do not change anything else, leave the keys as they are.
  • Make the last changes in the testnet branch. This has to be a commit b2228f286b5fe7631dee62690ae5d1087017e20d
  • Close the metrics port 9101 and the REST API port 80 for your validator (you can leave them open for the full node).
  • Restarting the node

Using Docker.

  • Stop the node and delete the data volumes, docker compose down --volumes. Make sure you also remove the secure-data.json file, the path to which is defined here.
  • Download the genesis.blob and waypoint.txt files published by the Aptos Labs team.
  • Update account_address in validator-identity.yaml to the owner's wallet address.
  • Update the docker image to use the testnet_b2228f286b5fe7631dee62690ae5d1087017e20d tag.
  • Close metric port 9101 and REST API port 80 for your validator (remove it from the docker compose file), you can leave it open for the full node.
  • Restarting the node: docker compose up

Using Terraform

  • Increase the number of era (epochs) in the Terraform configuration, this will wipe the data after application.
  • Update chain_id to 47.
  • Update the docker image to use the testnet_b2228f286b5fe7631dee62690ae5d1087017e20d tag
  • Close the metrics port and the REST API port for the validator (you can leave it open for the full node), add helm values to your main.tf file, for example:
module "aptos-node" {
    ...

    helm_values = {
        service = {
          validator = {
            enableRestApi = false
            enableMetricsPort = false
          }
        }
    }
}
Enter fullscreen mode Exit fullscreen mode
  • Apply Terraform: terraform apply.
  • Download the genesis.blob and waypoint.txt files published by the Aptos Labs team.
  • Update account_address in validator-identity.yaml to the owner's wallet address, do not change anything else, keep the keys as is.
  • Re-create the secrets, make sure that the secret name matches your era number, for example if you have era = 3, you have to replace the secret name with ${WORKSPACE}-aptos-node-0-genesis-e3.
export WORKSPACE=<your workspace name>

kubectl create secret generic ${WORKSPACE}-aptos-node-0-genesis-e2 
    --from-file=genesis.blob=genesis.blob 
    --from-file=waypoint.txt=waypoint.txt 
    --from-file=validator-identity.yaml=keys/validator-identity.yaml 
    --from-file=validator-full-node-identity.yaml=keys/validator-full-node-identity.yaml
Enter fullscreen mode Exit fullscreen mode

Joining the validator pool

At this point, you have already used your owner account to initialize the validator pool and assign an operator to your operator account. Next, you need to set up a validator node using your operator account and join the validator set.

1.Initialize Aptos CLI.

aptos init --profile ait3-operator 
--private-key <operator_account_private_key> 
--rest-url https://ait3.aptosdev.com 
--skip-faucet
Enter fullscreen mode. Exit fullscreen mode

TIP .

2.Check your validator account balance, make sure you have coins to pay for gas. (If not, transfer some coins to that account from your owner account).

You can check in explorer https://explorer.devnet.aptos.dev/account/<account-address>?network=ait3 or use the CLI

aptos account list --profile ait3-operator
Enter fullscreen mode Exit fullscreen mode

This will show you the coin balance of the validator account. You should see something like:

"coin": {
    "value": "5000"
  }
Enter fullscreen mode Exit fullscreen mode

3.Updating the network addresses of the validators on the network

aptos node update-validator-network-addresses  
  --pool-address <owner-address> 
  --operator-config-file ~/$WORKSPACE/$USERNAME/operator.yaml 
  --profile ait3-operator
Enter fullscreen mode Exit fullscreen mode

4.Updating of validator consensus key in the network

aptos node update-consensus-key  
  --pool-address <owner-address> 
  --operator-config-file ~/$WORKSPACE/$USERNAME/operator.yaml 
  --profile ait3-operator
Enter fullscreen mode Exit fullscreen mode

5.Join validator set

aptos node join-validator-set 
  --pool-address <owner-address> 
  --profile ait3-operator 
  --max-gas 10000 
Enter fullscreen mode Exit fullscreen mode

MAXIMUM GAS
You can change the above value max-gas. Make sure you send enough tokens to your operator to pay the cost of gas.

ValidatorSet will be updated at each epoch change, that is every 2 hours. You will see that your node joins the validator set only in the next epoch. Validator and node will start syncing as soon as your validator is included in the validator set.

6.Check the validator set

aptos node show-validator-set --profile ait3-operator | jq -r '.Result.pending_active' | grep <account_address>
Enter fullscreen mode. Exit fullscreen mode.

You will see your validator node listed as "pending_active". When the next epoch change occurs, the node will be moved to the "active_validators" list. This will happen within one hour of completing the previous step. During this time you may see errors like "No connected AptosNet peers", which is normal.

aptos node show-validator-set --profile ait3-operator | jq -r '.Result.active_validators' | grep <account_address>
Enter fullscreen mode. Exit fullscreen mode

Checking connection of nodes

NODE VIABILITY DETECTION
See here for details on how to determine if a node is alive.
Once your validator node has joined the validator set, you can verify correctness by performing the following steps:

1.Make sure that your node connects to other peers on the testnet network. Replace 127.0.0.1 with the IP/DNS of your validator if it is deployed in the cloud.

curl 127.0.0.1:9101/metrics 2> /dev/null | grep "aptos_connections{.*"Validator".*}"
Enter fullscreen mode Exit fullscreen mode

The command will output the number of incoming and outgoing connections for your validator node. For example:

aptos_connections{direction="inbound",network_id="Validator",peer_id="f326fd30",role_type="validator"} 5
aptos_connections{direction="outbound",network_id="Validator",peer_id="f326fd30",role_type="validator"} 2
Enter fullscreen mode. Exit fullscreen mode

If one of the metrics is greater than zero, then your node is connected to at least one of the peers in the test network.

2.You can also check if your node is connected to the AptosLabs node, replace with the peer ID shared by the Aptos team.

curl 127.0.0.1:9101/metrics 2> /dev/null | grep "aptos_network_peer_connected{.*remote_peer_id="<Aptos Peer ID>".*}"
Enter fullscreen mode Exit fullscreen mode.

Check if your node is in sync.

curl 127.0.0.1:9101/metrics 2> /dev/null | grep "aptos_state_sync_version"
Enter fullscreen mode. Exit fullscreen mode.

You should expect the version "committed" to be constantly increasing.

4.Once the state of your node is synchronized with the latest version you can also check if the consensus is advancing and your node offers

curl 127.0.0.1:9101/metrics 2> /dev/null | grep "aptos_consensus_current_round"

curl 127.0.0.1:9101/metrics 2> /dev/null | grep "aptos_consensus_proposals_count"
Enter fullscreen mode Exit fullscreen mode.

You should expect this number to keep increasing.

5.Finally, the easiest way to check if your node is functioning properly is to check if it is getting a stacking reward. You can check this in explorer, https://explorer.devnet.aptos.dev/account/<owner-account-address>?network=ait3

0x1::stake::StakePool

"active": {
  "value": "100009129447462"
}
Enter fullscreen mode Exit fullscreen mode

You should expect the active value for your StakePool to keep increasing. It is updated every epoch, so it will be updated every two hours.

Exit validator set

Noda can exit the validator set at any time, or it will happen automatically when the validator account does not have enough StakePool. To leave the validator set, you can do the following:

1.Exit the validator set (will take effect in the next era)

aptos node leave-validator-set --profile ait3-operator --pool-address <owner-address>
Enter fullscreen mode Exit fullscreen mode

Оцените статью
devanswers.ru
Добавить комментарий