Skip to content

Instantly share code, notes, and snippets.

@bert2002
Created August 22, 2022 15:49
Show Gist options
  • Save bert2002/8d31b4e6a341b048538771b328fa9144 to your computer and use it in GitHub Desktop.
Save bert2002/8d31b4e6a341b048538771b328fa9144 to your computer and use it in GitHub Desktop.
Setup a docker based AIT3 devnet of Aptos
#!/bin/bash
# author: bert2002
# script: install a ait3 devnet node for Aptos
# notes:
# - docker must be installed
# - dont run as root ; the user needs to be able to run docker (aka in the docker group)
# - the monitoring port is at port 80 and not port 8080 as default in the registration
# - run the script in a screen session
# - the key informations are in $BASE/$WORKSPACE/keys
# - to reset, rm -rf testnet
BASE=$PWD
# install cli
mkdir cli
cd cli
wget https://github.com/aptos-labs/aptos-core/releases/download/aptos-cli-v0.3.1/aptos-cli-0.3.1-Ubuntu-x86_64.zip
unzip aptos-cli-0.3.1-Ubuntu-x86_64.zip
PATH=$PATH:$PWD
export WORKSPACE=testnet
export USERNAME=tw$$RANDOM
mkdir $BASE/$WORKSPACE
cd $BASE/$WORKSPACE
wget https://github.com/docker/compose/releases/download/v2.10.0/docker-compose-linux-x86_64
chmod +x docker-compose-linux-x86_64
wget https://raw.githubusercontent.com/aptos-labs/aptos-core/main/docker/compose/aptos-node/docker-compose.yaml
wget https://raw.githubusercontent.com/aptos-labs/aptos-core/main/docker/compose/aptos-node/validator.yaml
# generate keys
aptos genesis generate-keys --output-dir $BASE/$WORKSPACE/keys
# configure ip address
aptos genesis set-validator-configuration \
--local-repository-dir $BASE/$WORKSPACE/ \
--username $USERNAME \
--owner-public-identity-file $BASE/$WORKSPACE/keys/public-keys.yaml \
--validator-host $(curl -s ipconfig.me -L -4):6180 \
--stake-amount 100000000000000
# create layout file
aptos genesis generate-layout-template --output-file $BASE/$WORKSPACE/layout.yaml
# well we will override it
echo "root_key: \"D04470F43AB6AEAA4EB616B72128881EEF77346F2075FFE68E14BA7DEBD8095E\"
users: [\"$USERNAME\"]
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" > $BASE/$WORKSPACE/layout.yaml
# download AptosFramework Move
wget https://github.com/aptos-labs/aptos-core/releases/download/aptos-framework-v0.3.0/framework.mrb -O $BASE/$WORKSPACE/framework.mrb
# generate genesis
aptos genesis generate-genesis --local-repository-dir $BASE/$WORKSPACE --output-dir $BASE/$WORKSPACE
# docker-compose up
./docker-compose-linux-x86_64 pull
./docker-compose-linux-x86_64 up
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment