Aptos Incentivized Testnet Docker Guide Eng
May 15, 2022
AptosLabs Building the safest and most scalable Layer 1 blockchain
- Official Guide
- Incentivized Testnet Registration
- Check Node Status: https://node.aptos.zvalid.com/
- My discord: drawrowfly#4024
Latest Update on 15 May 2022
-Content
-Few Notes:
- This is not official guide
- Min hardware requirements: CPU: Intel Xeon Skylake or newer, 4 cores, 8GB RAM
- I have tested this guide on Ubuntu 20.04.4 LTS
-Linux Setup
Option 1 (Docker)
Run Validator/Full Node with one-line script. Tested on Ubuntu 20.04.4 LTS. In can take from 1-5 minutes to setup node through this option.
wget -q -O aptos_docker_ait1.sh https://api.zvalid.com/aptos_docker_ait1.sh && chmod +x aptos_docker_ait1.sh && sudo /bin/bash aptos_docker_ait1.sh
After node instal you will see output with keys that are required to register in to the Incentivized Testnet
==============VALIDATOR/FULL NODE DETAILS==========
VALIDATOR CONSENSUS KEY:
0x087f86764c8a077933061e81346e4740fc0039cceb613b9a9b524c91e0fdc3f9
VALIDATOR ACCOUNT KEY:
0x3267aa313e6b47e87ee9b3834e2c0e928892d5a5811d6a4b420d0fe775ab371e
VALIDATOR NETWORK KEY:
0xa0a52ff76c999888117c323a2713ca2c4595db25d62ae8f2c543df6ece8b0267
FULLNODE NETWORK KEY:
0x184713803d6ac5405c048ea75a9c841a04c93ea6d28d393c6d82879a64d81d09
==================================================
View keys required to register in to the Incentivized Testnet
cat $HOME/.aptos/YOUR_NODE_NAME.yaml
Check full node sync status
curl 127.0.0.1:9103/metrics 2> /dev/null | grep aptos_state_sync_version | grep type
Check validator node sync status
curl 127.0.0.1:9101/metrics 2> /dev/null | grep aptos_state_sync_version | grep type
Full node logs
docker logs -f aptos-fullnode-1 --tail 5000
Validator node logs
docker logs -f aptos-validator-1 --tail 5000
Stop validator/full node
cd ~/.aptos && docker compose stop
Restart validator/full node
cd ~/.aptos && docker compose restart
Start validator/full node
cd ~/.aptos && docker compose up -d
Remove Node Option 1
cd $HOME/.aptos
docker compose down -v
rm -rf $HOME/.aptos
Old Guide: FullNode
Content
-Few Notes:
- This is not official guide
- One-line script will automaticaly generate a unique static identity for your node
- Aptos is in devnet stage - no rewards for now
- Incentivized testnet will start 2022 Q2
- Mainnet in 2022 Q3
- Production grade Fullnode min. recommended: CPU: Intel Xeon Skylake or newer, 4 cores, 8GB RAM
- Development or testing purpose Fullnode min. recommended: CPU: 2 cores, 4GB RAM
- I have tested this guide on Ubuntu 20.04.4 LTS
-Update peer list
If you have used our guide to setup the Aptos FullNode and started having synchronisation problems then you can use this one-line script to automatically update the list of peers. After execute script below your node will be automatically restarted. You can execute following script at any point of time. Eventually i will add more peers to the list.
wget -q -O aptos_renew_seeds.sh https://api.zvalid.com/aptos_renew_seeds.sh && chmod +x aptos_renew_seeds.sh && sudo /bin/bash aptos_renew_seeds.sh
-View your identity details
If you have used our guide to setup the Aptos FullNode and have no idea how to view your peer_id, public_key and private_key details then you can use this one-line script to view them. And if you would like to share your upstream peer id with other users to support the network you can use same script to view the details.
wget -q -O aptos_identity.sh https://api.zvalid.com/aptos_identity.sh && chmod +x aptos_identity.sh && sudo /bin/bash aptos_identity.sh
Example output:
-Linux Setup
Option 1 (systemctl)
Compile from source code and run FullNode as systemctl service + generate a unique static node identity with one-line script. Tested on Ubuntu 20.04.4 LTS. In can take from 10 minutes to few hours to setup node through this option. This option is good in case if setup through Docker didn’t worked then you can use this option to run the node.
Installation time from 10 minutes to few hours
If there was a new release update you can use same one-line script to renew your node. Your private key will stay the same!
wget -q -O aptos.sh https://api.zvalid.com/aptos2.sh && chmod +x aptos.sh && sudo /bin/bash aptos.sh
All node identity related files will be saved to your hdd
To view private key
cat $HOME/aptos/identity/private-key.txt
To view public identity details
cat $HOME/aptos/identity/peer-info.yaml
View logs
journalctl -u aptos-fullnode -f
Stop node
systemctl stop aptos-fullnode
Start node
systemctl start aptos-fullnode
Delete Node Option 1
systemctl stop aptos-fullnode
systemctl disable aptos-fullnode
rm /etc/systemd/system/aptos-fullnode.service
rm -rf $HOME/aptos
rm -rf /opt/aptos
Option 2 (Docker)
Run FullNode + generate a unique static node identity with one-line script. Tested on Ubuntu 20.04.4 LTS. In can take from 5-10 minutes to setup node through this option.
Installation time from 5-10 minutes
If there was a new release update you can use same one-line script to renew your node. Your private key will stay the same!
wget -q -O aptos.sh https://api.zvalid.com/aptos.sh && chmod +x aptos.sh && sudo /bin/bash aptos.sh
All node identity related files will be saved to your hdd
To view private key
cat $HOME/aptos/identity/private-key.txt
To view public identity details
cat $HOME/aptos/identity/peer-info.yaml
View logs
cd $HOME/aptos
docker compose logs -f --tail 1000
Stop node
cd $HOME/aptos
docker compose stop
Start node
cd $HOME/aptos
docker compose start
Delete Node Option 2
cd $HOME/aptos
docker compose down -v
rm -rf $HOME/aptos
Option 3 (Docker - diy)
Do it yourself. Tested on Ubuntu 20.04.4 LTS.
Installation time from 10-30 minutes
- Install docker (if not installed)
sudo apt update
sudo apt install ca-certificates curl gnupg lsb-release wget jq sed -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 update
sudo apt install docker-ce docker-ce-cli containerd.io -y
Testing
docker version
## If there are no errors in terminal then you are good to go
Client: Docker Engine - Communityю...
- Install docker compose v2 (if not installed)
mkdir -p ~/.docker/cli-plugins/
curl -SL https://github.com/docker/compose/releases/download/v2.2.3/docker-compose-linux-x86_64 -o ~/.docker/cli-plugins/docker-compose
chmod +x ~/.docker/cli-plugins/docker-compose
sudo chown $USER /var/run/docker.sock
Testing
docker compose version
## If there are no errors in terminal then you are good to go
Docker Compose version v2.2.3
- Create aptos folder where we will download all config files
mkdir $HOME/aptos
cd $HOME/aptos
wget https://raw.githubusercontent.com/aptos-labs/aptos-core/main/docker/compose/public_full_node/docker-compose.yaml
wget https://raw.githubusercontent.com/aptos-labs/aptos-core/main/docker/compose/public_full_node/public_full_node.yaml
wget https://devnet.aptoslabs.com/genesis.blob
wget https://devnet.aptoslabs.com/waypoint.txt
- Create identity folder where we will save a static node identity details(files)
mkdir $HOME/aptos/identity
- Generate a unique static node identity
docker run --rm --name aptos_tools -d -i aptoslab/tools:devnet
docker exec -it aptos_tools aptos-operational-tool generate-key --encoding hex --key-type x25519 --key-file $HOME/private-key.txt
docker exec -it aptos_tools cat $HOME/private-key.txt > $HOME/aptos/identity/private-key.txt
docker exec -it aptos_tools aptos-operational-tool extract-peer-from-file --encoding hex --key-file $HOME/private-key.txt --output-file $HOME/peer-info.yaml &> /dev/null
docker exec -it aptos_tools cat $HOME/peer-info.yaml > $HOME/aptos/identity/peer-info.yaml
PEER_ID=$(sed -n 5p $HOME/aptos/identity/peer-info.yaml | sed 's/ - \(.*\)/\1/')
PRIVATE_KEY=$(cat $HOME/aptos/identity/private-key.txt)
docker stop aptos_tools
- Set node identity
cd $HOME/aptos
sed -i '/ discovery_method: "onchain"$/a\
identity:\
type: "from_config"\
key: "'$PRIVATE_KEY'"\
peer_id: "'$PEER_ID'"' public_full_node.yaml
All node identity related files will be saved to your hdd
To view private key
cat $HOME/aptos/identity/private-key.txt
To view public identity details
cat $HOME/aptos/identity/id.json
- Start FullNode
docker compose up -d
- Verify the correctness of your FullNode
curl 127.0.0.1:9101/metrics 2> /dev/null | grep aptos_state_sync_version | grep type
Example output
- To view docker logs (not required)
docker logs -f aptos-fullnode-1 --tail 5000
Update Option 3
In case there was a new node release and you’ve used Option 3 to install the node, then you can update your node this way
Go to aptos config folder
cd $HOME/aptos
Stop Docker and remove all volumes
sudo docker compose down -v
Check if there is an updated version of aptos-validator Docker image
sudo docker pull aptoslab/validator:devnet
Check if there is an updated version of aptos-tools Docker image
sudo docker pull aptoslab/tools:devnet
Start aptos-tools to renew peer id
sudo docker run --rm --name aptos_tools -d -i aptoslab/tools:devnet
Renew peer id
sudo docker cp $HOME/aptos/identity/private-key.txt aptos_tools:/root
sudo docker exec -it aptos_tools aptos-operational-tool extract-peer-from-file --encoding hex --key-file $HOME/private-key.txt --output-file $HOME/peer-info.yaml
sudo docker exec -it aptos_tools cat $HOME/peer-info.yaml > $HOME/aptos/identity/peer-info.yaml
Stop aptos-tools Docker
sudo docker stop aptos_tools
Get the new peer id
PEER_ID=$(sed -n 2p $HOME/aptos/identity/peer-info.yaml | sed 's/..$//')
Set new peer id
sed -i -e "s/peer_id:.*/peer_id: \"$PEER_ID\"/" $HOME/aptos/public_full_node.yaml
Delete old file genesis.blob
rm $HOME/aptos/genesis.blob
Download new file genesis.blob
wget -P $HOME/aptos https://devnet.aptoslabs.com/genesis.blob
Delete old file waypoint.txt
rm $HOME/aptos/waypoint.txt
Download new file waypoint.txt
wget -P $HOME/aptos https://devnet.aptoslabs.com/waypoint.txt
Set new waypoint.txt value in public_full_node.yaml
sed -i.bak 's/\(from_config: \).*/\1"'$(cat $HOME/aptos/waypoint.txt)'"/g' $HOME/aptos/public_full_node.yaml
Start the node
sudo docker compose up -d
Delete Node Option 2
cd $HOME/aptos
docker compose down -v
rm -rf $HOME/aptos
Two ways to verify initial synchronization
1.Through terminal:
curl 127.0.0.1:9101/metrics 2> /dev/null | grep aptos_state_sync_version | grep type
Cheers