# [AIT3] Aptos Validatorの構築方法 **Published by:** [qyeah](https://paragraph.com/@qyeah/) **Published on:** 2022-08-21 **URL:** https://paragraph.com/@qyeah/ait3-aptos-validator ## Content 1. 目的2022年8月に実施される、AptosにおいてAIT3 (報酬付きテストネット)でのValidatorの構築方法を記載します。 Validatorを建てて、テストネットに貢献するとAptosトークンでの報酬が付与されますので、ぜひ参加ください。実施内容Aptos Validatorの構築 <-------------- 今回の実施項目ですPetra WalletのインストールAptos Communityサイトに登録日程※ アメリカ西海岸時刻での記載です。日本との時差に注意してください登録開始日:8月19日登録終了日:8月25日合格通知日:8月29日テストネット開始:8月30日テストネット終了:9月9日2. 要件2-1. Hardware要件CPU:8 cores, 16 threads以上2.8GHz以上Intel Xeon Skylakeより最新Memory 32GB RAM以上**Storage **300GB以上Network帯域 : 1 Gbps以上Validator: 6180, 9101 (登録時のみでOK)ポートの開放FullNodeの場合: 6182, 9101 (登録時のみでOK), 80, 8080ポートの開放Aptos公式のサイトより参照しています https://aptos.dev/nodes/ait/node-requirements/2-2. 各種クラウド / VPSでの対応スペックAWSc5.4xlargec6i.4xlargeGCPc2-standard-16AzureStandard_B8msContaboCloud VPS LHetznerCX513. 導入方法3-1. 事前準備サーバの準備が必要になります サーバスペックや、セキュリティルールについては今回の要件にあわせてください Aptosでは、地理的な分散性やLayer1 for everyoneの実現のために、AIT1ではスキルベースではなく地理的な分散性以外では完全にランダムに選出されました。 今回のAIT3では過去のAITにおいて良い結果を出した一部の人の枠はありますが、それ以外の枠については引き続きランダム選出との話が出ています。 Aptosにおいて地理的な分散性は重要項目であるため、ぜひトライして分散化に協力してください。 誰も建てない国や地域ででサーバを建てると選出されやすくなるため、ぜひトライしてみてくださいAIT2における選出ノードの位置です ノードを構築する際に参考にしてくださいAIT2ノード位置**注記事項**AIT2の応募段階では、Aptos公式からアフリカ大陸でのNodeを希望するという要件が出ていましたが、現状のAptosのコンセンサスメカニズムにおいて、各ノード間の遅延がVoting powerの大きく影響するようです。 各ノード (アメリカやヨーロッパに集中している)からの地理的な距離が遠いNodeは、Voting powerが小さくなり、報酬付与要件を満たすのが困難な事象が発生しました。 今回のAIT3ではconsensus proposalやVotingに関する要件はないため、大きな問題はないと想定しますが、ご注意ください3-2. Install方法3-2-1. エンジニアの人 ぜひ、スキルアップ & Aptosの知識の取得のためにも、公式手順書でトライしてみてください https://aptos.dev/nodes/validator-node/validators ** 3-2-2. 初心者の方** 以前までは、簡易インストーラーを作成していましたが、AITに選出されてから困ることもあるため、今回は公式手順を順々に追って実施する方法を紹介します。 3-2-2-1. サーバにログインする 3-2-2-2. Rootユーザ (特権ユーザ)になるsudo su - cd &HOME 3-2-2-3.パッケージのUpdateとインストールsudo apt update -y sudo apt upgrade -y sudo apt install unzip -y 3-2-2-4. dockerのインストールsudo apt-get install ca-certificates curl gnupg lsb-release wget -y curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null sudo apt-get update sudo apt-get install docker-ce docker-ce-cli containerd.io -y sudo mkdir -p ~/.docker/cli-plugins/ sudo curl -SL https://github.com/docker/compose/releases/download/v2.6.1/docker-compose-linux-x86_64 -o ~/.docker/cli-plugins/docker-compose sudo chmod +x ~/.docker/cli-plugins/docker-compose sudo chown $USER /var/run/docker.sock 3-2-2-5. Aptos CLI v0.3.1のインストールsudo wget -qO aptos-cli.zip https://github.com/aptos-labs/aptos-core/releases/download/aptos-cli-v0.3.1/aptos-cli-0.3.1-Ubuntu-x86_64.zip sudo unzip -o aptos-cli.zip -d /usr/bin sudo chmod +x /usr/bin/aptos 3-2-2-6. Aptos Nodeのインストールsudo mkdir -p ~/testnet && cd ~/testnet sudo wget https://raw.githubusercontent.com/aptos-labs/aptos-core/main/docker/compose/aptos-node/docker-compose.yaml sudo wget https://raw.githubusercontent.com/aptos-labs/aptos-core/main/docker/compose/aptos-node/validator.yaml Keyの作成aptos genesis generate-keys --output-dir ~/testnet/keys Validator設定ファイルの作成# テンプレート aptos genesis set-validator-configuration \ --local-repository-dir ~/testnet \ --username <ユーザ名> \ --owner-public-identity-file ~/testnet/keys/public-keys.yaml \ --validator-host <クラウド・VPSで契約したサーバのIP>:6180 \ --stake-amount 100000000000000 # 例 aptos genesis set-validator-configuration \ --local-repository-dir ~/testnet \ --username aptosjapan \ --owner-public-identity-file ~/testnet/keys/public-keys.yaml \ --validator-host 18.183.24.1:6180 \ --stake-amount 100000000000000 ■<ユーザ名> 好きな名前を設定してください。日本語は不可です。 アルファベットと数字のみ使用可能です**■<クラウド・VPSで契約したサーバのIP> **サーバにログインした際のIPですValidator Setファイルの作成aptos genesis generate-layout-template --output-file ~/testnet/layout.yaml Validator Setファイルの編集sed -e 's/root_key: ~/root_key: "D04470F43AB6AEAA4EB616B72128881EEF77346F2075FFE68E14BA7DEBD8095E"/g' -i ~/testnet/layout.yaml sed -e 's/chain_id: 4/chain_id: 43/g' -i ~/testnet/layout.yaml # テンプレート sed -e 's/users: \[\]/users: \["<ユーザ名>"\]/g' -i ~/testnet/layout.yaml # 例 sed -e 's/users: \[\]/users: \["aptosjapan"\]/g' -i ~/testnet/layout.yaml ■<ユーザ名> 先ほどの「Validator設定ファイルの作成」で設定したユーザ名と同じ名前にしてくださいAptos Frameworkのダウンロードwget https://github.com/aptos-labs/aptos-core/releases/download/aptos-framework-v0.3.0/framework.mrb -P ~/testnet Genesis blobとwaypointのコンパイルaptos genesis generate-genesis --local-repository-dir ~/testnet --output-dir ~/testnet Aptos Nodeの起動docker compose up -d 3-2-2-7. 起動後の確認 Aptos Nodeが起動しているか確認curl 127.0.0.1:9101/metrics 2> /dev/null | grep aptos_consensus_proposals_count 上記コマンドを複数回実行して、数値がカウントアップしていることを確認curl 127.0.0.1:9101/metrics 2> /dev/null | grep aptos_state_sync_version{type=\"synced\"} 上記コマンドを複数回実行して、数値がカウントアップしていることを確認3-2-2-8. 登録に必要な情報の確認# テンプレート cat ~/testnet/<ユーザ名>/operator.yaml # 例 cat ~/testnet/aptosjapan/operator.yaml ■<ユーザ名> 先ほどの「Validator設定ファイルの作成」で設定したユーザ名と同じ名前にしてください実施内容Aptos Validatorの構築Petra Walletのインストール <-------------- 次の実施項目ですAptos Communityサイトに登録 ## Publication Information - [qyeah](https://paragraph.com/@qyeah/): Publication homepage - [All Posts](https://paragraph.com/@qyeah/): More posts from this publication - [RSS Feed](https://api.paragraph.com/blogs/rss/@qyeah): Subscribe to updates