> For the complete documentation index, see [llms.txt](https://gushi10546.gitbook.io/aptos-kai-fa-zhe-wen-dang/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gushi10546.gitbook.io/aptos-kai-fa-zhe-wen-dang/jie-dian/ait-3/lian-jie-dao-aptos-ji-li-ce-shi-wang.md).

# 链接到Aptos激励测试网

只有当您收到Aptos团队关于您的资格的确认电子邮件时，才可以这样做。未被选中的节点将没有足够的代币来加入测试网。在这种情况下，如果需要，您仍然可以运行public-fullnode。

### 初始化质押池

在AIT3中，我们将提供UI支持，允许所有者管理质押池。或者，您也可以使用CLI初始化质押池：

* 使用钱包**私钥**初始化CLI，您可以从设置->凭据进入

  ```
  aptos init --profile ait3-owner \\
    --rest-url <http://ait3.aptosdev.com>
  ```
* 使用 CLI初始化质押池

  ```
  aptos stake initialize-stake-owner \\
    --initial-stake-amount 100000000000000 \\
    --operator-address <operator-address> \\
    --voter-address <voter-address> \\
    --profile ait3-owner
  ```
* 不要忘记将一些代币转移到您的运营商帐户以支付Gas，您可以使用Petra或CLI

  ```
  aptos account create --account <operator-account> --profile ait3-owner

  aptos account transfer \\
  --account <operator-account> \\
  --amount 5000 \\
  --profile ait3-owner
  ```

### 启动验证节点

在加入测试网之前，您需要使用Aptos实验室团队提供的genesis blob和waypoint引导节点。这会将节点从测试模式转换为生产模式。AIT3网络链ID为43。

#### 使用源代码

* 停止节点并删除数据目录。
* 下载 由Aptos实验室团队发布`genesis.blob`和`waypoint.txtd` 文件。
* 更新`validator-identity.yaml`中的`account_address到`您的**所有者**钱包地址。
* 拉取`testnet`分支上的最新代码
* 关闭验证器的度量端口`9101`和REST API端口`80`（您可以为fullnode保持打开状态）。
* 重新启动节点

#### 使用Docker

* 停止节点并删除数据卷，`docker compose down--volumes`
* 下载 由Aptos实验室团队发布`genesis.blob`和`waypoint.txtd` 文件。
* 更新`validator-identity.yaml`中的`account_address到`您的**所有者**钱包地址。
* 更新您的docker映像以使用标记`testnet`
* 关闭`9101`上的metrics端口和验证器的REST API端口`80`（将其从docker compose文件中删除），您可以将其保留为fullnode打开。
* 重新启动节点：`docker compose up`

#### 使用Terraform

* 在Terraform配置中增加`era`号，这将在应用后擦除数据。
* 将`chain_id`更新为43。
* 更新您的docker映像以使用标记`testnet`
* 关闭validator的metrics端口和REST API端口（您可以让它为fullnode打开），在`main.tf` 中添加helm值，例如：

```
module "aptos-node" {
    ...

    helm_values = {
        service = {
          validator = {
            enableRestApi = false
            enableMetricsPort = false
          }
        }
    }
}
```

* 应用Terraform：`Terraform apply`
* 下载 由Aptos实验室团队发布`genesis.blob`和`waypoint.txtd` 文件。
* 更新`validator-identity.yaml`中的`account_address到`您的**所有者**钱包地址。
* 重新创建密钥，确保密钥名称与`era`号匹配，例如，如果您有`era = 3`，则应将密钥名称替换为`${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
```

### 加入验证节点集

所有选定的参与者将获得Aptos币空投到其所有者帐户，一旦收到代币，您应初始化一个质押池并设置您的运营商帐户。下面的步骤是设置验证器节点，并加入验证器集。

1. 初始化Aptos CLI

   ```
   aptos init --profile ait3-operator \\
   --private-key <operator_account_private_key> \\
   --rest-url <http://ait3.aptosdev.com> \\
   --skip-faucet
   ```

   &#x20;💡 **注意 `account_private_key` ：**&#x53EF;以在`~/$WORKSPACE/keys` 目录下的 `private-keys.yaml` 中发现。
2. 检查您的验证器帐户余额，确保您有一些代币支付Gas。（如果没有，请从您的所有者帐户向该帐户转移一些代币）

   可以在浏览器上查看`https://explorer.devnet.aptos.dev/account/<account-address>?network=ait3` 或使用CLI查看

   ```
   aptos account list --profile ait2
   ```

   这将显示您在验证器帐户中的代币余额，你能看到如下内容

   ```
   "coin": {
       "value": "5000"
     }
   ```
3. 更新链上的验证器网络地址

   ```
   aptos node update-validator-network-addresses  \\
     --pool-address <owner-address> \\
     --operator-config-file ~/$WORKSPACE/$USERNAME/operator.yaml \\
     --profile ait3-operator
   ```
4. 更新链上的验证器共识密钥

   ```
   aptos node update-consensus-key  \\
     --pool-address <owner-address> \\
     --validator-config-file ~/$WORKSPACE/$USERNAME/operator.yaml \\
     --profile ait3-operator
   ```
5. 加入验证集

   ```
   aptos node join-validator-set \\
     --pool-address <owner-address> \\
     --profile ait3-operator
   ```

   ValidatorSet将在每次epoch更改时更新，即每2小时更新一次。您将只看到您的节点在下一个历元中加入验证器集。一旦您的验证器位于验证器集中，验证器和全节点将开始同步。
6. 查看验证集

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

   您应该能够在“pending\_active”列表中看到您的验证器节点。当下一个epoch发生变化时，节点将被移动到“active\_validators”列表中。这应在完成前一步后的一小时内完成。在此期间，您可能会看到“No connected AptosNet peers"之类的错误，这是正常的。

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

### Verify node connections

{% hint style="info" %}
💡 节点活跃度定义

您可以在[此处](https://aptos.dev/nodes/ait/node-liveness-criteria/)查看有关节点活跃度定义的详细信息。
{% endhint %}

一旦您的验证器节点加入了验证器集，您可以按照以下步骤验证正确性：

1. 验证您的节点是否正在连接到testnet上的其他对等节点。（如果部署在云上，请使用验证程序IP/DNS替换`127.0.0.1`）

   ```
   curl 127.0.0.1:9101/metrics 2> /dev/null | grep "aptos_connections{.*\\"Validator\\".*}"
   ```

   该命令将输出验证器节点的入站和出站连接数。例如：

   ```
   aptos_connections{direction="inbound",network_id="Validator",peer_id="2a40eeab",role_type="validator"} 5
   aptos_connections{direction="outbound",network_id="Validator",peer_id="2a40eeab",role_type="validator"} 2
   ```

   只要其中一个度量值大于零，您的节点就会连接到测试网络上的至少一个对等节点。
2. 您还可以检查您的节点是否连接到Aptos实验室的节点，用Aptos团队共享的对等ID替换`<Aptos Peer ID>`。

   ```
   curl 127.0.0.1:9101/metrics 2> /dev/null | grep "aptos_network_peer_connected{.*remote_peer_id=\\"<Aptos Peer ID>\\".*}"
   ```
3. 一旦您的节点状态同步到最新版本，您还可以检查共识是否正在取得进展，以及您的节点是否正在提出建议

   ```
   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"
   ```

   你应该会看到这个数字继续增加。

### 离开验证集

节点可以随时选择离开验证集，或者在验证器帐户上没有足够的质押时自动发生。要保留验证程序集，您可以执行以下步骤：

1. 离开验证程序设置（将在下一个epoch生效）
