Skip to main content

Using Aptos-core source code

This is a step-by-step guide to install an Aptos node using source code. Follow these steps to configure a validator node and a validator fullnode on separate machines. Use the fullnode.yaml to run a validator fullnodesee Step 12.

Before you proceed

Make sure the following are installed on your local computer:


One validator node + one validator fullnode

Follow the below instructions twice, i.e., first on one machine to run a validator node and the second time on another machine to run a validator fullnode.

  1. Clone the Aptos repo.

    git clone
  2. cd into aptos-core directory.

    cd aptos-core
  3. Run the scripts/ Bash script as shown below. This will prepare your developer environment.

  4. Update your current shell environment.

    source ~/.cargo/env

With your development environment ready, now you can start to setup your validator node.

  1. Checkout the mainnet branch using git checkout --track origin/mainnet.

  2. 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
  3. 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, and

    • validator-full-node-identity.yaml.


      Backup your private-keys.yaml somewhere safe. These keys are important for you to establish ownership of your node. Never share private keys with anyone.

  4. Configure validator information. You need to setup 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.

    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 \
    --full-node-host \
    --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 \
    --full-node-host \
    --stake-amount 100000000000000

    This will create two YAML files in the ~/$WORKSPACE/$USERNAME directory: owner.yaml and operator.yaml.

  5. Download the following files by following the download commands on the Node Files page:

    • validator.yaml
    • fullnode.yaml
    • genesis.blob
    • waypoint.txt
    • haproxy.cfg
    • haproxy-fullnode.cfg and
    • blocked.ips
    • docker-compose-src.yaml
  6. Copy the validator.yaml, fullnode.yaml files into ~/$WORKSPACE/config/ directory.

    mkdir ~/$WORKSPACE/config
    cp validator.yaml ~/$WORKSPACE/config/validator.yaml
    cp fullnode.yaml ~/$WORKSPACE/config/fullnode.yaml

    Modify the config files to update the data directory, key path, genesis file path, waypoint path. User must have write access to data directory.

  7. To recap, in your working directory (`~/$WORKSPACE`), you should have a list of files:
    • config folder containing:
      • validator.yaml validator config file
      • fullnode.yaml fullnode config file
    • keys folder containing:
      • public-keys.yaml: Public keys for the owner account, consensus, networking (from step 7).
      • private-keys.yaml: Private keys for the owner account, consensus, networking (from step 7).
      • validator-identity.yaml: Private keys for setting the Validator identity (from step 7).
      • validator-full-node-identity.yaml: Private keys for setting validator full node identity (from step 7).
    • username folder containing:
      • owner.yaml: Define owner, operator, and voter mapping. They are all the same account in test mode (from step 8).
      • operator.yaml: Node information that will be used for both the Validator and the fullnode (from step 8).
    • waypoint.txt: The waypoint for the genesis transaction (from step 9).
    • genesis.blob The genesis binary that contains all the information about the framework, validatorSet and more (from step 9).
  8. Start your validator by running the below command:

    cargo clean
    cargo run -p aptos-node --release -- -f ~/$WORKSPACE/config/validator.yaml

    Run validator fullnode on another machine:

    cargo clean
    cargo run -p aptos-node --release -- -f ~/$WORKSPACE/config/fullnode.yaml

Now you have completed setting up your node.