Using Docker
This is a step-by-step guide to install an Aptos node using Docker. Follow these steps to configure a validator node and a validator fullnode on separate machines. Use the fullnode.yaml
to run a validator fullnode. See Step 11.
Before you proceed
Make sure the following are installed on your local computer:
- Aptos CLI: https://doc.alcove.pro/tools/aptos-cli/install-cli/index
- Docker and Docker-compose: https://docs.docker.com/engine/install/
Docker method has only been tested on Linux, Windows, and Intel macOS. If you are on M1 macOS, use the Aptos-core source approach.
-
Create a directory for your Aptos node composition, and pick a username for your node. e.g.
export WORKSPACE=mainnet
export USERNAME=alice
mkdir ~/$WORKSPACE
cd ~/$WORKSPACE -
Download the following files by following the download commands on the Node Files page:
validator.yaml
docker-compose.yaml
docker-compose-fullnode.yaml
haproxy.cfg
haproxy-fullnode.cfg
blocked.ips
-
Generate the key pairs (node owner, voter, operator key, consensus key and networking key) in your working directory.
aptos genesis generate-keys --output-dir ~/$WORKSPACE/keys
This will create 4 key files under
~/$WORKSPACE/keys
directory:public-keys.yaml
private-keys.yaml
validator-identity.yaml
, andvalidator-full-node-identity.yaml
.
IMPORTANTBackup your
private-keys.yaml
somewhere safe. These keys are important for you to establish ownership of your node. Never share private keys with anyone. -
Configure validator information. You need to set up a static IP / DNS address (DNS is much preferred) which can be used by the node, and make sure the network / firewalls are properly configured to accept external connections. See Network Identity For Fullnode for how to do this.
cd ~/$WORKSPACE
aptos genesis set-validator-configuration \
--local-repository-dir ~/$WORKSPACE \
--username $USERNAME \
--owner-public-identity-file ~/$WORKSPACE/keys/public-keys.yaml \
--validator-host <validator node IP / DNS address>:<Port> \
--full-node-host <Full Node IP / DNS address>:<Port> \
--stake-amount 100000000000000
# for example, with IP:
aptos genesis set-validator-configuration \
--local-repository-dir ~/$WORKSPACE \
--username $USERNAME \
--owner-public-identity-file ~/$WORKSPACE/keys/public-keys.yaml \
--validator-host 35.232.235.205:6180 \
--full-node-host 34.135.169.144:6182 \
--stake-amount 100000000000000
# For example, with DNS:
aptos genesis set-validator-configuration \
--local-repository-dir ~/$WORKSPACE \
--username $USERNAME \
--owner-public-identity-file ~/$WORKSPACE/keys/public-keys.yaml \
--validator-host bot.aptosdev.com:6180 \
--full-node-host fn.bot.aptosdev.com:6182 \
--stake-amount 100000000000000This will create two YAML files in the
~/$WORKSPACE/$USERNAME
directory:owner.yaml
andoperator.yaml
. -
Download the following files by following the download commands on the Node Files page:
genesis.blob
waypoint.txt
-
To recap, in your working directory, you should have a list of files:
docker-compose.yaml
docker compose file to run validator and fullnodekeys
folder containing:public-keys.yaml
: Public keys for the owner account, consensus, networking (from step 4).private-keys.yaml
: Private keys for the owner account, consensus, networking (from step 4).validator-identity.yaml
: Private keys for setting the Validator identity (from step 4).validator-full-node-identity.yaml
: Private keys for setting validator full node identity (from step 4).
username
folder containing:owner.yaml
: define owner, operator, and voter mapping. They are all the same account in test mode (from step 5).operator.yaml
: Node information that will be used for both the Validator and the fullnode (from step 5).
waypoint.txt
: The waypoint for the genesis transaction (from step 6).genesis.blob
The genesis binary that contains all the information about the framework, validatorSet and more (from step 6).
-
Run docker-compose:
docker-compose up
. (ordocker compose up
depends on your version)
Now you have completed setting up your validator node. Next, set up a validator fullnode following the instructions below.
-
Set up a validator fullnode on a different machine. Download the
fullnode.yaml
anddocker-compose-fullnode.yaml
configuration files into the working directory of fullnode machine. See Node Files for a full list of files you should download and the download commands. -
Edit
fullnode.yaml
file to update the IP address for validator node. -
Copy the
validator-full-node-identity.yaml
, downloadgenesis.blob
andwaypoint.txt
files into the same working directory on fullnode machine. -
Run docker-compose:
docker-compose -f docker-compose-fullnode.yaml up
.
Now you have successfully completed setting up your node.
Now proceed to connecting to the Aptos network and establishing staking pool operations.