使用 Docker

AIT-3 激励测试网教程(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.

请收藏本网址以获得最新教程!!!

节点要求

  • CPU: 8 核 16 线程

  • RAM:32GB

  • 存储:300 GB

  • 带宽:1 Gbps

详细要求请参阅 节点要求

安装 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/testnet3 && cd ~/aptos-node/testnet3

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

sudo docker run --rm \
  -v $(pwd)/keys:/data/aptos-cli \
  jiangydev/aptos-cli:v0.3.1 \
  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

生成验证者配置(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 社区) 😀(MoveMove is my node name)

sudo docker run --rm \
  -v $(pwd):/data/aptos-cli \
  jiangydev/aptos-cli:v0.3.1 \
  aptos genesis set-validator-configuration \
  --local-repository-dir /data/aptos-cli \
  --owner-public-identity-file /data/aptos-cli/keys/public-keys.yaml \
  --stake-amount 100000000000000 \
  --username 您的节点名称<your-node-name> \
  --validator-host 验证者节点IP或DNS域名:端口<your-vlidator-node-ip:port> \
  --full-node-host 全节点IP或DNS域名:端口<your-full-node-ip:port>

示例(Example):

sudo docker run --rm \
  -v $(pwd):/data/aptos-cli \
  jiangydev/aptos-cli:v0.3.1 \
  aptos genesis set-validator-configuration \
  --local-repository-dir /data/aptos-cli \
  --owner-public-identity-file /data/aptos-cli/keys/public-keys.yaml \
  --username MoveMove \
  --validator-host 35.232.235.205:6180 \
  --full-node-host 35.232.235.205:6182 \
  --stake-amount 100000000000000

生成 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: "D04470F43AB6AEAA4EB616B72128881EEF77346F2075FFE68E14BA7DEBD8095E"
users: ["您的节点名称<your-node-name>"]
chain_id: 43
allow_new_validators: false
epoch_duration_secs: 7200
is_test: true
min_stake: 100000000000000
min_voting_threshold: 100000000000000
max_stake: 100000000000000000
recurring_lockup_duration_secs: 86400
required_proposer_stake: 100000000000000
rewards_apy_percentage: 10
voting_duration_secs: 43200
voting_power_increase_limit: 20
EOF

示例:(Example)

sudo bash -c "cat > layout.yaml" <<EOF
---
root_key: "D04470F43AB6AEAA4EB616B72128881EEF77346F2075FFE68E14BA7DEBD8095E"
users: ["MoveMove"]
chain_id: 43
allow_new_validators: false
epoch_duration_secs: 7200
is_test: true
min_stake: 100000000000000
min_voting_threshold: 100000000000000
max_stake: 100000000000000000
recurring_lockup_duration_secs: 86400
required_proposer_stake: 100000000000000
rewards_apy_percentage: 10
voting_duration_secs: 43200
voting_power_increase_limit: 20
EOF

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

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

启动节点(Run node)

sudo docker-compose pull
sudo docker-compose up -d

如果您的节点端口不通,请关闭服务器防火墙,并在云服务器提供商的安全策略中放行如下端口:

验证者节点(本教程只提供验证者节点搭建):

  • 80:validator REST API 端口;

  • 6180:validator 的 peer 通信端口;

  • 6181:fullnode 通信端口;

  • 9101:validator 指标端口;

全节点:

  • 6182:full node 的 peer 信端口;

  • 80:full node REST API 端口;

  • 9101:full node 指标端口;

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

网站(Website):https://community.aptoslabs.com/

sudo cat ~/aptos-node/testnet3/keys/public-keys.yaml

  • OWNER KEY: 安装钱包插件后,钱包的公钥,Settings -> Credentials

  • CONSENSUS KEY: public-keys.yaml 文件中的 consensus_public_key

  • CONSENSUS POP: public-keys.yaml 文件中的 consensus_proof_of_possession

  • ACCOUNT KEY: public-keys.yaml 文件中的 account_public_key

  • VALIDATOR NETWORK KEY: public-keys.yaml 文件中的 validator_network_public_key

全节点搭建(可选)

请参考下一篇

对教程有建议?欢迎加入 MoveMove 社区:https://discord.gg/Vsj7Jwny9G

Last updated