使用 Docker
激励测试网教程(Incentivized Testnet Tutorial)
如果你之前运行过 devnet 全节点或测试网节点,请先停止,防止端口冲突导致无法运行测试网验证者节点。
If you have run a devnet full node before, please stop it first to prevent port conflicts from running the testnet validator node.

安装 Docker 和 docker-compose(Install Docker and docker-compose)

# Install Docker
wget -O get-docker.sh https://get.docker.com
sudo sh get-docker.sh
rm -f get-docker.sh
# Install docker-compose
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose

创建目录(Create Directory)

sudo mkdir -p ~/aptos-node/testnet2 && cd ~/aptos-node/testnet2

生成密钥对(节点所有者密钥、共识密钥和网络密钥)(Generate private keys)

sudo docker run --rm \
-v $(pwd):/data/aptos-cli \
jiangydev/aptos-cli:v0.2.0 \
aptos genesis generate-keys --output-dir /data/aptos-cli

下载编排文件(Download files)

sudo wget -O docker-compose.yaml https://raw.githubusercontent.com/aptos-labs/aptos-core/main/docker/compose/aptos-node/docker-compose.yaml
sudo wget -O validator.yaml https://raw.githubusercontent.com/aptos-labs/aptos-core/main/docker/compose/aptos-node/validator.yaml
8月13日更新:
官方在 8 月 4 日更新了 docker-compose.yaml 中的启动命令,但镜像未更新,导致最后无法启动。
请自行修改 docker-compose.yaml 中的命令,将 /usr/local/bin/aptos-node 修改成 /opt/aptos/bin/aptos-node

生成验证者配置(Generate Validator Info)

只需要修改以下信息:(Only need to modify these config)
  • 您的节点名称<your-node-name>
  • 验证者节点IP或DNS域名:端口<your-vlidator-node-ip:port>
  • 全节点IP或DNS域名:端口<your-full-node-ip:port>
MoveMove 是我的节点名称(社区名称) 😀(MoveMove is my node name)
sudo docker run --rm \
-v $(pwd):/data/aptos-cli \
jiangydev/aptos-cli:v0.2.0 \
aptos genesis set-validator-configuration \
--keys-dir /data/aptos-cli --local-repository-dir /data/aptos-cli \
--username 您的节点名称<your-node-name> \
--validator-host 验证者节点IP或DNS域名:端口<your-vlidator-node-ip:port>
示例(Example):
sudo docker run --rm \
-v $(pwd):/data/aptos-cli \
jiangydev/aptos-cli:v0.2.0 \
aptos genesis set-validator-configuration \
--keys-dir /data/aptos-cli --local-repository-dir /data/aptos-cli \
--username MoveMove \
--validator-host 35.232.235.205:6180

生成 layout 文件(Generate layout YAML file)

  • needn't modify the root key(官方文档中提及,不需要修改 root_key)
  • modify the node name(只需要修改 你的节点名称)
  • The following command is a statement, please modify and execute after copying all of them.(下面的命令是一条语句,请全部复制后修改并执行)
sudo bash -c "cat > layout.yaml" <<EOF
---
root_key: "F22409A93D1CD12D2FC92B5F8EB84CDCD24C348E32B3E7A720F3D2E288E63394"
users:
- "您的节点名称<your-node-name>"
chain_id: 40
min_stake: 0
max_stake: 100000
min_lockup_duration_secs: 0
max_lockup_duration_secs: 2592000
epoch_duration_secs: 86400
initial_lockup_timestamp: 1656615600
min_price_per_gas_unit: 1
allow_new_validators: true
EOF
示例:(Example)
sudo bash -c "cat > layout.yaml" <<EOF
---
root_key: "F22409A93D1CD12D2FC92B5F8EB84CDCD24C348E32B3E7A720F3D2E288E63394"
users:
- "MoveMove"
chain_id: 40
min_stake: 0
max_stake: 100000
min_lockup_duration_secs: 0
max_lockup_duration_secs: 2592000
epoch_duration_secs: 86400
initial_lockup_timestamp: 1656615600
min_price_per_gas_unit: 1
allow_new_validators: true
EOF

生成 genesis blob 和 waypoint(Generate genesis blob and waypoint file)

sudo docker run --rm \
-v $(pwd):/data/aptos-cli \
jiangydev/aptos-cli:v0.2.0 \
sh -c "rm -rf /data/aptos-cli/genesis.blob && rm -rf /data/aptos-cli/waypoint.txt && rm -rf /data/aptos-cli/framework && cp -r /framework /data/aptos-cli && aptos genesis generate-genesis --local-repository-dir /data/aptos-cli --output-dir /data/aptos-cli && rm -rf /data/aptos-cli/framework"

启动节点(Run node)

sudo docker-compose pull
sudo docker-compose up -d
如果您的节点端口不通,请关闭服务器防火墙,并在云服务器提供商的安全策略中放行如下端口:
验证者节点(本教程只提供验证者节点搭建):
  • 80:validator REST API 端口;
  • 6180:validator 的 peer 通信端口;
  • 9101:validator 指标端口;
全节点:
  • 6182:full node 的 peer 信端口;
  • 8080:full node REST API 端口;
  • 9103:full node 指标端口;

申请激励测试网(Apply for Incentivized Testnet)

网站(Website):https://community.aptoslabs.com/
你可以查看文件以获取 PUBLIC KEYS, VALIDATOR NODE 信息。
You can check the file content for PUBLIC KEYS, VALIDATOR NODE information.
cat 你的节点名称<your-node-name>.yaml
示例(Example):
cat MoveMove.yaml
全节点是可选项,暂不提供。
欢迎加入 MoveMove 社区:https://discord.gg/Vsj7Jwny9G